![]() |
Stellarium 0.12.0 | ||
| Home · All Namespaces · All Classes · Functions · Coding Style · Scripting · Plugins · Renderer · 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 StelObjectMgr; 00030 class StelLocaleMgr; 00031 class StelModuleMgr; 00032 class StelSkyCultureMgr; 00033 class StelShortcutMgr; 00034 class QSettings; 00035 class QNetworkAccessManager; 00036 class QNetworkReply; 00037 class QTime; 00038 class QTimer; 00039 class StelLocationMgr; 00040 class StelSkyLayerMgr; 00041 class StelAudioMgr; 00042 class StelVideoMgr; 00043 class StelGuiBase; 00044 00056 class StelApp : public QObject 00057 { 00058 Q_OBJECT 00059 00060 public: 00061 friend class StelAppGraphicsWidget; 00062 00068 StelApp(QObject* parent=NULL); 00069 00071 virtual ~StelApp(); 00072 00074 void init(QSettings* conf, class StelRenderer* renderer); 00075 00077 void initPlugIns(); 00078 00081 static StelApp& getInstance() {Q_ASSERT(singleton); return *singleton;} 00082 00085 StelModuleMgr& getModuleMgr() {return *moduleMgr;} 00086 00089 StelLocaleMgr& getLocaleMgr() {return *localeMgr;} 00090 00093 StelSkyCultureMgr& getSkyCultureMgr() {return *skyCultureMgr;} 00094 00097 StelLocationMgr& getLocationMgr() {return *planetLocationMgr;} 00098 00101 StelObjectMgr& getStelObjectMgr() {return *stelObjectMgr;} 00102 00103 StelSkyLayerMgr& getSkyImageMgr() {return *skyImageMgr;} 00104 00106 StelAudioMgr* getStelAudioMgr() {return audioMgr;} 00107 00109 StelShortcutMgr* getStelShortcutManager() {return shortcutMgr;} 00110 00112 StelVideoMgr* getStelVideoMgr() {return videoMgr;} 00113 00117 StelCore* getCore() {return core;} 00118 00120 QNetworkAccessManager* getNetworkAccessManager() {return networkAccessManager;} 00121 00123 void updateI18n(); 00124 00126 void updateSkyCulture(); 00127 00129 QSettings* getSettings() {return confSettings;} 00130 00132 QString getCurrentStelStyle() {return flagNightVision ? "night_color" : "color";} 00133 00135 void update(double deltaTime); 00136 00141 bool drawPartial(class StelRenderer* renderer); 00142 00144 void windowHasBeenResized(float x, float y, float w, float h); 00145 00147 StelGuiBase* getGui() const {return stelGui;} 00150 void setGui(StelGuiBase* b) {stelGui=b;} 00151 00152 static void initStatic(); 00153 static void deinitStatic(); 00154 00156 bool getRenderSolarShadows() const; 00157 00159 // Scriptable methods 00160 public slots: 00161 00163 void setRenderSolarShadows(bool); 00164 00166 void setVisionModeNight(bool); 00168 bool getVisionModeNight() const {return flagNightVision;} 00169 00172 float getFps() const {return fps;} 00173 00175 static double getTotalRunTime(); 00176 00179 void reportFileDownloadFinished(QNetworkReply* reply); 00180 00181 signals: 00182 void colorSchemeChanged(const QString&); 00183 void languageChanged(); 00184 void skyCultureChanged(const QString&); 00185 00186 private: 00187 00189 void handleClick(class QMouseEvent* event); 00191 void handleWheel(class QWheelEvent* event); 00193 void handleMove(int x, int y, Qt::MouseButtons b); 00195 void handleKeys(class QKeyEvent* event); 00196 00197 // The StelApp singleton 00198 static StelApp* singleton; 00199 00200 // The associated StelCore instance 00201 StelCore* core; 00202 00203 // Module manager for the application 00204 StelModuleMgr* moduleMgr; 00205 00206 // Locale manager for the application 00207 StelLocaleMgr* localeMgr; 00208 00209 // Sky cultures manager for the application 00210 StelSkyCultureMgr* skyCultureMgr; 00211 00212 //Shortcuts manager for the application 00213 StelShortcutMgr* shortcutMgr; 00214 00215 // Manager for all the StelObjects of the program 00216 StelObjectMgr* stelObjectMgr; 00217 00218 // Manager for the list of observer locations on planets 00219 StelLocationMgr* planetLocationMgr; 00220 00221 // Main network manager used for the program 00222 QNetworkAccessManager* networkAccessManager; 00223 00225 void setupHttpProxy(); 00226 00227 // The audio manager. Must execute in the main thread. 00228 StelAudioMgr* audioMgr; 00229 00230 // The video manager. Must execute in the main thread. 00231 StelVideoMgr* videoMgr; 00232 00233 StelSkyLayerMgr* skyImageMgr; 00234 00235 StelGuiBase* stelGui; 00236 00237 // Used to collect wheel events 00238 QTimer * wheelEventTimer; 00239 00240 float fps; 00241 int frame; 00242 double timefr, timeBase; // Used for fps counter 00243 00245 bool flagNightVision; 00246 00248 bool renderSolarShadows; 00249 00250 QSettings* confSettings; 00251 00252 // Define whether the StelApp instance has completed initialization 00253 bool initialized; 00254 00255 static QTime* qtime; 00256 00257 // Temporary variables used to store the last window resize 00258 // if the core was not yet initialized 00259 int saveProjW; 00260 int saveProjH; 00261 00263 int nbDownloadedFiles; 00265 qint64 totalDownloadedSize; 00266 00268 int nbUsedCache; 00270 qint64 totalUsedCacheSize; 00271 00273 int drawState; 00274 }; 00275 00276 #endif // _STELAPP_HPP_
1.6.3