diff --git a/Tests/scheduler/simple_test_no_twilight.esl b/Tests/scheduler/simple_test_no_twilight.esl --- a/Tests/scheduler/simple_test_no_twilight.esl +++ b/Tests/scheduler/simple_test_no_twilight.esl @@ -5,8 +5,8 @@ Alnath 10 -5.43806 -28.6078 +5.43819 +28.6079 /tmp/kstars_tests/1x1s_Lum.esq @@ -26,8 +26,8 @@ Alnilam 10 -5.60306 --1.20167 +5.60356 +-1.20192 /tmp/kstars_tests/1x1s_Lum.esq @@ -47,8 +47,8 @@ Alnitak 10 -5.67917 --1.9425 +5.67931 +-1.94258 /tmp/kstars_tests/1x1s_Lum.esq @@ -68,8 +68,8 @@ Alphard 10 -9.45944 --8.65806 +9.45979 +-8.6586 /tmp/kstars_tests/1x1s_Lum.esq @@ -90,7 +90,7 @@ 10 15.5781 -26.7144 +26.7149 /tmp/kstars_tests/1x1s_Lum.esq @@ -110,8 +110,8 @@ Alpheratz 10 -0.139444 -29.0906 +0.139769 +29.0908 /tmp/kstars_tests/1x1s_Lum.esq @@ -131,8 +131,8 @@ Alphirk 10 -21.4775 -70.5606 +21.4777 +70.5607 /tmp/kstars_tests/1x1s_Lum.esq @@ -152,8 +152,8 @@ Alshain 10 -19.9217 -6.40667 +19.9219 +6.40676 /tmp/kstars_tests/1x1s_Lum.esq @@ -173,8 +173,8 @@ Altair 10 -19.8458 -8.86694 +19.8463 +8.86738 /tmp/kstars_tests/1x1s_Lum.esq @@ -194,8 +194,8 @@ Altais 10 -19.2092 -67.6614 +19.2093 +67.6615 /tmp/kstars_tests/1x1s_Lum.esq @@ -215,7 +215,7 @@ Aludra 10 -7.40139 +7.40159 -29.3031 /tmp/kstars_tests/1x1s_Lum.esq @@ -236,8 +236,8 @@ Alya 10 -18.9367 -4.20306 +18.937 +4.2036 /tmp/kstars_tests/1x1s_Lum.esq diff --git a/kstars/ekos/scheduler/scheduler.cpp b/kstars/ekos/scheduler/scheduler.cpp --- a/kstars/ekos/scheduler/scheduler.cpp +++ b/kstars/ekos/scheduler/scheduler.cpp @@ -323,12 +323,12 @@ StarObject *s = dynamic_cast(object); if (s->getHDIndex() != 0) - finalObjectName = QString("HD %1").arg(QString::number(s->getHDIndex())); + finalObjectName = QString("HD %1").arg(s->getHDIndex()); } nameEdit->setText(finalObjectName); - raBox->setText(object->ra0().toHMSString(false, true)); - decBox->setText(object->dec0().toDMSString(false, false, true)); + raBox->showInHours(object->ra0()); + decBox->showInDegrees(object->dec0()); addToQueueB->setEnabled(sequenceEdit->text().isEmpty() == false); mosaicB->setEnabled(sequenceEdit->text().isEmpty() == false); @@ -719,8 +719,8 @@ prioritySpin->setValue(job->getPriority()); - raBox->setText(job->getTargetCoords().ra0().toHMSString()); - decBox->setText(job->getTargetCoords().dec0().toDMSString()); + raBox->showInHours(job->getTargetCoords().ra0()); + decBox->showInDegrees(job->getTargetCoords().dec0()); if (job->getFITSFile().isEmpty() == false) { @@ -1801,7 +1801,7 @@ { appendLogText(i18n("Warning: job '%1' reaches an altitude of %2 degrees at %3 but will not be scheduled due to " "close proximity to astronomical twilight rise.", - job->getName(), QString::number(minAltitude, 'g', 3), startTime.toString(job->getDateTimeDisplayFormat()))); + job->getName(), QString("%L1").arg(minAltitude, 0, 'f', 3), startTime.toString(job->getDateTimeDisplayFormat()))); return false; } @@ -1813,7 +1813,7 @@ job->setStartupTime(startTime); /* Kept the informative log because of the reschedule of aborted jobs */ appendLogText(i18n("Job '%1' is scheduled to start at %2 where its altitude is %3 degrees.", job->getName(), - startTime.toString(job->getDateTimeDisplayFormat()), QString::number(altitude, 'g', 3))); + startTime.toString(job->getDateTimeDisplayFormat()), QString("%L1").arg(altitude, 0, 'f', 3))); return true; } } @@ -1824,15 +1824,15 @@ if (job->getEnforceTwilight()) { appendLogText(i18n("Warning: job '%1' has no night time with an altitude above %2 degrees during the next 24 hours, marking invalid.", - job->getName(), QString::number(minAltitude, 'g', 3))); + job->getName(), QString("%L1").arg(minAltitude, 0, 'f', 3))); } else appendLogText(i18n("Warning: job '%1' cannot rise to an altitude above %2 degrees in the next 24 hours, marking invalid.", - job->getName(), QString::number(minAltitude, 'g', 3))); + job->getName(), QString("%L1").arg(minAltitude, 0, 'f', 3))); } else appendLogText(i18n("Warning: job '%1' cannot be scheduled with an altitude above %2 degrees with minimum moon " "separation of %3 degrees in the next 24 hours, marking invalid.", - job->getName(), QString::number(minAltitude, 'g', 3), - QString::number(minMoonAngle, 'g', 3))); + job->getName(), QString("%L1").arg(minAltitude, 0, 'f', 3), + QString("%L1").arg(minMoonAngle, 0, 'f', 3))); return false; } @@ -2003,7 +2003,7 @@ /* Kept the informative log now that scores are displayed */ appendLogText(i18n("Job '%1' target altitude is %3 degrees at %2 (score %4).", job->getName(), when.toString(job->getDateTimeDisplayFormat()), - QString::number(currentAlt, 'g', 3), QString::asprintf("%+d", score))); + QString("%L1").arg(currentAlt, 0, 'f', 3), QString::asprintf("%+d", score))); return score; } @@ -3761,6 +3761,9 @@ minAltitude->setValue(minAltitude->minimum()); minMoonSeparation->setValue(minMoonSeparation->minimum()); + // We expect all data read from the XML to be in the C locale - QLocale::c() + QLocale cLocale = QLocale::c(); + for (ep = nextXMLEle(root, 1); ep != nullptr; ep = nextXMLEle(root, 0)) { if (!strcmp(tagXMLEle(ep), "Name")) @@ -3773,14 +3776,14 @@ if (subEP) { dms ra; - ra.setH(atof(pcdataXMLEle(subEP))); + ra.setH(cLocale.toDouble(pcdataXMLEle(subEP))); raBox->showInHours(ra); } subEP = findXMLEle(ep, "J2000DE"); if (subEP) { dms de; - de.setD(atof(pcdataXMLEle(subEP))); + de.setD(cLocale.toDouble(pcdataXMLEle(subEP))); decBox->showInDegrees(de); } } @@ -3803,7 +3806,7 @@ else if (!strcmp("Culmination", pcdataXMLEle(subEP))) { culminationConditionR->setChecked(true); - culminationOffset->setValue(atof(findXMLAttValu(subEP, "value"))); + culminationOffset->setValue(cLocale.toDouble(findXMLAttValu(subEP, "value"))); } else if (!strcmp("At", pcdataXMLEle(subEP))) { @@ -3819,12 +3822,12 @@ if (!strcmp("MinimumAltitude", pcdataXMLEle(subEP))) { altConstraintCheck->setChecked(true); - minAltitude->setValue(atof(findXMLAttValu(subEP, "value"))); + minAltitude->setValue(cLocale.toDouble(findXMLAttValu(subEP, "value"))); } else if (!strcmp("MoonSeparation", pcdataXMLEle(subEP))) { moonSeparationCheck->setChecked(true); - minMoonSeparation->setValue(atof(findXMLAttValu(subEP, "value"))); + minMoonSeparation->setValue(cLocale.toDouble(findXMLAttValu(subEP, "value"))); } else if (!strcmp("EnforceWeather", pcdataXMLEle(subEP))) weatherCheck->setChecked(true); @@ -3841,7 +3844,7 @@ else if (!strcmp("Repeat", pcdataXMLEle(subEP))) { repeatCompletionR->setChecked(true); - repeatsSpin->setValue(atoi(findXMLAttValu(subEP, "value"))); + repeatsSpin->setValue(cLocale.toInt(findXMLAttValu(subEP, "value"))); } else if (!strcmp("Loop", pcdataXMLEle(subEP))) loopCompletionR->setChecked(true); @@ -3947,6 +3950,9 @@ QTextStream outstream(&file); + // We serialize sequence data to XML using the C locale + QLocale cLocale = QLocale::c(); + outstream << "" << endl; outstream << "" << endl; outstream << "" << schedulerProfileCombo->currentText() << "" << endl; @@ -3958,8 +3964,8 @@ outstream << "" << job->getName() << "" << endl; outstream << "" << job->getPriority() << "" << endl; outstream << "" << endl; - outstream << "" << job->getTargetCoords().ra0().Hours() << "" << endl; - outstream << "" << job->getTargetCoords().dec0().Degrees() << "" << endl; + outstream << "" << cLocale.toString(job->getTargetCoords().ra0().Hours()) << "" << endl; + outstream << "" << cLocale.toString(job->getTargetCoords().dec0().Degrees()) << "" << endl; outstream << "" << endl; if (job->getFITSFile().isValid() && job->getFITSFile().isEmpty() == false) @@ -3971,17 +3977,17 @@ if (job->getFileStartupCondition() == SchedulerJob::START_ASAP) outstream << "ASAP" << endl; else if (job->getFileStartupCondition() == SchedulerJob::START_CULMINATION) - outstream << "Culmination" << endl; + outstream << "Culmination" << endl; else if (job->getFileStartupCondition() == SchedulerJob::START_AT) outstream << "At" << endl; outstream << "" << endl; outstream << "" << endl; if (job->getMinAltitude() > 0) - outstream << "MinimumAltitude" << endl; + outstream << "MinimumAltitude" << endl; if (job->getMinMoonSeparation() > 0) - outstream << "MoonSeparation" + outstream << "MoonSeparation" << endl; if (job->getEnforceWeather()) outstream << "EnforceWeather" << endl; @@ -3993,7 +3999,7 @@ if (job->getCompletionCondition() == SchedulerJob::FINISH_SEQUENCE) outstream << "Sequence" << endl; else if (job->getCompletionCondition() == SchedulerJob::FINISH_REPEAT) - outstream << "Repeat" << endl; + outstream << "Repeat" << endl; else if (job->getCompletionCondition() == SchedulerJob::FINISH_LOOP) outstream << "Loop" << endl; else if (job->getCompletionCondition() == SchedulerJob::FINISH_AT) @@ -5594,8 +5600,8 @@ sequenceEdit->setText(filename); sequenceURL = QUrl::fromLocalFile(filename); - raBox->setText(oneJob->skyCenter.ra0().toHMSString()); - decBox->setText(oneJob->skyCenter.dec0().toDMSString()); + raBox->showInHours(oneJob->skyCenter.ra0()); + decBox->showInDegrees(oneJob->skyCenter.dec0()); saveJob(); } diff --git a/kstars/ekos/scheduler/schedulerjob.cpp b/kstars/ekos/scheduler/schedulerjob.cpp --- a/kstars/ekos/scheduler/schedulerjob.cpp +++ b/kstars/ekos/scheduler/schedulerjob.cpp @@ -478,14 +478,14 @@ if (captureCountCell && captureCountCell->tableWidget()) { - captureCountCell->setText(QString("%1/%2").arg(completedCount).arg(sequenceCount)); + captureCountCell->setText(QString("%L1/%L2").arg(completedCount).arg(sequenceCount)); captureCountCell->tableWidget()->resizeColumnToContents(captureCountCell->column()); } if (scoreCell && scoreCell->tableWidget()) { if (0 <= score) - scoreCell->setText(QString("%1").arg(score)); + scoreCell->setText(QString("%L1").arg(score)); else /* FIXME: negative scores are just weird for the end-user */ scoreCell->setText(QString("<0"));