Stellarium 0.11.4
Home · All Namespaces · All Classes · Functions · Coding Style · Scripting · Plugins · File Structure

core/StelApp.hpp

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 StelVideoMgr;
00042 class StelGuiBase;
00043 
00055 class StelApp : public QObject
00056 {
00057     Q_OBJECT
00058 
00059 public:
00060     friend class StelAppGraphicsWidget;
00061 
00067     StelApp(QObject* parent=NULL);
00068 
00070     virtual ~StelApp();
00071 
00073     void init(QSettings* conf);
00074 
00076     void initPlugIns();
00077 
00080     static StelApp& getInstance() {Q_ASSERT(singleton); return *singleton;}
00081 
00084     StelModuleMgr& getModuleMgr() {return *moduleMgr;}
00085 
00088     StelLocaleMgr& getLocaleMgr() {return *localeMgr;}
00089 
00092     StelSkyCultureMgr& getSkyCultureMgr() {return *skyCultureMgr;}
00093 
00096     StelTextureMgr& getTextureManager() {return *textureMgr;}
00097 
00100     StelLocationMgr& getLocationMgr() {return *planetLocationMgr;}
00101 
00104     StelObjectMgr& getStelObjectMgr() {return *stelObjectMgr;}
00105 
00108     StelSkyLayerMgr& getSkyImageMgr() {return *skyImageMgr;}
00109 
00111     StelAudioMgr* getStelAudioMgr() {return audioMgr;}
00112 
00114     StelVideoMgr* getStelVideoMgr() {return videoMgr;}
00115 
00119     StelCore* getCore() {return core;}
00120 
00122     QNetworkAccessManager* getNetworkAccessManager() {return networkAccessManager;}
00123 
00125     void updateI18n();
00126 
00128     void updateSkyCulture();
00129 
00131     QSettings* getSettings() {return confSettings;}
00132 
00134     QString getCurrentStelStyle() {return flagNightVision ? "night_color" : "color";}
00135 
00137     void update(double deltaTime);
00138 
00141     void draw();
00142 
00147     bool drawPartial();
00148 
00150     void glWindowHasBeenResized(float x, float y, float w, float h);
00151 
00153     StelGuiBase* getGui() const {return stelGui;}
00156     void setGui(StelGuiBase* b) {stelGui=b;}
00157 
00158     static void initStatic();
00159     static void deinitStatic();
00160 
00162     bool getUseGLShaders() const {return useGLShaders;}
00163 
00165     // Scriptable methods
00166 public slots:
00167 
00169     void setVisionModeNight(bool);
00171     bool getVisionModeNight() const {return flagNightVision;}
00172 
00175     float getFps() const {return fps;}
00176 
00178     static double getTotalRunTime();
00179 
00182     void reportFileDownloadFinished(QNetworkReply* reply);
00183     
00184 signals:
00185     void colorSchemeChanged(const QString&);
00186     void languageChanged();
00187     void skyCultureChanged(const QString&);
00188 
00189 private:
00190 
00192     void handleClick(class QMouseEvent* event);
00194     void handleWheel(class QWheelEvent* event);
00196     void handleMove(int x, int y, Qt::MouseButtons b);
00198     void handleKeys(class QKeyEvent* event);
00199 
00200     // The StelApp singleton
00201     static StelApp* singleton;
00202 
00203     // The associated StelCore instance
00204     StelCore* core;
00205 
00206     // Module manager for the application
00207     StelModuleMgr* moduleMgr;
00208 
00209     // Locale manager for the application
00210     StelLocaleMgr* localeMgr;
00211 
00212     // Sky cultures manager for the application
00213     StelSkyCultureMgr* skyCultureMgr;
00214 
00215     // Textures manager for the application
00216     StelTextureMgr* textureMgr;
00217 
00218     // Manager for all the StelObjects of the program
00219     StelObjectMgr* stelObjectMgr;
00220 
00221     // Manager for the list of observer locations on planets
00222     StelLocationMgr* planetLocationMgr;
00223 
00224     // Main network manager used for the program
00225     QNetworkAccessManager* networkAccessManager;
00226 
00228     void setupHttpProxy();
00229 
00230     // The audio manager.  Must execute in the main thread.
00231     StelAudioMgr* audioMgr;
00232 
00233     // The video manager.  Must execute in the main thread.
00234     StelVideoMgr* videoMgr;
00235 
00236     StelSkyLayerMgr* skyImageMgr;
00237 
00238     StelGuiBase* stelGui;
00239 
00240     float fps;
00241     int frame;
00242     double timefr, timeBase;        // Used for fps counter
00243 
00245     bool flagNightVision;
00246 
00248     bool useGLShaders;
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 gl 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_
Generated on Sat Aug 25 22:13:29 2012 for Stellarium by  doxygen 1.6.3