StelApp.hpp   StelApp.hpp 
skipping to change at line 26 skipping to change at line 26
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA.
*/ */
#ifndef _STELAPP_HPP_ #ifndef _STELAPP_HPP_
#define _STELAPP_HPP_ #define _STELAPP_HPP_
#include "fixx11h.h" #include "fixx11h.h"
#include <QString> #include <QString>
#include <QObject> #include <QObject>
#include <QFile>
// Predeclaration of some classes // Predeclaration of some classes
class StelCore; class StelCore;
class SkyLocalizer; class SkyLocalizer;
class StelTextureMgr; class StelTextureMgr;
class StelObjectMgr; class StelObjectMgr;
class StelFontMgr; class StelFontMgr;
class StelLocaleMgr; class StelLocaleMgr;
class StelModuleMgr; class StelModuleMgr;
class StelSkyCultureMgr; class StelSkyCultureMgr;
class StelFileMgr; class StelFileMgr;
class QStringList; class QStringList;
class LoadingBar; class StelLoadingBar;
class QSettings; class QSettings;
class QNetworkAccessManager; class QNetworkAccessManager;
class StelStyle; class StelStyle;
class QTime; class QTime;
class LocationMgr; class StelLocationMgr;
class StelSkyImageMgr;
class StelScriptMgr;
class StelDownloadMgr;
class StelAudioMgr;
class QNetworkReply;
//! @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
public: public:
friend class StelAppGraphicsScene; friend class StelAppGraphicsScene;
//! Create and initialize the main Stellarium application. //! Create and initialize the main Stellarium application.
//! @param argc The number of command line parameters //! @param argc The number of command line parameters
//! @param argv an array of char* command line arguments //! @param argv an array of char* command line arguments
//! @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(int argc, char** argv, QObject* parent=NULL); StelApp(int argc, char** argv, 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 default modules.
void init(); void init();
skipping to change at line 110 skipping to change at line 117
//! Get the texture manager to use for loading textures. //! Get the texture manager to use for loading textures.
//! @return the texture manager to use for loading textures. //! @return the texture manager to use for loading textures.
StelTextureMgr& getTextureManager() {return *textureMgr;} StelTextureMgr& getTextureManager() {return *textureMgr;}
//! 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;}
//! 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
LocationMgr& getLocationMgr() {return *planetLocationMgr;} StelLocationMgr& getLocationMgr() {return *planetLocationMgr;}
//! Get the StelFileMgr for performing file operations. //! Get the StelFileMgr for performing file operations.
//! @return the StelFileMgr manager to use for performing file opera tions //! @return the StelFileMgr manager to use for performing file opera tions
StelFileMgr& getFileMgr() {return *stelFileMgr;} StelFileMgr& getFileMgr() {return *stelFileMgr;}
//! Get the StelSkyImageMgr managing background images
//! @return the StelSkyImageMgr managing background images
StelSkyImageMgr& getSkyImageMgr() {return *skyImageMgr;}
StelAudioMgr* getStelAudioMgr() {return audioMgr;}
//! Get the script manager
StelScriptMgr& getScriptMgr() {return *scriptMgr;}
//! Get the download manager
StelDownloadMgr& getDownloadMgr() {return *downloadMgr;}
//! 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 main loading bar used by modules for displaying loading informations. //! Get the main loading bar used by modules for displaying loading informations.
//! @return the main LoadingBar instance of the program. //! @return the main StelLoadingBar instance of the program.
LoadingBar* getLoadingBar() {return loadingBar;} StelLoadingBar* getStelLoadingBar() {return loadingBar;}
//! Get the common instance of QNetworkAccessManager used in stellar ium //! Get the common instance of QNetworkAccessManager used in stellar ium
QNetworkAccessManager* getNetworkAccessManager() {return networkAcce ssManager;} QNetworkAccessManager* getNetworkAccessManager() {return networkAcce ssManager;}
//! 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();
//! Retrieve the full path of the current configuration file. //! Retrieve the full path of the current configuration file.
//! @return the full path of the configuration file //! @return the full path of the configuration file
const QString& getConfigFilePath() { return configFile; } const QString& getConfigFilePath() { return configFile; }
//! 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
const StelStyle* getCurrentStelStyle() {return currentStelStyle;} const StelStyle* getCurrentStelStyle() {return currentStelStyle;}
//////////////////////////////////////////////////////////////////// //! Handler for qDebug() and friends. Writes message to log file at
/////// //! $USERDIR/log.txt and echoes to stderr. Do not call this function
// Deprecated methods ;
//! Set the time multiplier used when fast forwarding scripts. //! it's only for use by qInstallMsgHandler. Use writeLog(QString)
//! n.b. - do not confuse this with sky time rate //! instead, but preferably qDebug().
//! @param multiplier new value for the time multiplier static void debugLogHandler(QtMsgType, const char*);
void setTimeMultiplier(const int multiplier) { timeMultiplier = mult
iplier; } //! Return a copy of text of the log file.
QString getLog() { return log; }
//! Get the time multiplier used when fast forwarding scripts.
//! n.b. - do not confuse this with sky time rate //! Get the file name of the startup script
//! @return the integer time multiplier QString getStartupScript() const {return startupScript;}
const int getTimeMultiplier() { return timeMultiplier; }
//////////////////////////////////////////////////////////////////// /////// //////////////////////////////////////////////////////////////////// ///////
// Scriptable methods // Scriptable methods
public slots: public slots:
//! Return the full name of stellarium, i.e. "Stellarium 0.9.0". //! Return the full name of stellarium, i.e. "Stellarium 0.9.0".
static QString getApplicationName(); static QString getApplicationName();
//! 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;}
//! Set the minimum frames per second. Usually this minimum will
//! be switched to after there are no user events for some seconds
//! to save power. However, if can be useful to set this to a high
//! value to improve playing smoothness in scripts.
//! @param m the new minimum fps setting.
void setMinFps(float m) {minfps=m; emit(minFpsChanged());}
//! Get the current minimum frames per second.
float getMinFps() {return minfps;}
//! Set the maximum frames per second.
//! @param m the new maximum fps setting.
void setMaxFps(float m) {maxfps = m;}
//! Get the current maximum frames per second.
float getMaxFps() {return maxfps;}
//! 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.
//! Connect this slot to QNetworkAccessManager::finished() slot to o
btain statistics at the end of the program.
void reportFileDownloadFinished(QNetworkReply* reply);
signals:
void minFpsChanged();
private: private:
//! 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);
//! Draw all registered StelModule in the order defined by the order lists. //! Draw all registered StelModule in the order defined by the order lists.
//! @return the max squared distance in pixels that any object has t ravelled since the last update. //! @return the max squared distance in pixels that any object has t ravelled since the last update.
void draw(); void draw();
//! Handle mouse clics. //! Handle mouse clics.
void handleClick(class QMouseEvent* event); void handleClick(class QMouseEvent* event);
skipping to change at line 283 skipping to change at line 323
//! This includes the chance to set the configuration file name. It is to be done //! This includes the chance to set the configuration file name. It is to be done
//! in the sub-class of the StelApp, as the sub-class may want to ma nage the //! in the sub-class of the StelApp, as the sub-class may want to ma nage the
//! argument list, as is the case with the StelMainWindow version. //! argument list, as is the case with the StelMainWindow version.
void parseCLIArgsPreConfig(void); void parseCLIArgsPreConfig(void);
//! Processing of command line options which is to be done after the config file is //! Processing of command line options which is to be done after the config file is
//! read. This gives us the chance to over-ride settings which are in the configuration //! read. This gives us the chance to over-ride settings which are in the configuration
//! file. //! file.
void parseCLIArgsPostConfig(); void parseCLIArgsPostConfig();
//! Prepend system information to log file before any debugging outp
ut.
void setupLog();
//! Write the message plus a newline to the log file at $USERDIR/log
.txt.
//! @param msg message to write
static void writeLog(QString msg);
// 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;
// Font manager for the application // Font manager for the application
skipping to change at line 308 skipping to change at line 355
// Sky cultures manager for the application // Sky cultures manager for the application
StelSkyCultureMgr* skyCultureMgr; StelSkyCultureMgr* skyCultureMgr;
// Textures manager for the application // Textures manager for the application
StelTextureMgr* textureMgr; 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
LocationMgr* planetLocationMgr; StelLocationMgr* planetLocationMgr;
//! Utility class for file operations, mainly locating files by name //! Utility class for file operations, mainly locating files by name
StelFileMgr* stelFileMgr; StelFileMgr* stelFileMgr;
// Main network manager used for the program // Main network manager used for the program
QNetworkAccessManager* networkAccessManager; QNetworkAccessManager* networkAccessManager;
// The manager for the sky images such as nebulas or background DSS
StelSkyImageMgr* skyImageMgr;
// The audio manager. Must execute in the main thread.
StelAudioMgr* audioMgr;
// The script manager based on Qt script engine
StelScriptMgr* scriptMgr;
// The main loading bar // The main loading bar
LoadingBar* loadingBar; StelLoadingBar* loadingBar;
// Currently used StelStyle // Currently used StelStyle
StelStyle* currentStelStyle; StelStyle* currentStelStyle;
// Download manager that uses networkAccessManager
StelDownloadMgr* downloadMgr;
float fps; float fps;
//! The minimum desired frame rate in frame per second. //! The minimum desired frame rate in frame per second.
float minfps; float minfps;
//! The maximum desired frame rate in frame per second. //! The maximum desired frame rate in frame per second.
float maxfps; float maxfps;
int frame; int frame;
double timefr, timeBase; // Used for fps counter double timefr, timeBase; // Used for fps counter
int timeMultiplier; // used for adjusting deltaTime for script s
peeds
//! Define whether we are in night vision mode //! Define whether we are in night vision mode
bool flagNightVision; bool flagNightVision;
QString configFile; QString configFile;
QString startupScript;
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 gl 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.
int nbDownloadedFiles;
//! Store the the summed size of all downloaded files in bytes.
qint64 totalDownloadedSize;
//! Store the number of downloaded files read from the cache for sta
tistics.
int nbUsedCache;
//! Store the the summed size of all downloaded files read from the
cache in bytes.
qint64 totalUsedCacheSize;
static QFile logFile;
static QString log;
}; };
#endif // _STELAPP_HPP_ #endif // _STELAPP_HPP_
 End of changes. 19 change blocks. 
24 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/