![]() |
Stellarium 0.11.3 | ||
| Home · All Namespaces · All Classes · Functions · Coding Style · Scripting · Plugins · File Structure |
00001 /* 00002 * Stellarium 00003 * Copyright (C) 2006 Fabien Chereau 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License 00007 * as published by the Free Software Foundation; either version 2 00008 * of the License, or (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. 00018 */ 00019 00020 #ifndef _STELAPP_HPP_ 00021 #define _STELAPP_HPP_ 00022 00023 #include <QString> 00024 #include <QVariant> 00025 #include <QObject> 00026 00027 // Predeclaration of some classes 00028 class StelCore; 00029 class StelTextureMgr; 00030 class StelObjectMgr; 00031 class StelLocaleMgr; 00032 class StelModuleMgr; 00033 class StelSkyCultureMgr; 00034 class QSettings; 00035 class QNetworkAccessManager; 00036 class QNetworkReply; 00037 class QTime; 00038 class StelLocationMgr; 00039 class StelSkyLayerMgr; 00040 class StelAudioMgr; 00041 class StelGuiBase; 00042 00054 class StelApp : public QObject 00055 { 00056 Q_OBJECT 00057 00058 public: 00059 friend class StelAppGraphicsWidget; 00060 00066 StelApp(QObject* parent=NULL); 00067 00069 virtual ~StelApp(); 00070 00072 void init(QSettings* conf); 00073 00075 void initPlugIns(); 00076 00079 static StelApp& getInstance() {Q_ASSERT(singleton); return *singleton;} 00080 00083 StelModuleMgr& getModuleMgr() {return *moduleMgr;} 00084 00087 StelLocaleMgr& getLocaleMgr() {return *localeMgr;} 00088 00091 StelSkyCultureMgr& getSkyCultureMgr() {return *skyCultureMgr;} 00092 00095 StelTextureMgr& getTextureManager() {return *textureMgr;} 00096 00099 StelLocationMgr& getLocationMgr() {return *planetLocationMgr;} 00100 00103 StelObjectMgr& getStelObjectMgr() {return *stelObjectMgr;} 00104 00107 StelSkyLayerMgr& getSkyImageMgr() {return *skyImageMgr;} 00108 00110 StelAudioMgr* getStelAudioMgr() {return audioMgr;} 00111 00115 StelCore* getCore() {return core;} 00116 00118 QNetworkAccessManager* getNetworkAccessManager() {return networkAccessManager;} 00119 00121 void updateI18n(); 00122 00124 void updateSkyCulture(); 00125 00127 QSettings* getSettings() {return confSettings;} 00128 00130 QString getCurrentStelStyle() {return flagNightVision ? "night_color" : "color";} 00131 00133 void update(double deltaTime); 00134 00137 void draw(); 00138 00143 bool drawPartial(); 00144 00146 void glWindowHasBeenResized(float x, float y, float w, float h); 00147 00149 StelGuiBase* getGui() const {return stelGui;} 00152 void setGui(StelGuiBase* b) {stelGui=b;} 00153 00154 static void initStatic(); 00155 static void deinitStatic(); 00156 00158 bool getUseGLShaders() const {return useGLShaders;} 00159 00161 // Scriptable methods 00162 public slots: 00163 00165 void setVisionModeNight(bool); 00167 bool getVisionModeNight() const {return flagNightVision;} 00168 00171 float getFps() const {return fps;} 00172 00174 static double getTotalRunTime(); 00175 00178 void reportFileDownloadFinished(QNetworkReply* reply); 00179 00180 signals: 00181 void colorSchemeChanged(const QString&); 00182 void languageChanged(); 00183 void skyCultureChanged(const QString&); 00184 00185 private: 00186 00188 void handleClick(class QMouseEvent* event); 00190 void handleWheel(class QWheelEvent* event); 00192 void handleMove(int x, int y, Qt::MouseButtons b); 00194 void handleKeys(class QKeyEvent* event); 00195 00196 // The StelApp singleton 00197 static StelApp* singleton; 00198 00199 // The associated StelCore instance 00200 StelCore* core; 00201 00202 // Module manager for the application 00203 StelModuleMgr* moduleMgr; 00204 00205 // Locale manager for the application 00206 StelLocaleMgr* localeMgr; 00207 00208 // Sky cultures manager for the application 00209 StelSkyCultureMgr* skyCultureMgr; 00210 00211 // Textures manager for the application 00212 StelTextureMgr* textureMgr; 00213 00214 // Manager for all the StelObjects of the program 00215 StelObjectMgr* stelObjectMgr; 00216 00217 // Manager for the list of observer locations on planets 00218 StelLocationMgr* planetLocationMgr; 00219 00220 // Main network manager used for the program 00221 QNetworkAccessManager* networkAccessManager; 00222 00224 void setupHttpProxy(); 00225 00226 // The audio manager. Must execute in the main thread. 00227 StelAudioMgr* audioMgr; 00228 00229 StelSkyLayerMgr* skyImageMgr; 00230 00231 StelGuiBase* stelGui; 00232 00233 float fps; 00234 int frame; 00235 double timefr, timeBase; // Used for fps counter 00236 00238 bool flagNightVision; 00239 00241 bool useGLShaders; 00242 00243 QSettings* confSettings; 00244 00245 // Define whether the StelApp instance has completed initialization 00246 bool initialized; 00247 00248 static QTime* qtime; 00249 00250 // Temporary variables used to store the last gl window resize 00251 // if the core was not yet initialized 00252 int saveProjW; 00253 int saveProjH; 00254 00256 int nbDownloadedFiles; 00258 qint64 totalDownloadedSize; 00259 00261 int nbUsedCache; 00263 qint64 totalUsedCacheSize; 00264 00266 int drawState; 00267 }; 00268 00269 #endif // _STELAPP_HPP_
1.6.3