Документ взят из кэша поисковой машины. Адрес оригинального документа : http://astro.uni-altai.ru/~aw/stellarium/api/Exoplanets_8hpp_source.html
Дата изменения: Unknown
Дата индексирования: Fri Feb 28 07:40:19 2014
Кодировка:

Поисковые слова: п п п п
Stellarium: /home/aw/devel/stellarium/trunk/plugins/Exoplanets/src/Exoplanets.hpp Source File
Stellarium 0.12.3
Exoplanets.hpp
1 /*
2  * Copyright (C) 2012 Alexander Wolf
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
17  */
18 
19 #ifndef _EXOPLANETS_HPP_
20 #define _EXOPLANETS_HPP_
21 
22 #include "StelObjectModule.hpp"
23 #include "StelObject.hpp"
24 #include "StelFader.hpp"
25 #include "Exoplanet.hpp"
26 #include <QFont>
27 #include <QVariantMap>
28 #include <QDateTime>
29 #include <QList>
30 #include <QSharedPointer>
31 
32 class QNetworkAccessManager;
33 class QNetworkReply;
34 class QProgressBar;
35 class QSettings;
36 class QTimer;
37 class ExoplanetsDialog;
38 class QPixmap;
39 class StelButton;
40 
41 typedef QSharedPointer<Exoplanet> ExoplanetP;
42 
45 {
46  Q_OBJECT
47 public:
50  enum UpdateState {
56  };
57 
58  Exoplanets();
59  virtual ~Exoplanets();
60 
62  // Methods defined in the StelModule class
63  virtual void init();
64  virtual void deinit();
65  virtual void update(double deltaTime);
66  virtual void draw(StelCore* core, class StelRenderer* renderer);
67  virtual void drawPointer(StelCore* core, class StelRenderer* renderer,
68  StelProjectorP projector);
69  virtual double getCallOrder(StelModuleActionName actionName) const;
70 
72  // Methods defined in StelObjectManager class
78  virtual QList<StelObjectP> searchAround(const Vec3d& v, double limitFov, const StelCore* core) const;
79 
82  virtual StelObjectP searchByNameI18n(const QString& nameI18n) const;
83 
86  virtual StelObjectP searchByName(const QString& name) const;
87 
92  virtual QStringList listMatchingObjectsI18n(const QString& objPrefix, int maxNbItem=5) const;
93 
98  virtual QStringList listMatchingObjects(const QString& objPrefix, int maxNbItem=5) const;
99 
100  virtual QStringList listAllObjects(bool inEnglish) const;
101 
102  virtual QString getName() const { return "Exoplanets"; }
103 
105  ExoplanetP getByID(const QString& id);
106 
109  virtual bool configureGui(bool show=true);
110 
114  void restoreDefaults(void);
115 
118  void readSettingsFromConfig(void);
119 
121  void saveSettingsToConfig(void);
122 
125  bool getUpdatesEnabled(void) {return updatesEnabled;}
128  void setUpdatesEnabled(bool b) {updatesEnabled=b;}
129 
130  bool getDisplayMode(void) {return distributionEnabled;}
131  void setDisplayMode(bool b) {distributionEnabled=b;}
132 
133  bool getTimelineMode(void) {return timelineEnabled;}
134  void setTimelineMode(bool b) {timelineEnabled=b;}
135 
136  void setEnableAtStartup(bool b) { enableAtStartup=b; }
137  bool getEnableAtStartup(void) { return enableAtStartup; }
138 
140  QDateTime getLastUpdate(void) {return lastUpdate;}
141 
143  int getUpdateFrequencyHours(void) {return updateFrequencyHours;}
144  void setUpdateFrequencyHours(int hours) {updateFrequencyHours = hours;}
145 
147  int getSecondsToUpdate(void);
148 
150  UpdateState getUpdateState(void) {return updateState;}
151 
152 signals:
155 
157  void jsonUpdateComplete(void);
158 
159 public slots:
162  void updateJSON(void);
163 
164  void setFlagShowExoplanets(bool b) { flagShowExoplanets=b; }
165  bool getFlagShowExoplanets(void) { return flagShowExoplanets; }
166 
168  void setFlagShowExoplanetsButton(bool b);
169  bool getFlagShowExoplanetsButton(void) { return flagShowExoplanetsButton; }
170 
172  void displayMessage(const QString& message, const QString hexColor="#999999");
173  void messageTimeout(void);
174 
175 private:
176  // Font used for displaying our text
177  QFont font;
178 
179  // if existing, delete Satellites section in main config.ini, then create with default values
180  void restoreDefaultConfigIni(void);
181 
182  // Upgrade config.ini: rename old key settings to new
183  void upgradeConfigIni(void);
184 
186  void restoreDefaultJsonFile(void);
187 
189  void readJsonFile(void);
190 
194  bool backupJsonFile(bool deleteOriginal=false);
195 
198  int getJsonFileFormatVersion(void);
199 
201  QVariantMap loadEPMap(QString path=QString());
202 
204  void setEPMap(const QVariantMap& map);
205 
206  QString jsonCatalogPath;
207 
208  StelTextureNew* texPointer;
209  StelTextureNew* markerTexture;
210  QList<ExoplanetP> ep;
211 
212  // variables and functions for the updater
213  UpdateState updateState;
214  QNetworkAccessManager* downloadMgr;
215  QString updateUrl;
216  QTimer* updateTimer;
217  QTimer* messageTimer;
218  QList<int> messageIDs;
219  bool updatesEnabled;
220  QDateTime lastUpdate;
221  int updateFrequencyHours;
222  bool distributionEnabled;
223  bool timelineEnabled;
224  bool enableAtStartup;
225 
226  QSettings* conf;
227 
228  // GUI
229  ExoplanetsDialog* exoplanetsConfigDialog;
230  bool flagShowExoplanets;
231  bool flagShowExoplanetsButton;
232  QPixmap* OnIcon;
233  QPixmap* OffIcon;
234  QPixmap* GlowIcon;
235  StelButton* toolbarButton;
236  QProgressBar* progressBar;
237 
238 private slots:
242  void checkForUpdate(void);
243  void updateDownloadComplete(QNetworkReply* reply);
244 
245 };
246 
247 
248 #include "fixx11h.h"
249 #include <QObject>
250 #include "StelPluginInterface.hpp"
251 
254 {
255  Q_OBJECT
256  Q_INTERFACES(StelPluginInterface)
257 public:
258  virtual StelModule* getStelModule() const;
259  virtual StelPluginInfo getPluginInfo() const;
260 };
261 
262 #endif /*_EXOPLANETS_HPP_*/