diff options
author | Andy Kirkham <1134086+A-j-K@users.noreply.github.com> | 2021-11-20 06:24:01 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-20 13:24:01 +0700 |
commit | ed746a29c154f41dea511aa7e44a835586dc4003 (patch) | |
tree | 88cdd2a94ef72033072d5c34edc80830be3d6aa5 | |
parent | c6aef877987617ae08a0d14c3465d96ed386e5f9 (diff) |
Addressing feature request #2044 (#2051)refactoring/qregexp
* Addressing feature request #2044
* Fix checkbox name
* Build fail on CodeFactor complexity. Simplify draw() function by using private method helper
* Remove unneeded checkbox QT slot
-rw-r--r-- | src/core/modules/SolarSystem.cpp | 38 | ||||
-rw-r--r-- | src/core/modules/SolarSystem.hpp | 11 | ||||
-rw-r--r-- | src/gui/AstroCalcExtraEphemerisDialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/astroCalcExtraEphemerisDialog.ui | 7 |
4 files changed, 50 insertions, 8 deletions
diff --git a/src/core/modules/SolarSystem.cpp b/src/core/modules/SolarSystem.cpp index 73867d919d..0d979b5001 100644 --- a/src/core/modules/SolarSystem.cpp +++ b/src/core/modules/SolarSystem.cpp @@ -94,7 +94,7 @@ SolarSystem::SolarSystem() : StelObjectModule() , ephemerisDatesDisplayed(false) , ephemerisMagnitudesDisplayed(false) , ephemerisHorizontalCoordinates(false) - , ephemerisLineDisplayed(false) + , ephemerisLineDisplayed(false) , ephemerisLineThickness(1) , ephemerisSkipDataDisplayed(false) , ephemerisSkipMarkersDisplayed(false) @@ -102,6 +102,7 @@ SolarSystem::SolarSystem() : StelObjectModule() , ephemerisDataLimit(1) , ephemerisSmartDatesDisplayed(true) , ephemerisScaleMarkersDisplayed(false) + , ephemerisAlwaysOn(false) , ephemerisGenericMarkerColor(Vec3f(1.0f, 1.0f, 0.0f)) , ephemerisSecondaryMarkerColor(Vec3f(0.7f, 0.7f, 1.0f)) , ephemerisSelectedMarkerColor(Vec3f(1.0f, 0.7f, 0.0f)) @@ -253,6 +254,7 @@ void SolarSystem::init() // Ephemeris stuff setFlagEphemerisMarkers(conf->value("astrocalc/flag_ephemeris_markers", true).toBool()); + setFlagEphemerisAlwaysOn(conf->value("astrocalc/flag_ephemeris_alwayson", true).toBool()); setFlagEphemerisDates(conf->value("astrocalc/flag_ephemeris_dates", false).toBool()); setFlagEphemerisMagnitudes(conf->value("astrocalc/flag_ephemeris_magnitudes", false).toBool()); setFlagEphemerisHorizontalCoordinates(conf->value("astrocalc/flag_ephemeris_horizontal", false).toBool()); @@ -1284,6 +1286,9 @@ struct biggerDistance : public std::binary_function<PlanetP, PlanetP, bool> // We are supposed to be in heliocentric coordinate void SolarSystem::draw(StelCore* core) { + // AstroCalcDialog + drawEphemerisItems(core); + if (!flagShow) return; @@ -1323,13 +1328,17 @@ void SolarSystem::draw(StelCore* core) if (GETSTELMODULE(StelObjectMgr)->getFlagSelectedObjectPointer() && getFlagPointer()) drawPointer(core); +} - // AstroCalcDialog - if (getFlagEphemerisMarkers()) - drawEphemerisMarkers(core); - - if (getFlagEphemerisLine()) - drawEphemerisLine(core); +void SolarSystem::drawEphemerisItems(const StelCore* core) +{ + if (flagShow || (!flagShow && getFlagEphemerisAlwaysOn())) + { + if (getFlagEphemerisMarkers()) + drawEphemerisMarkers(core); + if (getFlagEphemerisLine()) + drawEphemerisLine(core); + } } Vec3f SolarSystem::getEphemerisMarkerColor(int index) const @@ -2091,6 +2100,21 @@ bool SolarSystem::getFlagEphemerisLine() const return ephemerisLineDisplayed; } +bool SolarSystem::getFlagEphemerisAlwaysOn() const +{ + return ephemerisAlwaysOn; +} + +void SolarSystem::setFlagEphemerisAlwaysOn(bool b) +{ + if (b != ephemerisAlwaysOn) + { + ephemerisAlwaysOn = b; + conf->setValue("astrocalc/flag_ephemeris_alwayson", b); // Immediate saving of state + emit ephemerisAlwaysOnChanged(b); + } +} + void SolarSystem::setFlagEphemerisHorizontalCoordinates(bool b) { if (b!=ephemerisHorizontalCoordinates) diff --git a/src/core/modules/SolarSystem.hpp b/src/core/modules/SolarSystem.hpp index d58bb7bcc1..9901ce724e 100644 --- a/src/core/modules/SolarSystem.hpp +++ b/src/core/modules/SolarSystem.hpp @@ -98,6 +98,7 @@ class SolarSystem : public StelObjectModule Q_PROPERTY(int ephemerisDataLimit READ getEphemerisDataLimit WRITE setEphemerisDataLimit NOTIFY ephemerisDataLimitChanged) Q_PROPERTY(bool ephemerisSmartDates READ getFlagEphemerisSmartDates WRITE setFlagEphemerisSmartDates NOTIFY ephemerisSmartDatesChanged) Q_PROPERTY(bool ephemerisScaleMarkersDisplayed READ getFlagEphemerisScaleMarkers WRITE setFlagEphemerisScaleMarkers NOTIFY ephemerisScaleMarkersChanged) + Q_PROPERTY(bool ephemerisAlwaysOn READ getFlagEphemerisAlwaysOn WRITE setFlagEphemerisAlwaysOn NOTIFY ephemerisAlwaysOnChanged) // Great Red Spot (GRS) properties Q_PROPERTY(bool flagCustomGrsSettings READ getFlagCustomGrsSettings WRITE setFlagCustomGrsSettings NOTIFY flagCustomGrsSettingsChanged) Q_PROPERTY(int customGrsLongitude READ getCustomGrsLongitude WRITE setCustomGrsLongitude NOTIFY customGrsLongitudeChanged) @@ -767,6 +768,7 @@ signals: void ephemerisDatesChanged(bool b); void ephemerisMagnitudesChanged(bool b); void ephemerisLineChanged(bool b); + void ephemerisAlwaysOnChanged(bool b); void ephemerisLineThicknessChanged(int v); void ephemerisSkipDataChanged(bool b); void ephemerisSkipMarkersChanged(bool b); @@ -903,6 +905,11 @@ private slots: //! Get the current value of the flag which enabled the showing of ephemeris line between markers or not bool getFlagEphemerisLine() const; + //! Set flag which enables ephemeris lines and marks always on + void setFlagEphemerisAlwaysOn(bool b); + //! Get the current value of the flag which makes ephemeris lines and marks always on + bool getFlagEphemerisAlwaysOn() const; + //! Set the thickness of ephemeris line void setEphemerisLineThickness(int v); //! Get the thickness of ephemeris line @@ -998,6 +1005,9 @@ private: //! Draw a nice animated pointer around the object. void drawPointer(const StelCore* core); + //! Draw ephemeris lines and markers + void drawEphemerisItems(const StelCore* core); + //! Draw a nice markers for ephemeris of objects. void drawEphemerisMarkers(const StelCore* core); @@ -1088,6 +1098,7 @@ private: bool ephemerisMagnitudesDisplayed; bool ephemerisHorizontalCoordinates; bool ephemerisLineDisplayed; + bool ephemerisAlwaysOn; int ephemerisLineThickness; bool ephemerisSkipDataDisplayed; bool ephemerisSkipMarkersDisplayed; diff --git a/src/gui/AstroCalcExtraEphemerisDialog.cpp b/src/gui/AstroCalcExtraEphemerisDialog.cpp index 21ba4e8c56..27874dd983 100644 --- a/src/gui/AstroCalcExtraEphemerisDialog.cpp +++ b/src/gui/AstroCalcExtraEphemerisDialog.cpp @@ -50,7 +50,6 @@ void AstroCalcExtraEphemerisDialog::createDialogContent() connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate())); connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())); connect(ui->TitleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMovedTo(QPoint))); - connect(ui->skipDataCheckBox, SIGNAL(clicked()), this, SLOT(setOptionStatus())); connectBoolProperty(ui->skipDataCheckBox, "SolarSystem.ephemerisSkippedData"); @@ -58,6 +57,7 @@ void AstroCalcExtraEphemerisDialog::createDialogContent() connectIntProperty(ui->dataStepSpinBox, "SolarSystem.ephemerisDataStep"); connectBoolProperty(ui->smartDatesCheckBox, "SolarSystem.ephemerisSmartDates"); connectBoolProperty(ui->scaleMarkersCheckBox, "SolarSystem.ephemerisScaleMarkersDisplayed"); + connectBoolProperty(ui->alwaysOnCheckBox, "SolarSystem.ephemerisAlwaysOn"); connectIntProperty(ui->lineThicknessSpinBox, "SolarSystem.ephemerisLineThickness"); setOptionStatus(); diff --git a/src/gui/astroCalcExtraEphemerisDialog.ui b/src/gui/astroCalcExtraEphemerisDialog.ui index 297d874894..1c29557811 100644 --- a/src/gui/astroCalcExtraEphemerisDialog.ui +++ b/src/gui/astroCalcExtraEphemerisDialog.ui @@ -227,6 +227,13 @@ </widget> </item> <item> + <widget class="QCheckBox" name="alwaysOnCheckBox"> + <property name="text"> + <string>Lines and markers always on</string> + </property> + </widget> + </item> + <item> <layout class="QHBoxLayout" name="horizontalLayout_2"> <item> <widget class="QLabel" name="label"> |