From 6c090a83b3c8c7e93f10ba041859bcca3421ece3 Mon Sep 17 00:00:00 2001 From: ftomei Date: Mon, 30 Oct 2023 16:08:17 +0100 Subject: [PATCH 1/2] fix locale - radiation settings --- project/dialogRadiation.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/project/dialogRadiation.cpp b/project/dialogRadiation.cpp index 61286dca4..db8bc2c0c 100644 --- a/project/dialogRadiation.cpp +++ b/project/dialogRadiation.cpp @@ -1,4 +1,5 @@ #include +#include #include "project.h" #include "radiationSettings.h" @@ -24,16 +25,16 @@ DialogRadiation::DialogRadiation(Project* myProject) comboRealSky = new QComboBox(); comboLinkeMode = new QComboBox(); groupLinke = new QGroupBox("Linke turbidity factor"); - editLinke = new QLineEdit(QString::number(double(project_->radSettings.getLinke()))); + editLinke = new QLineEdit(QLocale().toString(project_->radSettings.getLinke())); buttonLinke = new QPushButton("Load Linke map..."); editLinkeMap = new QLineEdit(); comboAlbedoMode = new QComboBox(); buttonAlbedo = new QPushButton("Load albedo map..."); editAlbedoMap = new QLineEdit(); - editAlbedo = new QLineEdit(QString::number(double(project_->radSettings.getAlbedo()))); + editAlbedo = new QLineEdit(QLocale().toString(project_->radSettings.getAlbedo())); comboTiltMode = new QComboBox(); - editTilt = new QLineEdit(QString::number(double(project_->radSettings.getTilt()))); - editAspect = new QLineEdit(QString::number(double(project_->radSettings.getAspect()))); + editTilt = new QLineEdit(QLocale().toString(project_->radSettings.getTilt())); + editAspect = new QLineEdit(QLocale().toString(project_->radSettings.getAspect())); // -------------------------------------------------------- // algorithm @@ -88,7 +89,7 @@ DialogRadiation::DialogRadiation(Project* myProject) layoutTransSettings->addLayout(layoutTransAlgorithm); QLabel* labelTransClear = new QLabel("clear sky transmissivity"); - editTransClearSky = new QLineEdit(QString::number(double(project_->radSettings.getClearSky()))); + editTransClearSky = new QLineEdit(QLocale().toString(project_->radSettings.getClearSky())); QDoubleValidator* doubleValClearSky = new QDoubleValidator(0.0, 1.0, 2, this); editTransClearSky->setValidator(doubleValClearSky); layoutTransSettings->addWidget(labelTransClear); @@ -343,7 +344,7 @@ void DialogRadiation::accept() return; } else { - linke = editLinke->text().toFloat(); + linke = QLocale().toFloat(editLinke->text()); } } else if (linkeMode == PARAM_MODE_MAP) @@ -365,7 +366,7 @@ void DialogRadiation::accept() return; } else { - albedo = editAlbedo->text().toFloat(); + albedo = QLocale().toFloat(editAlbedo->text()); } } @@ -386,7 +387,7 @@ void DialogRadiation::accept() return; } else { - tilt = editTilt->text().toFloat(); + tilt = QLocale().toFloat(editTilt->text()); } @@ -396,7 +397,7 @@ void DialogRadiation::accept() return; } else { - aspect = editAspect->text().toFloat(); + aspect = QLocale().toFloat(editAspect->text()); } } @@ -407,7 +408,7 @@ void DialogRadiation::accept() project_->radSettings.setTiltMode(tiltMode); project_->radSettings.setRealSky(realSky); project_->radSettings.setShadowing(checkShadowing->isChecked()); - project_->radSettings.setClearSky(editTransClearSky->text().toFloat()); + project_->radSettings.setClearSky(QLocale().toFloat(editTransClearSky->text())); if (linke != NODATA) project_->radSettings.setLinke(linke); if (albedo != NODATA) project_->radSettings.setAlbedo(albedo); From 11520704b120642cf291ee5fdbd836154698fff9 Mon Sep 17 00:00:00 2001 From: ftomei Date: Mon, 30 Oct 2023 18:04:51 +0100 Subject: [PATCH 2/2] fix locale snow --- project/dialogInterpolation.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/project/dialogInterpolation.cpp b/project/dialogInterpolation.cpp index 335271ead..f424ed620 100644 --- a/project/dialogInterpolation.cpp +++ b/project/dialogInterpolation.cpp @@ -96,7 +96,7 @@ DialogInterpolation::DialogInterpolation(Project *myProject) doubleValR2->setNotation(QDoubleValidator::StandardNotation); minRegressionR2Edit.setFixedWidth(30); minRegressionR2Edit.setValidator(doubleValR2); - minRegressionR2Edit.setText(QString::number(double(_interpolationSettings->getMinRegressionR2()))); + minRegressionR2Edit.setText(QLocale().toString(_interpolationSettings->getMinRegressionR2())); layoutR2->addWidget(labelMinR2); layoutR2->addWidget(&minRegressionR2Edit); layoutDetrending->addLayout(layoutR2); @@ -130,7 +130,7 @@ DialogInterpolation::DialogInterpolation(Project *myProject) QIntValidator *intValMinPoints = new QIntValidator(1, 1000, this); minPointsLocalDetrendingEdit.setFixedWidth(30); minPointsLocalDetrendingEdit.setValidator(intValMinPoints); - minPointsLocalDetrendingEdit.setText(QString::number(int(_interpolationSettings->getMinPointsLocalDetrending()))); + minPointsLocalDetrendingEdit.setText(QString::number(_interpolationSettings->getMinPointsLocalDetrending())); layoutDetrending->addWidget(labelMinPointsLocalDetrendingEdit); layoutDetrending->addWidget(&minPointsLocalDetrendingEdit); @@ -284,11 +284,11 @@ void DialogInterpolation::accept() _interpolationSettings->setUseThermalInversion(thermalInversionEdit->isChecked()); _interpolationSettings->setUseDewPoint(useDewPointEdit->isChecked()); _interpolationSettings->setUseInterpolatedTForRH((useInterpolTForRH->isChecked())); - _interpolationSettings->setMinRegressionR2(minRegressionR2Edit.text().toFloat()); + _interpolationSettings->setMinRegressionR2(QLocale().toFloat(minRegressionR2Edit.text())); _interpolationSettings->setTopoDist_maxKh(maxTdMultiplierEdit.text().toInt()); _interpolationSettings->setMinPointsLocalDetrending(minPointsLocalDetrendingEdit.text().toInt()); - _qualityInterpolationSettings->setMinRegressionR2(minRegressionR2Edit.text().toFloat()); + _qualityInterpolationSettings->setMinRegressionR2(QLocale().toFloat(minRegressionR2Edit.text())); _qualityInterpolationSettings->setTopoDist_maxKh(maxTdMultiplierEdit.text().toInt()); _qualityInterpolationSettings->setUseLapseRateCode(lapseRateCodeEdit->isChecked()); _qualityInterpolationSettings->setUseThermalInversion(thermalInversionEdit->isChecked());