Skip to content

Commit

Permalink
Add another option to allow storing config items immediately
Browse files Browse the repository at this point in the history
- the intention is to start using this for storing detail settings
without having to do the global store.
  • Loading branch information
gzotti committed Aug 2, 2023
1 parent efa6b05 commit af03fc0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/core/StelApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ void StelApp::init(QSettings* conf)

setScreenFontSize(confSettings->value("gui/screen_font_size", 13).toInt());
setGuiFontSize(confSettings->value("gui/gui_font_size", 13).toInt());
setFlagImmediateSave(confSettings->value("gui/immediate_save_details", false).toBool());

core = new StelCore();
if (!fuzzyEquals(saveProjW, -1.) && !fuzzyEquals(saveProjH, -1.))
Expand Down Expand Up @@ -1256,6 +1257,15 @@ Vec3f StelApp::getDaylightInfoColor() const
return daylightInfoColor;
}

void StelApp::setFlagImmediateSave(bool b)
{
if (flagImmediateSave!=b)
{
flagImmediateSave = b;
emit flagImmediateSaveChanged(b);
}
}

// Update translations and font for sky everywhere in the program
void StelApp::updateI18n()
{
Expand Down
8 changes: 8 additions & 0 deletions src/core/StelApp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class StelApp : public QObject
Q_PROPERTY(Vec3f daylightInfoColor READ getDaylightInfoColor WRITE setDaylightInfoColor NOTIFY daylightInfoColorChanged)
Q_PROPERTY(int screenFontSize READ getScreenFontSize WRITE setScreenFontSize NOTIFY screenFontSizeChanged)
Q_PROPERTY(int guiFontSize READ getGuiFontSize WRITE setGuiFontSize NOTIFY guiFontSizeChanged)
Q_PROPERTY(bool flagImmediateSave READ getFlagImmediateSave WRITE setFlagImmediateSave NOTIFY flagImmediateSaveChanged)

Q_PROPERTY(QString version READ getVersion CONSTANT)

Expand Down Expand Up @@ -302,6 +303,11 @@ public slots:
//! Get info text color
Vec3f getDaylightInfoColor() const;

//! Set flag for storing some settings immediately
void setFlagImmediateSave(bool b);
//! Get flag about storing some settings immediately
bool getFlagImmediateSave() const {return flagImmediateSave;}

//! Get the current number of frame per second.
//! @return the FPS averaged on the last second
float getFps() const {return fps;}
Expand Down Expand Up @@ -348,6 +354,7 @@ public slots:
void fontChanged(QFont);
void overwriteInfoColorChanged(const Vec3f & color);
void daylightInfoColorChanged(const Vec3f & color);
void flagImmediateSaveChanged(bool);

//! Called just after a progress bar is added.
void progressBarAdded(const StelProgressController*);
Expand Down Expand Up @@ -515,6 +522,7 @@ public slots:
bool flagOverwriteInfoColor; // Overwrite and use color for text in info panel
Vec3f overwriteInfoColor;
Vec3f daylightInfoColor;
bool flagImmediateSave; // set true to allow more immediate-mode settings. For now this is limited to detail settings, e.g. orbit or nomenclature details, DSO filter types, ...
#ifdef ENABLE_SPOUT
SpoutSender* spoutSender;
#endif
Expand Down

0 comments on commit af03fc0

Please sign in to comment.