Skip to content

Commit

Permalink
Fix updating Rise/Transit/Set info after switching location if the ob…
Browse files Browse the repository at this point in the history
…ject was selected (fix #3602)
  • Loading branch information
alex-w committed Jan 21, 2024
1 parent 092cd77 commit cbb18be
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
17 changes: 16 additions & 1 deletion src/gui/AstroCalcDialog.cpp
Expand Up @@ -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)
Expand Down Expand Up @@ -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)));
Expand Down Expand Up @@ -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<StelObjectP> selectedObjects = objectMgr->getSelectedObject();
if (!selectedObjects.isEmpty())
{
Expand Down Expand Up @@ -2261,6 +2270,8 @@ void AstroCalcDialog::generateRTS()
else
cleanupRTS();
}
else
cleanupRTS();
}

void AstroCalcDialog::cleanupRTS()
Expand Down Expand Up @@ -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));

Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/gui/AstroCalcDialog.hpp
Expand Up @@ -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;
Expand Down

0 comments on commit cbb18be

Please sign in to comment.