Skip to content

Commit

Permalink
Let's use DMS and decimal degrees as acceptable values for "Maximum
Browse files Browse the repository at this point in the history
allowed separation" input box (AstroCalc/Phenomena)
  • Loading branch information
alex-w committed Jul 14, 2018
1 parent 5ade1b8 commit a6d1e35
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
18 changes: 13 additions & 5 deletions src/gui/AstroCalcDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "StelTranslator.hpp"
#include "StelLocaleMgr.hpp"
#include "StelFileMgr.hpp"
#include "AngleSpinBox.hpp"

#include "SolarSystem.hpp"
#include "Planet.hpp"
Expand Down Expand Up @@ -226,10 +227,17 @@ void AstroCalcDialog::createDialogContent()
connect(ui->ephemerisStepComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(saveEphemerisTimeStep(int)));
connect(ui->celestialBodyComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(saveEphemerisCelestialBody(int)));

// Let's use DMS and decimal degrees as acceptable values for "Maximum allowed separation" input box
ui->allowedSeparationSpinBox->setDisplayFormat(AngleSpinBox::DMSSymbols);
ui->allowedSeparationSpinBox->setPrefixType(AngleSpinBox::NormalPlus);
ui->allowedSeparationSpinBox->setMinimum(0.0, true);
ui->allowedSeparationSpinBox->setMaximum(10.0, true);
ui->allowedSeparationSpinBox->setWrapping(false);

ui->phenomenaOppositionCheckBox->setChecked(conf->value("astrocalc/flag_phenomena_opposition", false).toBool());
connect(ui->phenomenaOppositionCheckBox, SIGNAL(toggled(bool)), this, SLOT(savePhenomenaOppositionFlag(bool)));
ui->allowedSeparationDoubleSpinBox->setValue(conf->value("astrocalc/phenomena_angular_separation", 1.0).toDouble());
connect(ui->allowedSeparationDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(savePhenomenaAngularSeparation(double)));
ui->allowedSeparationSpinBox->setDegrees(conf->value("astrocalc/phenomena_angular_separation", 1.0).toDouble());
connect(ui->allowedSeparationSpinBox, SIGNAL(valueChanged()), this, SLOT(savePhenomenaAngularSeparation()));

connect(ui->phenomenaPushButton, SIGNAL(clicked()), this, SLOT(calculatePhenomena()));
connect(ui->phenomenaCleanupButton, SIGNAL(clicked()), this, SLOT(cleanupPhenomena()));
Expand Down Expand Up @@ -1914,9 +1922,9 @@ void AstroCalcDialog::savePhenomenaOppositionFlag(bool b)
conf->setValue("astrocalc/flag_phenomena_opposition", b);
}

void AstroCalcDialog::savePhenomenaAngularSeparation(double v)
void AstroCalcDialog::savePhenomenaAngularSeparation()
{
conf->setValue("astrocalc/phenomena_angular_separation", QString::number(v, 'f', 5));
conf->setValue("astrocalc/phenomena_angular_separation", QString::number(ui->allowedSeparationSpinBox->valueDegrees(), 'f', 5));
}

void AstroCalcDialog::drawAltVsTimeDiagram()
Expand Down Expand Up @@ -2853,7 +2861,7 @@ void AstroCalcDialog::selectCurrentPhenomen(const QModelIndex& modelIndex)
void AstroCalcDialog::calculatePhenomena()
{
QString currentPlanet = ui->object1ComboBox->currentData().toString();
double separation = ui->allowedSeparationDoubleSpinBox->value();
double separation = ui->allowedSeparationSpinBox->valueDegrees();
bool opposition = ui->phenomenaOppositionCheckBox->isChecked();

initListPhenomena();
Expand Down
2 changes: 1 addition & 1 deletion src/gui/AstroCalcDialog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ private slots:
void cleanupPhenomena();
void selectCurrentPhenomen(const QModelIndex &modelIndex);
void savePhenomena();
void savePhenomenaAngularSeparation(double v);
void savePhenomenaAngularSeparation();

void savePhenomenaCelestialBody(int index);
void savePhenomenaCelestialGroup(int index);
Expand Down
20 changes: 6 additions & 14 deletions src/gui/astroCalcDialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -645,20 +645,7 @@
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="allowedSeparationDoubleSpinBox">
<property name="toolTip">
<string>Value in decimal degrees</string>
</property>
<property name="decimals">
<number>5</number>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
<widget class="AngleSpinBox" name="allowedSeparationSpinBox"/>
</item>
</layout>
</item>
Expand Down Expand Up @@ -1383,6 +1370,11 @@
<extends>QWidget</extends>
<header>external/qcustomplot/qcustomplot.h</header>
</customwidget>
<customwidget>
<class>AngleSpinBox</class>
<extends>QSpinBox</extends>
<header>AngleSpinBox.hpp</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
Expand Down

0 comments on commit a6d1e35

Please sign in to comment.