From cbb18beacaa0158c6fbcecfdaf021c2b36d0daac Mon Sep 17 00:00:00 2001 From: "Alexander V. Wolf" Date: Sun, 21 Jan 2024 18:19:59 +0700 Subject: [PATCH] Fix updating Rise/Transit/Set info after switching location if the object was selected (fix #3602) --- src/gui/AstroCalcDialog.cpp | 17 ++++++++++++++++- src/gui/AstroCalcDialog.hpp | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/gui/AstroCalcDialog.cpp b/src/gui/AstroCalcDialog.cpp index fa205d903c2e9..4a3e584eda95f 100644 --- a/src/gui/AstroCalcDialog.cpp +++ b/src/gui/AstroCalcDialog.cpp @@ -107,7 +107,8 @@ AstroCalcDialog::AstroCalcDialog(QObject* parent) , plotMonthlyElevationPositive(false) , plotDistanceGraph(false) , plotLunarElongationGraph(false) - , plotAziVsTime(false) + , plotAziVsTime(false) + , computeRTS(false) , altVsTimePositiveLimit(0) , monthlyElevationPositiveLimit(0) , graphsDuration(1) @@ -572,6 +573,7 @@ void AstroCalcDialog::createDialogContent() connect(core, SIGNAL(locationChanged(StelLocation)), this, SLOT(drawDistanceGraph())); connect(core, SIGNAL(locationChanged(StelLocation)), this, SLOT(drawLunarElongationGraph())); connect(core, SIGNAL(locationChanged(StelLocation)), this, SLOT(initEphemerisFlagNakedEyePlanets())); + connect(core, SIGNAL(locationChanged(StelLocation)), this, SLOT(generateRTS())); connect(ui->stackListWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(changePage(QListWidgetItem*, QListWidgetItem*))); connect(ui->tabWidgetGraphs, SIGNAL(currentChanged(int)), this, SLOT(changeGraphsTab(int))); @@ -2119,6 +2121,13 @@ void AstroCalcDialog::initListRTS() void AstroCalcDialog::generateRTS() { + // special case - compute time when tab is visible + if (!dialog->isVisible() || !computeRTS) + { + cleanupRTS(); + return; + } + QList selectedObjects = objectMgr->getSelectedObject(); if (!selectedObjects.isEmpty()) { @@ -2261,6 +2270,8 @@ void AstroCalcDialog::generateRTS() else cleanupRTS(); } + else + cleanupRTS(); } void AstroCalcDialog::cleanupRTS() @@ -7903,6 +7914,7 @@ void AstroCalcDialog::changePage(QListWidgetItem* current, QListWidgetItem* prev plotMonthlyElevation = false; plotLunarElongationGraph = false; plotDistanceGraph = false; + computeRTS = false; ui->stackedWidget->setCurrentIndex(ui->stackListWidget->row(current)); @@ -7921,7 +7933,10 @@ void AstroCalcDialog::changePage(QListWidgetItem* current, QListWidgetItem* prev // special case - RTS if (ui->stackListWidget->row(current) == 2) + { setRTSCelestialBodyName(); + computeRTS = true; + } // special case - graphs if (ui->stackListWidget->row(current) == 4) diff --git a/src/gui/AstroCalcDialog.hpp b/src/gui/AstroCalcDialog.hpp index 188bf5e6f02ff..b56d720b5fe3e 100644 --- a/src/gui/AstroCalcDialog.hpp +++ b/src/gui/AstroCalcDialog.hpp @@ -642,7 +642,7 @@ private slots: bool isSecondObjectRight(double JD, PlanetP object1, StelObjectP object2); // Signal that a plot has to be redone - bool plotAltVsTime, plotAltVsTimeSun, plotAltVsTimeMoon, plotAltVsTimePositive, plotMonthlyElevation, plotMonthlyElevationPositive, plotDistanceGraph, plotLunarElongationGraph, plotAziVsTime; + bool plotAltVsTime, plotAltVsTimeSun, plotAltVsTimeMoon, plotAltVsTimePositive, plotMonthlyElevation, plotMonthlyElevationPositive, plotDistanceGraph, plotLunarElongationGraph, plotAziVsTime, computeRTS; int altVsTimePositiveLimit, monthlyElevationPositiveLimit, graphsDuration, graphsStep; QStringList ephemerisHeader, phenomenaHeader, positionsHeader, hecPositionsHeader, wutHeader, rtsHeader, lunareclipseHeader, lunareclipsecontactsHeader, solareclipseHeader, solareclipsecontactsHeader, solareclipselocalHeader, transitHeader; static double brightLimit;