Fix handling dimension values.

This commit is contained in:
Roman Telezhynskyi 2023-10-06 08:56:10 +03:00
parent 6ddb2a4875
commit be88184f7c
4 changed files with 18 additions and 18 deletions

View File

@ -851,9 +851,9 @@ auto MApplication::StartWithFiles(QCommandLineParser &parser) -> bool
bool flagDimensionC = false;
bool flagUnits = false;
int dimensionAValue = 0;
int dimensionBValue = 0;
int dimensionCValue = 0;
qreal dimensionAValue = 0;
qreal dimensionBValue = 0;
qreal dimensionCValue = 0;
Unit unit = Unit::Cm;
ParseDimensionAOption(parser, dimensionAValue, flagDimensionA);
@ -916,14 +916,14 @@ auto MApplication::SingleStart(QCommandLineParser &parser) -> bool
}
//---------------------------------------------------------------------------------------------------------------------
void MApplication::ParseDimensionAOption(QCommandLineParser &parser, int &dimensionAValue, bool &flagDimensionA)
void MApplication::ParseDimensionAOption(QCommandLineParser &parser, qreal &dimensionAValue, bool &flagDimensionA)
{
if (parser.isSet(*LONG_OPTION_DIMENSION_A))
{
const QString value = parser.value(*LONG_OPTION_DIMENSION_A);
bool ok = false;
dimensionAValue = value.toInt(&ok);
dimensionAValue = value.toDouble(&ok);
if (ok && dimensionAValue > 0)
{
flagDimensionA = true;
@ -937,14 +937,14 @@ void MApplication::ParseDimensionAOption(QCommandLineParser &parser, int &dimens
}
//---------------------------------------------------------------------------------------------------------------------
void MApplication::ParseDimensionBOption(QCommandLineParser &parser, int &dimensionBValue, bool &flagDimensionB)
void MApplication::ParseDimensionBOption(QCommandLineParser &parser, qreal &dimensionBValue, bool &flagDimensionB)
{
if (parser.isSet(*LONG_OPTION_DIMENSION_B))
{
const QString value = parser.value(*LONG_OPTION_DIMENSION_B);
bool ok = false;
dimensionBValue = value.toInt(&ok);
dimensionBValue = value.toDouble(&ok);
if (ok && dimensionBValue > 0)
{
flagDimensionB = true;
@ -958,14 +958,14 @@ void MApplication::ParseDimensionBOption(QCommandLineParser &parser, int &dimens
}
//---------------------------------------------------------------------------------------------------------------------
void MApplication::ParseDimensionCOption(QCommandLineParser &parser, int &dimensionCValue, bool &flagDimensionC)
void MApplication::ParseDimensionCOption(QCommandLineParser &parser, qreal &dimensionCValue, bool &flagDimensionC)
{
if (parser.isSet(*LONG_OPTION_DIMENSION_C))
{
const QString value = parser.value(*LONG_OPTION_DIMENSION_C);
bool ok = false;
dimensionCValue = value.toInt(&ok);
dimensionCValue = value.toDouble(&ok);
if (ok && dimensionCValue > 0)
{
flagDimensionC = true;

View File

@ -107,9 +107,9 @@ private:
auto StartWithFiles(QCommandLineParser &parser) -> bool;
auto SingleStart(QCommandLineParser &parser) -> bool;
static void ParseDimensionAOption(QCommandLineParser &parser, int &dimensionAValue, bool &flagDimensionA);
static void ParseDimensionBOption(QCommandLineParser &parser, int &dimensionBValue, bool &flagDimensionB);
static void ParseDimensionCOption(QCommandLineParser &parser, int &dimensionCValue, bool &flagDimensionC);
static void ParseDimensionAOption(QCommandLineParser &parser, qreal &dimensionAValue, bool &flagDimensionA);
static void ParseDimensionBOption(QCommandLineParser &parser, qreal &dimensionBValue, bool &flagDimensionB);
static void ParseDimensionCOption(QCommandLineParser &parser, qreal &dimensionCValue, bool &flagDimensionC);
static void ParseUnitsOption(QCommandLineParser &parser, Unit &unit, bool &flagUnits);
};

View File

@ -337,7 +337,7 @@ void TMainWindow::RetranslateTable()
}
//---------------------------------------------------------------------------------------------------------------------
void TMainWindow::SetDimensionABase(int base)
void TMainWindow::SetDimensionABase(qreal base)
{
const QList<MeasurementDimension_p> dimensions = m_m->Dimensions().values();
@ -361,7 +361,7 @@ void TMainWindow::SetDimensionABase(int base)
}
//---------------------------------------------------------------------------------------------------------------------
void TMainWindow::SetDimensionBBase(int base)
void TMainWindow::SetDimensionBBase(qreal base)
{
const QList<MeasurementDimension_p> dimensions = m_m->Dimensions().values();
@ -385,7 +385,7 @@ void TMainWindow::SetDimensionBBase(int base)
}
//---------------------------------------------------------------------------------------------------------------------
void TMainWindow::SetDimensionCBase(int base)
void TMainWindow::SetDimensionCBase(qreal base)
{
const QList<MeasurementDimension_p> dimensions = m_m->Dimensions().values();

View File

@ -58,9 +58,9 @@ public:
void RetranslateTable();
void SetDimensionABase(int base);
void SetDimensionBBase(int base);
void SetDimensionCBase(int base);
void SetDimensionABase(qreal base);
void SetDimensionBBase(qreal base);
void SetDimensionCBase(qreal base);
void SetPUnit(Unit unit);
auto LoadFile(const QString &path) -> bool;