StelApp.hpp   StelApp.hpp 
skipping to change at line 23 skipping to change at line 23
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#ifndef _STELAPP_HPP_ #ifndef _STELAPP_HPP_
#define _STELAPP_HPP_ #define _STELAPP_HPP_
#include "config.h"
#include <QString> #include <QString>
#include <QVariant>
#include <QObject> #include <QObject>
// Predeclaration of some classes // Predeclaration of some classes
class StelCore; class StelCore;
class StelTextureMgr;
class StelObjectMgr; class StelObjectMgr;
class StelLocaleMgr; class StelLocaleMgr;
class StelModuleMgr; class StelModuleMgr;
class StelSkyCultureMgr; class StelSkyCultureMgr;
class StelShortcutMgr;
class QSettings; class QSettings;
class QNetworkAccessManager; class QNetworkAccessManager;
class QNetworkReply; class QNetworkReply;
class QTime; class QTime;
class QTimer; class QTimer;
class StelLocationMgr; class StelLocationMgr;
class StelSkyLayerMgr; class StelSkyLayerMgr;
class StelAudioMgr; class StelAudioMgr;
class StelVideoMgr; class StelVideoMgr;
class StelGuiBase; class StelGuiBase;
class StelMainScriptAPIProxy;
class StelScriptMgr;
class StelActionMgr;
class StelProgressController;
//! @class StelApp //! @class StelApp
//! Singleton main Stellarium application class. //! Singleton main Stellarium application class.
//! This is the central class of Stellarium. Only one singleton instance o f //! This is the central class of Stellarium. Only one singleton instance o f
//! this class is created and can be accessed from anywhere else. This cla ss //! this class is created and can be accessed from anywhere else. This cla ss
//! is the access point to several "Manager" class which provide applicatio n-wide //! is the access point to several "Manager" class which provide applicatio n-wide
//! services for managment of font, textures, localization, sky culture, an d in //! services for managment of font, textures, localization, sky culture, an d in
//! theory all other services used by the other part of the program. //! theory all other services used by the other part of the program.
//! //!
//! The StelApp class is also the one managing the StelModule in a generic manner //! The StelApp class is also the one managing the StelModule in a generic manner
//! by calling their update, drawing and other methods when needed. //! by calling their update, drawing and other methods when needed.
//! @author Fabien Chereau //! @author Fabien Chereau
class StelApp : public QObject class StelApp : public QObject
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool nightMode READ getVisionModeNight WRITE setVisionMod eNight NOTIFY visionNightModeChanged)
public: public:
friend class StelAppGraphicsWidget; friend class StelAppGraphicsWidget;
friend class StelSkyItem;
//! Create and initialize the main Stellarium application. //! Create and initialize the main Stellarium application.
//! @param parent the QObject parent //! @param parent the QObject parent
//! The configFile will be search for in the search path by the Stel FileMgr, //! The configFile will be search for in the search path by the Stel FileMgr,
//! it is therefor possible to specify either just a file name or pa th within the //! it is therefor possible to specify either just a file name or pa th within the
//! search path, or use a full path or even a relative path to an ex isting file //! search path, or use a full path or even a relative path to an ex isting file
StelApp(QObject* parent=NULL); StelApp(QObject* parent=NULL);
//! Deinitialize and destroy the main Stellarium application. //! Deinitialize and destroy the main Stellarium application.
virtual ~StelApp(); virtual ~StelApp();
//! Initialize core and default modules. //! Initialize core and all the modules.
void init(QSettings* conf, class StelRenderer* renderer); void init(QSettings* conf);
//! Deinitialize core and all the modules.
void deinit();
//! Load and initialize external modules (plugins) //! Load and initialize external modules (plugins)
void initPlugIns(); void initPlugIns();
//! Get the StelApp singleton instance. //! Get the StelApp singleton instance.
//! @return the StelApp singleton instance //! @return the StelApp singleton instance
static StelApp& getInstance() {Q_ASSERT(singleton); return *singleto n;} static StelApp& getInstance() {Q_ASSERT(singleton); return *singleto n;}
//! Get the module manager to use for accessing any module loaded in the application. //! Get the module manager to use for accessing any module loaded in the application.
//! @return the module manager. //! @return the module manager.
StelModuleMgr& getModuleMgr() {return *moduleMgr;} StelModuleMgr& getModuleMgr() {return *moduleMgr;}
//! Get the locale manager to use for i18n & date/time localization. //! Get the locale manager to use for i18n & date/time localization.
//! @return the font manager to use for loading fonts. //! @return the font manager to use for loading fonts.
StelLocaleMgr& getLocaleMgr() {return *localeMgr;} StelLocaleMgr& getLocaleMgr() {return *localeMgr;}
//! Get the sky cultures manager. //! Get the sky cultures manager.
//! @return the sky cultures manager //! @return the sky cultures manager
StelSkyCultureMgr& getSkyCultureMgr() {return *skyCultureMgr;} StelSkyCultureMgr& getSkyCultureMgr() {return *skyCultureMgr;}
//! Get the texture manager to use for loading textures.
//! @return the texture manager to use for loading textures.
StelTextureMgr& getTextureManager() {return *textureMgr;}
//! Get the Location manager to use for managing stored locations //! Get the Location manager to use for managing stored locations
//! @return the Location manager to use for managing stored location s //! @return the Location manager to use for managing stored location s
StelLocationMgr& getLocationMgr() {return *planetLocationMgr;} StelLocationMgr& getLocationMgr() {return *planetLocationMgr;}
//! Get the StelObject manager to use for querying from all stellari um objects. //! Get the StelObject manager to use for querying from all stellari um objects.
//! @return the StelObject manager to use for querying from all stel larium objects . //! @return the StelObject manager to use for querying from all stel larium objects .
StelObjectMgr& getStelObjectMgr() {return *stelObjectMgr;} StelObjectMgr& getStelObjectMgr() {return *stelObjectMgr;}
StelSkyLayerMgr& getSkyImageMgr() {return *skyImageMgr;} StelSkyLayerMgr& getSkyImageMgr() {return *skyImageMgr;}
//! Get the audio manager //! Get the audio manager
StelAudioMgr* getStelAudioMgr() {return audioMgr;} StelAudioMgr* getStelAudioMgr() {return audioMgr;}
//! Get the shortcuts manager to use for managing and editing shortc //! Get the actions manager to use for managing and editing actions
uts StelActionMgr* getStelActionManager() {return actionMgr;}
StelShortcutMgr* getStelShortcutManager() {return shortcutMgr;}
//! Get the video manager //! Get the video manager
StelVideoMgr* getStelVideoMgr() {return videoMgr;} StelVideoMgr* getStelVideoMgr() {return videoMgr;}
//! Get the core of the program. //! Get the core of the program.
//! It is the one which provide the projection, navigation and tone converter. //! It is the one which provide the projection, navigation and tone converter.
//! @return the StelCore instance of the program //! @return the StelCore instance of the program
StelCore* getCore() {return core;} StelCore* getCore() {return core;}
//! Get the common instance of QNetworkAccessManager used in stellar ium //! Get the common instance of QNetworkAccessManager used in stellar ium
skipping to change at line 132 skipping to change at line 144
//! Update translations, font for GUI and sky everywhere in the prog ram. //! Update translations, font for GUI and sky everywhere in the prog ram.
void updateI18n(); void updateI18n();
//! Update and reload sky culture informations everywhere in the pro gram. //! Update and reload sky culture informations everywhere in the pro gram.
void updateSkyCulture(); void updateSkyCulture();
//! Return the main configuration options //! Return the main configuration options
QSettings* getSettings() {return confSettings;} QSettings* getSettings() {return confSettings;}
//! Return the currently used style //! Return the currently used style
QString getCurrentStelStyle() {return flagNightVision ? "night_color " : "color";} QString getCurrentStelStyle() {return "color";}
//! Update all object according to the deltaTime in seconds. //! Update all object according to the deltaTime in seconds.
void update(double deltaTime); void update(double deltaTime);
//! Iterate through the drawing sequence. //! Draw all registered StelModule in the order defined by the order
//! This allow us to split the slow drawing operation into small par lists.
ts, //! @return the max squared distance in pixels that any object has t
//! we can then decide to pause the painting for this frame and used ravelled since the last update.
the cached image instead. void draw();
//! @return true if we should continue drawing (by calling the metho
d again) //! Call this when the size of the GL window has changed.
bool drawPartial(class StelRenderer* renderer); void glWindowHasBeenResized(float x, float y, float w, float h);
//! Call this when the size of the window has changed. //! Get the ratio between real device pixel and "Device Independent
void windowHasBeenResized(float x, float y, float w, float h); Pixel".
//! Usually this value is 1, but for a mac with retina screen this w
ill be value 2.
float getDevicePixelsPerPixel() const {return devicePixelsPerPixel;}
void setDevicePixelsPerPixel(float dppp);
//! Get the scaling ratio to apply on all display elements, like GUI
, text etc..
//! When this ratio is 1, all pixel sizes used in Stellarium will lo
ok OK on a regular
//! computer screen with 96 pixel per inch (reference for tuning siz
es).
float getGlobalScalingRatio() const {return globalScalingRatio;}
void setGlobalScalingRatio(float r) {globalScalingRatio=r;}
//! Get the GUI instance implementing the abstract GUI interface. //! Get the GUI instance implementing the abstract GUI interface.
StelGuiBase* getGui() const {return stelGui;} StelGuiBase* getGui() const {return stelGui;}
//! Tell the StelApp instance which GUI si currently being used. //! Tell the StelApp instance which GUI si currently being used.
//! The caller is responsible for destroying the GUI. //! The caller is responsible for destroying the GUI.
void setGui(StelGuiBase* b) {stelGui=b;} void setGui(StelGuiBase* b) {stelGui=b;}
#ifndef DISABLE_SCRIPTING
//! Get the script API proxy (for signal handling)
StelMainScriptAPIProxy* getMainScriptAPIProxy() {return scriptAPIPro
xy;}
//! Get the script manager
StelScriptMgr& getScriptMgr() {return *scriptMgr;}
#endif
static void initStatic(); static void initStatic();
static void deinitStatic(); static void deinitStatic();
//! Get whether solar shadows should be rendered. //! Add a progression indicator to the GUI (if applicable).
bool getRenderSolarShadows() const; //! @return a controller which can be used to indicate the current s
tatus.
//! The StelApp instance remains the owner of the controller.
StelProgressController* addProgressBar();
void removeProgressBar(StelProgressController* p);
//////////////////////////////////////////////////////////////////// /////// //////////////////////////////////////////////////////////////////// ///////
// Scriptable methods // Scriptable methods
public slots: public slots:
//! Set flag for activating solar shadow rendering.
void setRenderSolarShadows(bool);
//! Set flag for activating night vision mode. //! Set flag for activating night vision mode.
void setVisionModeNight(bool); void setVisionModeNight(bool);
//! Get flag for activating night vision mode. //! Get flag for activating night vision mode.
bool getVisionModeNight() const {return flagNightVision;} bool getVisionModeNight() const {return flagNightVision;}
//! Get the current number of frame per second. //! Get the current number of frame per second.
//! @return the FPS averaged on the last second //! @return the FPS averaged on the last second
float getFps() const {return fps;} float getFps() const {return fps;}
//! Return the time since when stellarium is running in second. //! Return the time since when stellarium is running in second.
static double getTotalRunTime(); static double getTotalRunTime();
//! Report that a download occured. This is used for statistics purp oses. //! Report that a download occured. This is used for statistics purp oses.
//! Connect this slot to QNetworkAccessManager::finished() slot to o btain statistics at the end of the program. //! Connect this slot to QNetworkAccessManager::finished() slot to o btain statistics at the end of the program.
void reportFileDownloadFinished(QNetworkReply* reply); void reportFileDownloadFinished(QNetworkReply* reply);
//! do some cleanup and call QCoreApplication::exit(0)
void quit();
signals: signals:
void visionNightModeChanged(bool);
void colorSchemeChanged(const QString&); void colorSchemeChanged(const QString&);
void languageChanged(); void languageChanged();
void skyCultureChanged(const QString&); void skyCultureChanged(const QString&);
//! Called just after a progress bar is added.
void progressBarAdded(const StelProgressController*);
//! Called just before a progress bar is removed.
void progressBarRemoved(const StelProgressController*);
//! Called just before we exit Qt mainloop.
void aboutToQuit();
private: private:
//! Handle mouse clics. //! Handle mouse clics.
void handleClick(class QMouseEvent* event); void handleClick(class QMouseEvent* event);
//! Handle mouse wheel. //! Handle mouse wheel.
void handleWheel(class QWheelEvent* event); void handleWheel(class QWheelEvent* event);
//! Handle mouse move. //! Handle mouse move.
void handleMove(int x, int y, Qt::MouseButtons b); void handleMove(int x, int y, Qt::MouseButtons b);
//! Handle key press and release. //! Handle key press and release.
void handleKeys(class QKeyEvent* event); void handleKeys(class QKeyEvent* event);
//! Handle pinch on multi touch devices.
void handlePinch(qreal scale, bool started);
void initScriptMgr(QSettings* conf);
// The StelApp singleton // The StelApp singleton
static StelApp* singleton; static StelApp* singleton;
// The associated StelCore instance // The associated StelCore instance
StelCore* core; StelCore* core;
// Module manager for the application // Module manager for the application
StelModuleMgr* moduleMgr; StelModuleMgr* moduleMgr;
// Locale manager for the application // Locale manager for the application
StelLocaleMgr* localeMgr; StelLocaleMgr* localeMgr;
// Sky cultures manager for the application // Sky cultures manager for the application
StelSkyCultureMgr* skyCultureMgr; StelSkyCultureMgr* skyCultureMgr;
//Shortcuts manager for the application //Actions manager fot the application. Will replace shortcutMgr.
StelShortcutMgr* shortcutMgr; StelActionMgr* actionMgr;
// Textures manager for the application
StelTextureMgr* textureMgr;
// Manager for all the StelObjects of the program // Manager for all the StelObjects of the program
StelObjectMgr* stelObjectMgr; StelObjectMgr* stelObjectMgr;
// Manager for the list of observer locations on planets // Manager for the list of observer locations on planets
StelLocationMgr* planetLocationMgr; StelLocationMgr* planetLocationMgr;
// Main network manager used for the program // Main network manager used for the program
QNetworkAccessManager* networkAccessManager; QNetworkAccessManager* networkAccessManager;
skipping to change at line 235 skipping to change at line 280
void setupHttpProxy(); void setupHttpProxy();
// The audio manager. Must execute in the main thread. // The audio manager. Must execute in the main thread.
StelAudioMgr* audioMgr; StelAudioMgr* audioMgr;
// The video manager. Must execute in the main thread. // The video manager. Must execute in the main thread.
StelVideoMgr* videoMgr; StelVideoMgr* videoMgr;
StelSkyLayerMgr* skyImageMgr; StelSkyLayerMgr* skyImageMgr;
#ifndef DISABLE_SCRIPTING
// The script API proxy object (for bridging threads)
StelMainScriptAPIProxy* scriptAPIProxy;
// The script manager based on Qt script engine
StelScriptMgr* scriptMgr;
#endif
StelGuiBase* stelGui; StelGuiBase* stelGui;
// Store the ratio between real device pixel in "Device Independent
Pixel"
// Usually this value is 1, but for a mac with retina screen this wi
ll be value 2.
float devicePixelsPerPixel;
// The scaling ratio to apply on all display elements, like GUI, tex
t etc..
float globalScalingRatio;
// Used to collect wheel events // Used to collect wheel events
QTimer * wheelEventTimer; QTimer * wheelEventTimer;
// Accumulated horizontal and vertical wheel event deltas
int wheelEventDelta[2];
float fps; float fps;
int frame; int frame;
double timefr, timeBase; // Used for fps counter double timefr, timeBase; // Used for fps counter
//! Define whether we are in night vision mode //! Define whether we are in night vision mode
bool flagNightVision; bool flagNightVision;
//! Define whether solar shadows should be rendered (using GLSL shad
ers)
bool renderSolarShadows;
QSettings* confSettings; QSettings* confSettings;
// Define whether the StelApp instance has completed initialization // Define whether the StelApp instance has completed initialization
bool initialized; bool initialized;
static QTime* qtime; static QTime* qtime;
// Temporary variables used to store the last window resize // Temporary variables used to store the last gl window resize
// if the core was not yet initialized // if the core was not yet initialized
int saveProjW; int saveProjW;
int saveProjH; int saveProjH;
//! Store the number of downloaded files for statistics. //! Store the number of downloaded files for statistics.
int nbDownloadedFiles; int nbDownloadedFiles;
//! Store the summed size of all downloaded files in bytes. //! Store the summed size of all downloaded files in bytes.
qint64 totalDownloadedSize; qint64 totalDownloadedSize;
//! Store the number of downloaded files read from the cache for sta tistics. //! Store the number of downloaded files read from the cache for sta tistics.
int nbUsedCache; int nbUsedCache;
//! Store the summed size of all downloaded files read from the cach e in bytes. //! Store the summed size of all downloaded files read from the cach e in bytes.
qint64 totalUsedCacheSize; qint64 totalUsedCacheSize;
//! The state of the drawing sequence QList<StelProgressController*> progressControllers;
int drawState;
}; };
#endif // _STELAPP_HPP_ #endif // _STELAPP_HPP_
 End of changes. 26 change blocks. 
33 lines changed or deleted 99 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/