Stellarium  0.90.0
Public Slots | Signals | Public Member Functions | Static Public Member Functions | Properties | Friends
StelApp Class Reference

Singleton main Stellarium application class. More...

#include <StelApp.hpp>

Public Slots

void glWindowHasBeenResized (const QRectF &rect)
 Call this when the size of the GL window has changed.
 
void setVisionModeNight (bool)
 Set flag for activating night vision mode.
 
bool getVisionModeNight () const
 Get flag for activating night vision mode.
 
void setFlagShowDecimalDegrees (bool b)
 Set flag for showing decimal degree in various places.
 
bool getFlagShowDecimalDegrees () const
 Get flag for showing decimal degree in various places.
 
bool getFlagSouthAzimuthUsage () const
 Set flag for using calculation of azimuth from south towards west (instead north towards east)
 
void setFlagSouthAzimuthUsage (bool use)
 Get flag for using calculation of azimuth from south towards west (instead north towards east)
 
void setFlagUseFormattingOutput (bool b)
 Set flag for using of formatting output for coordinates.
 
bool getFlagUseFormattingOutput () const
 Get flag for using of formatting output for coordinates.
 
void setFlagUseCCSDesignation (bool b)
 Set flag for using designations for celestial coordinate systems.
 
bool getFlagUseCCSDesignation () const
 Get flag for using designations for celestial coordinate systems.
 
float getFps () const
 Get the current number of frame per second. More...
 
quint32 getDefaultFBO () const
 Returns the default FBO handle, to be used when StelModule instances want to release their own FBOs. More...
 
void ensureGLContextCurrent ()
 Makes sure the correct GL context used for main drawing is made current. More...
 
static double getTotalRunTime ()
 Return the time since when stellarium is running in second.
 
static double getAnimationTime ()
 Return the scaled time for animated objects.
 
void reportFileDownloadFinished (QNetworkReply *reply)
 Report that a download occured. More...
 
void quit ()
 do some cleanup and call QCoreApplication::exit(0)
 

Signals

void visionNightModeChanged (bool)
 
void flagShowDecimalDegreesChanged (bool)
 
void flagUseAzimuthFromSouthChanged (bool)
 
void flagUseCCSDesignationChanged (bool)
 
void flagUseFormattingOutputChanged (bool)
 
void colorSchemeChanged (const QString &)
 
void languageChanged ()
 
void progressBarAdded (const StelProgressController *)
 Called just after a progress bar is added.
 
void progressBarRemoved (const StelProgressController *)
 Called just before a progress bar is removed.
 
void aboutToQuit ()
 Called just before we exit Qt mainloop.
 

Public Member Functions

 StelApp (StelMainView *parent)
 Create and initialize the main Stellarium application. More...
 
virtual ~StelApp ()
 Deinitialize and destroy the main Stellarium application.
 
void init (QSettings *conf)
 Initialize core and all the modules.
 
void deinit ()
 Deinitialize core and all the modules.
 
void initPlugIns ()
 Load and initialize external modules (plugins)
 
void initScriptMgr ()
 Registers all loaded StelModules with the ScriptMgr, and queues starting of the startup script.
 
StelModuleMgrgetModuleMgr ()
 Get the module manager to use for accessing any module loaded in the application. More...
 
StelModulegetModule (const QString &moduleID)
 Get the corresponding module or Q_NULLPTR if can't find it. More...
 
StelLocaleMgrgetLocaleMgr ()
 Get the locale manager to use for i18n & date/time localization. More...
 
StelSkyCultureMgrgetSkyCultureMgr ()
 Get the sky cultures manager. More...
 
StelTextureMgrgetTextureManager ()
 Get the texture manager to use for loading textures. More...
 
StelLocationMgrgetLocationMgr ()
 Get the Location manager to use for managing stored locations. More...
 
StelObjectMgrgetStelObjectMgr ()
 Get the StelObject manager to use for querying from all stellarium objects. More...
 
StelSkyLayerMgrgetSkyImageMgr ()
 
StelAudioMgrgetStelAudioMgr ()
 Get the audio manager.
 
StelActionMgrgetStelActionManager ()
 Get the actions manager to use for managing and editing actions.
 
StelPropertyMgrgetStelPropertyManager ()
 Return the property manager.
 
StelVideoMgrgetStelVideoMgr ()
 Get the video manager.
 
StelCoregetCore ()
 Get the core of the program. More...
 
QNetworkAccessManager * getNetworkAccessManager ()
 Get the common instance of QNetworkAccessManager used in stellarium.
 
void updateI18n ()
 Update translations, font for GUI and sky everywhere in the program.
 
QSettings * getSettings ()
 Return the main configuration options.
 
QString getCurrentStelStyle ()
 Return the currently used style.
 
void update (double deltaTime)
 Update all object according to the deltaTime in seconds.
 
void draw ()
 Draw all registered StelModule in the order defined by the order lists.
 
float getDevicePixelsPerPixel () const
 Get the ratio between real device pixel and "Device Independent Pixel". More...
 
void setDevicePixelsPerPixel (float dppp)
 
float getGlobalScalingRatio () const
 Get the scaling ratio to apply on all display elements, like GUI, text etc. More...
 
void setGlobalScalingRatio (float r)
 
int getBaseFontSize () const
 Get the size of font.
 
void setBaseFontSize (int s)
 
StelGuiBasegetGui () const
 Get the GUI instance implementing the abstract GUI interface.
 
void setGui (StelGuiBase *b)
 Tell the StelApp instance which GUI is currently being used. More...
 
StelMainScriptAPIProxygetMainScriptAPIProxy ()
 Get the script API proxy (for signal handling)
 
StelScriptMgrgetScriptMgr ()
 Get the script manager.
 
StelProgressControlleraddProgressBar ()
 Add a progression indicator to the GUI (if applicable). More...
 
void removeProgressBar (StelProgressController *p)
 
void setViewportEffect (const QString &effectName)
 Define the type of viewport effect to use. More...
 
QString getViewportEffect () const
 Get the type of viewport effect currently used.
 
void dumpModuleActionPriorities (StelModule::StelModuleActionName actionName)
 Dump diagnostics about action call priorities.
 

Static Public Member Functions

static QStringList getCommandlineArguments ()
 Returns all arguments passed on the command line, together with the contents of the STEL_OPTS environment variable. More...
 
static StelAppgetInstance ()
 Get the StelApp singleton instance. More...
 
static void initStatic ()
 
static void deinitStatic ()
 

Properties

bool nightMode
 
bool flagShowDecimalDegrees
 
bool flagUseAzimuthFromSouth
 
bool flagUseCCSDesignation
 
bool flagUseFormattingOutput
 

Friends

class StelAppGraphicsWidget
 
class StelRootItem
 

Detailed Description

This is the central class of Stellarium. Only one singleton instance of this class is created and can be accessed from anywhere else. This class is the access point to several "Manager" class which provide application-wide services for managment of font, textures, localization, sky culture, and in 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 by calling their update, drawing and other methods when needed.

Author
Fabien Chereau

Constructor & Destructor Documentation

StelApp::StelApp ( StelMainView parent)
Parameters
parentthe QObject parent The configFile will be searched for in the search path by the StelFileMgr, it is therefore possible to specify either just a file name or path within the search path, or use a full path or even a relative path to an existing file

Member Function Documentation

StelProgressController* StelApp::addProgressBar ( )
Returns
a controller which can be used to indicate the current status. The StelApp instance remains the owner of the controller.
void StelApp::ensureGLContextCurrent ( )
slot

This is always the case during init() and draw() calls, but if OpenGL access is required elsewhere, this MUST be called before using any GL functions.

static QStringList StelApp::getCommandlineArguments ( )
static

You can use the CLIProcessor class to help parse it.

Returns
the arguments passed to Stellarium on the command line concatenated with the STEL_OPTS environment variable
StelCore* StelApp::getCore ( )
inline

It is the one which provide the projection, navigation and tone converter.

Returns
the StelCore instance of the program
quint32 StelApp::getDefaultFBO ( ) const
inlineslot

Note that this is usually not the same as QOpenGLContext::defaultFramebufferObject(), so use this call instead of the Qt version! Valid through a StelModule::draw() call, do not use elsewhere.

float StelApp::getDevicePixelsPerPixel ( ) const
inline

Usually this value is 1, but for a mac with retina screen this will be value 2.

float StelApp::getFps ( ) const
inlineslot
Returns
the FPS averaged on the last second
float StelApp::getGlobalScalingRatio ( ) const
inline

When this ratio is 1, all pixel sizes used in Stellarium will look OK on a regular computer screen with 96 pixel per inch (reference for tuning sizes).

static StelApp& StelApp::getInstance ( )
inlinestatic
Returns
the StelApp singleton instance
StelLocaleMgr& StelApp::getLocaleMgr ( )
inline
Returns
the font manager to use for loading fonts.
StelLocationMgr& StelApp::getLocationMgr ( )
inline
Returns
the Location manager to use for managing stored locations
StelModule* StelApp::getModule ( const QString &  moduleID)

This is a shortcut for getModleMgr().getModule().

Returns
the module pointer.
StelModuleMgr& StelApp::getModuleMgr ( )
inline
Returns
the module manager.
StelSkyCultureMgr& StelApp::getSkyCultureMgr ( )
inline
Returns
the sky cultures manager
StelObjectMgr& StelApp::getStelObjectMgr ( )
inline
Returns
the StelObject manager to use for querying from all stellarium objects .
StelTextureMgr& StelApp::getTextureManager ( )
inline
Returns
the texture manager to use for loading textures.
void StelApp::reportFileDownloadFinished ( QNetworkReply *  reply)
slot

This is used for statistics purposes. Connect this slot to QNetworkAccessManager::finished() slot to obtain statistics at the end of the program.

void StelApp::setGui ( StelGuiBase b)
inline

The caller is responsible for destroying the GUI.

void StelApp::setViewportEffect ( const QString &  effectName)
Parameters
effectNamemust be one of 'none', 'framebufferOnly', 'sphericMirrorDistorter'