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

Поисковые слова: storm
Stellarium: /home/aw/devel/stellarium/trunk/plugins/Supernovae/src/Supernovae.hpp Source File
Stellarium 0.12.3
Supernovae.hpp
1 /*
2  * Copyright (C) 2011 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 _SUPERNOVAE_HPP_
20 #define _SUPERNOVAE_HPP_
21 
22 #include "StelObjectModule.hpp"
23 #include "StelObject.hpp"
24 #include "StelFader.hpp"
25 #include "Supernova.hpp"
26 #include <QFont>
27 #include <QVariantMap>
28 #include <QDateTime>
29 #include <QList>
30 #include <QSharedPointer>
31 #include <QHash>
32 
33 class QNetworkAccessManager;
34 class QNetworkReply;
35 class QProgressBar;
36 class QSettings;
37 class QTimer;
38 class SupernovaeDialog;
39 
40 typedef QSharedPointer<Supernova> SupernovaP;
41 
58 
59 
60 
62 {
63  Q_OBJECT
64 public:
67  enum UpdateState {
73  };
74 
75  Supernovae();
76  virtual ~Supernovae();
77 
79  // Methods defined in the StelModule class
80  virtual void init();
81  virtual void deinit();
82  virtual void update(double) {;}
83  virtual void draw(StelCore* core, class StelRenderer* renderer);
84  virtual void drawPointer(StelCore* core, class StelRenderer* renderer, StelProjectorP projector);
85  virtual double getCallOrder(StelModuleActionName actionName) const;
86 
88  // Methods defined in StelObjectManager class
94  virtual QList<StelObjectP> searchAround(const Vec3d& v, double limitFov, const StelCore* core) const;
95 
98  virtual StelObjectP searchByNameI18n(const QString& nameI18n) const;
99 
102  virtual StelObjectP searchByName(const QString& name) const;
103 
108  virtual QStringList listMatchingObjectsI18n(const QString& objPrefix, int maxNbItem=5) const;
113  virtual QStringList listMatchingObjects(const QString& objPrefix, int maxNbItem=5) const;
114  virtual QStringList listAllObjects(bool inEnglish) const;
115  virtual QString getName() const { return "Historical Supernovae"; }
116 
118  SupernovaP getByID(const QString& id);
119 
122  virtual bool configureGui(bool show=true);
123 
127  void restoreDefaults(void);
128 
131  void readSettingsFromConfig(void);
132 
134  void saveSettingsToConfig(void);
135 
138  bool getUpdatesEnabled(void) {return updatesEnabled;}
141  void setUpdatesEnabled(bool b) {updatesEnabled=b;}
142 
144  QDateTime getLastUpdate(void) {return lastUpdate;}
145 
147  int getUpdateFrequencyDays(void) {return updateFrequencyDays;}
148  void setUpdateFrequencyDays(int days) {updateFrequencyDays = days;}
149 
151  int getSecondsToUpdate(void);
152 
154  UpdateState getUpdateState(void) {return updateState;}
155 
157  QString getSupernovaeList();
158 
159 signals:
162 
164  void jsonUpdateComplete(void);
165 
166 public slots:
167  // FIXME: Add functions for scripting support
168 
171  void updateJSON(void);
172 
174  void displayMessage(const QString& message, const QString hexColor="#999999");
175  void messageTimeout(void);
176 
177 private:
178  // Font used for displaying our text
179  QFont font;
180 
181  // if existing, delete Satellites section in main config.ini, then create with default values
182  void restoreDefaultConfigIni(void);
183 
185  void restoreDefaultJsonFile(void);
186 
188  void readJsonFile(void);
189 
193  bool backupJsonFile(bool deleteOriginal=false);
194 
197  int getJsonFileVersion(void);
198 
200  QVariantMap loadSNeMap(QString path=QString());
201 
203  void setSNeMap(const QVariantMap& map);
204 
205  QString sneJsonPath;
206 
207  class StelTextureNew* texPointer;
208  QList<SupernovaP> snstar;
209  QHash<QString, double> snlist;
210 
211  // variables and functions for the updater
212  UpdateState updateState;
213  QNetworkAccessManager* downloadMgr;
214  QString updateUrl;
215  QProgressBar* progressBar;
216  QTimer* updateTimer;
217  QTimer* messageTimer;
218  QList<int> messageIDs;
219  bool updatesEnabled;
220  QDateTime lastUpdate;
221  int updateFrequencyDays;
222 
223  QSettings* conf;
224 
225  // GUI
226  SupernovaeDialog* configDialog;
227 
228 private slots:
232  void checkForUpdate(void);
233  void updateDownloadComplete(QNetworkReply* reply);
234 
235 };
236 
237 
238 #include "fixx11h.h"
239 #include <QObject>
240 #include "StelPluginInterface.hpp"
241 
244 {
245  Q_OBJECT
246  Q_INTERFACES(StelPluginInterface)
247 public:
248  virtual StelModule* getStelModule() const;
249  virtual StelPluginInfo getPluginInfo() const;
250 };
251 
252 #endif /*_SUPERNOVAE_HPP_*/