Stellarium 0.14.3
EquationOfTime.hpp
1 /*
2  * Equation Of Time plug-in for Stellarium
3  *
4  * Copyright (C) 2014 Alexander Wolf
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef _EQUATIONOFTIME_HPP_
21 #define _EQUATIONOFTIME_HPP_
22 
23 #include "StelGui.hpp"
24 #include "StelModule.hpp"
25 
26 #include <QFont>
27 #include <QString>
28 
29 class QPixmap;
30 class StelButton;
32 
55 class EquationOfTime : public StelModule
60 {
61  Q_OBJECT
62  Q_PROPERTY(bool showEOT
63  READ isEnabled
65 
66 public:
68  virtual ~EquationOfTime();
69 
70  virtual void init();
71  virtual void deinit();
72  virtual void update(double) {;}
73  virtual void draw(StelCore *core);
74  virtual double getCallOrder(StelModuleActionName actionName) const;
75  virtual bool configureGui(bool show);
76 
79  void restoreDefaults(void);
80 
83  void readSettingsFromConfig(void);
84 
86  void saveSettingsToConfig(void);
87 
92  double getSolutionEquationOfTime(const double JDE) const;
93 
95  bool isEnabled() const
96  {
97  return flagShowSolutionEquationOfTime;
98  }
99 
101  int getFontSize(void)
102  {
103  return fontSize;
104  }
106  bool getFlagMsFormat(void) const
107  {
108  return flagUseMsFormat;
109  }
111  bool getFlagInvertedValue(void) const
112  {
113  return flagUseInvertedValue;
114  }
115  bool getFlagEnableAtStartup(void) const
116  {
117  return flagEnableAtStartup;
118  }
119  bool getFlagShowEOTButton(void) const
120  {
121  return flagShowEOTButton;
122  }
123 
124 public slots:
126  void enableEquationOfTime(bool b);
128  void setFlagInvertedValue(bool b);
130  void setFlagMsFormat(bool b);
132  void setFlagEnableAtStartup(bool b);
134  void setFontSize(int size);
136  void setFlagShowEOTButton(bool b);
137 
138 private slots:
139  void updateMessageText();
140 
141 private:
142  // if existing, delete EquationOfTime section in main config.ini, then create with default values
143  void restoreDefaultConfigIni(void);
144 
145  EquationOfTimeWindow* mainWindow;
146  QSettings* conf;
147  StelGui* gui;
148 
149  QFont font;
150  bool flagShowSolutionEquationOfTime;
151  bool flagUseInvertedValue;
152  bool flagUseMsFormat;
153  bool flagEnableAtStartup;
154  bool flagShowEOTButton;
155  QString messageEquation;
156  QString messageEquationMinutes;
157  QString messageEquationSeconds;
158  Vec3f textColor;
159  int fontSize;
160  StelButton* toolbarButton;
161 };
162 
163 
164 #include <QObject>
165 #include "StelPluginInterface.hpp"
166 
169 {
170  Q_OBJECT
171  Q_PLUGIN_METADATA(IID StelPluginInterface_iid)
172  Q_INTERFACES(StelPluginInterface)
173 public:
174  virtual StelModule* getStelModule() const;
175  virtual StelPluginInfo getPluginInfo() const;
176 };
177 
178 #endif /* _EQUATIONOFTIME_HPP_ */
void readSettingsFromConfig(void)
Read (or re-read) settings from the main config file.
void saveSettingsToConfig(void)
Save the settings to the main configuration file.
int getFontSize(void)
Get font size for messages.
void restoreDefaults(void)
Set up the plugin with default values.
void setFlagShowEOTButton(bool b)
Display plugin button on toolbar.
double getSolutionEquationOfTime(const double JDE) const
Get solution of equation of time Source: J.
void setFlagMsFormat(bool b)
Enable usage minutes and seconds for value.
bool getFlagMsFormat(void) const
Get status of usage minutes and seconds for value of equation.
bool isEnabled() const
Is plugin enabled?
void setFlagEnableAtStartup(bool b)
Enable plugin usage at startup.
Main window of the Equation of Time plug-in.
virtual StelPluginInfo getPluginInfo() const =0
virtual class StelModule * getStelModule() const =0
Main class of the Equation of Time plugin.
This class is used by Qt to manage a plug-in interface.
void setFlagInvertedValue(bool b)
Enable usage inverted value for equation of time (switch sign of equation)
void setFontSize(int size)
Set font size for message.
bool getFlagInvertedValue(void) const
Get status of usage inverted values for equation of time.
void enableEquationOfTime(bool b)
Enable plugin usage.