Stellarium  24.4
Data Structures | 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 virtual size of the GL window has changed.
 
void glPhysicalWindowHasBeenResized (const QRectF &rect)
 Call this when the physical 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 setFlagOverwriteInfoColor (bool)
 Set flag for activating overwrite mode for text color in info panel.
 
bool getFlagOverwriteInfoColor () const
 Get flag for activating overwrite mode for text color in info panel.
 
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.
 
void setOverwriteInfoColor (const Vec3f &color)
 Define info text color for overwrites.
 
Vec3f getOverwriteInfoColor () const
 Get info text color.
 
void setDaylightInfoColor (const Vec3f &color)
 Define info text color for daylight mode.
 
Vec3f getDaylightInfoColor () const
 Get info text color.
 
void setFlagImmediateSave (bool b)
 Set flag for storing some settings immediately To not accidentally activate this mode permanently, you must use the "save settings" button to activate! Switching it off is however stored immediately.
 
bool getFlagImmediateSave () const
 Get flag about storing some settings immediately.
 
float getFps () const
 Get the current number of frame per second. More...
 
void setAppFont (QFont font)
 Set global application font. 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 occurred. 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 flagOverwriteInfoColorChanged (bool)
 
void colorSchemeChanged (const QString &)
 
void languageChanged ()
 
void screenFontSizeChanged (int)
 
void guiFontSizeChanged (int)
 
void fontChanged (const QFont &)
 
void overwriteInfoColorChanged (const Vec3f &color)
 
void daylightInfoColorChanged (const Vec3f &color)
 
void flagImmediateSaveChanged (bool)
 
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...
 
 ~StelApp () override
 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 () const
 Get the module manager to use for accessing any module loaded in the application. More...
 
StelModulegetModule (const QString &moduleID) const
 Get the corresponding module or Q_NULLPTR if can't find it. More...
 
StelLocaleMgrgetLocaleMgr () const
 Get the locale manager to use for i18n & date/time localization. More...
 
StelSkyCultureMgrgetSkyCultureMgr () const
 Get the sky cultures manager. More...
 
StelTextureMgrgetTextureManager () const
 Get the texture manager to use for loading textures. More...
 
StelLocationMgrgetLocationMgr () const
 Get the Location manager to use for managing stored locations. More...
 
StelObjectMgrgetStelObjectMgr () const
 Get the StelObject manager to use for querying from all stellarium objects. More...
 
StelSkyLayerMgrgetSkyImageMgr () const
 
StelAudioMgrgetStelAudioMgr () const
 Get the audio manager.
 
StelActionMgrgetStelActionManager () const
 Get the actions manager to use for managing and editing actions.
 
StelPropertyMgrgetStelPropertyManager () const
 Return the property manager.
 
StelVideoMgrgetStelVideoMgr () const
 Get the video manager.
 
StelCoregetCore () const
 Get the core of the program. More...
 
quint32 getRand () const
 get a pseudo-random integer
 
int getRandBounded (int lowest, int highest) const
 
float getRandF () const
 shortcut to retrieve a random float [0...1).
 
float getRandFp1 () const
 
QNetworkAccessManager * getNetworkAccessManager () const
 Get the common instance of QNetworkAccessManager used in stellarium.
 
void updateI18n ()
 Update translations, font for GUI and sky everywhere in the program.
 
QSettings * getSettings () const
 Return the main configuration options.
 
const QString getCurrentStelStyle () const
 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.
 
qreal getDevicePixelsPerPixel () const
 Get the ratio between real device pixel and "Device Independent Pixel". More...
 
void setDevicePixelsPerPixel (qreal dppp)
 
int getScreenFontSize () const
 Get the fontsize used for screen text.
 
void setScreenFontSize (int s)
 Change screen font size.
 
int getGuiFontSize () const
 Get the principal font size used for GUI panels.
 
void setGuiFontSize (int s)
 change GUI font size.
 
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...
 
void enableBottomStelBarUpdates (bool enable)
 Enable/disable updates to StelBottomBar This may be important for temporary changes which should not cause two costly redraws of the texts. More...
 
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) const
 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 ()
 
static void immediateSave (const QString &key, const QVariant &value)
 Power feature: allow immediate storing of config.ini entries. More...
 
static constexpr int getDefaultGuiFontSize ()
 
static bool isInitialized ()
 

Properties

bool nightMode
 
bool flagShowDecimalDegrees
 
bool flagUseAzimuthFromSouth
 
bool flagUseCCSDesignation
 
bool flagUseFormattingOutput
 
bool flagOverwriteInfoColor
 
Vec3f overwriteInfoColor
 
Vec3f daylightInfoColor
 
int screenFontSize
 
int guiFontSize
 
bool flagImmediateSave
 
QString version
 

Friends

class StelAppGraphicsWidget
 
class StelMainView
 
class StelRootItem
 

Detailed Description

Singleton main Stellarium application class.

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 management 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::StelApp ( StelMainView parent)

Create and initialize the main Stellarium application.

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

◆ addProgressBar()

StelProgressController* StelApp::addProgressBar ( )

Add a progression indicator to the GUI (if applicable).

Returns
a controller which can be used to indicate the current status. The StelApp instance remains the owner of the controller.

◆ enableBottomStelBarUpdates()

void StelApp::enableBottomStelBarUpdates ( bool  enable)

Enable/disable updates to StelBottomBar This may be important for temporary changes which should not cause two costly redraws of the texts.

After program launch, the bottom bar is updating according to signal connections. This means, enclose the temporary state change with 2 calls (false/true) per such method.

◆ ensureGLContextCurrent

void StelApp::ensureGLContextCurrent ( )
slot

Makes sure the correct GL context used for main drawing is made current.

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.

◆ getCommandlineArguments()

static QStringList StelApp::getCommandlineArguments ( )
static

Returns all arguments passed on the command line, together with the contents of the STEL_OPTS environment variable.

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

◆ getCore()

StelCore* StelApp::getCore ( ) const
inline

Get the core of the program.

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

Returns
the StelCore instance of the program

◆ getDefaultFBO

quint32 StelApp::getDefaultFBO ( ) const
inlineslot

Returns the default FBO handle, to be used when StelModule instances want to release their own FBOs.

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.

◆ getDevicePixelsPerPixel()

qreal StelApp::getDevicePixelsPerPixel ( ) const
inline

Get the ratio between real device pixel and "Device Independent Pixel".

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

◆ getFps

float StelApp::getFps ( ) const
inlineslot

Get the current number of frame per second.

Returns
the FPS averaged on the last second

◆ getInstance()

static StelApp& StelApp::getInstance ( )
inlinestatic

Get the StelApp singleton instance.

Returns
the StelApp singleton instance

◆ getLocaleMgr()

StelLocaleMgr& StelApp::getLocaleMgr ( ) const
inline

Get the locale manager to use for i18n & date/time localization.

Returns
the font manager to use for loading fonts.

◆ getLocationMgr()

StelLocationMgr& StelApp::getLocationMgr ( ) const
inline

Get the Location manager to use for managing stored locations.

Returns
the Location manager to use for managing stored locations

◆ getModule()

StelModule* StelApp::getModule ( const QString &  moduleID) const

Get the corresponding module or Q_NULLPTR if can't find it.

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

Returns
the module pointer.

◆ getModuleMgr()

StelModuleMgr& StelApp::getModuleMgr ( ) const
inline

Get the module manager to use for accessing any module loaded in the application.

Returns
the module manager.

◆ getSkyCultureMgr()

StelSkyCultureMgr& StelApp::getSkyCultureMgr ( ) const
inline

Get the sky cultures manager.

Returns
the sky cultures manager

◆ getStelObjectMgr()

StelObjectMgr& StelApp::getStelObjectMgr ( ) const
inline

Get the StelObject manager to use for querying from all stellarium objects.

Returns
the StelObject manager to use for querying from all stellarium objects .

◆ getTextureManager()

StelTextureMgr& StelApp::getTextureManager ( ) const
inline

Get the texture manager to use for loading textures.

Returns
the texture manager to use for loading textures.

◆ immediateSave()

static void StelApp::immediateSave ( const QString &  key,
const QVariant &  value 
)
static

Power feature: allow immediate storing of config.ini entries.

Storing only takes place if property StelApp.flagImmediateSave is set, a flag activated with a manual config.ini entry gui/immediate_save_details=true Items saved with this method still need to be saved as well with ConfigurationDialog::saveAllSettings()!

◆ reportFileDownloadFinished

void StelApp::reportFileDownloadFinished ( QNetworkReply *  reply)
slot

Report that a download occurred.

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

◆ setAppFont

void StelApp::setAppFont ( QFont  font)
slot

Set global application font.

To retrieve, you can use QGuiApplication::font(). emits fontChanged(font)

◆ setGui()

void StelApp::setGui ( StelGuiBase b)
inline

Tell the StelApp instance which GUI is currently being used.

The caller is responsible for destroying the GUI.

◆ setViewportEffect()

void StelApp::setViewportEffect ( const QString &  effectName)

Define the type of viewport effect to use.

Parameters
effectNamemust be one of 'none', 'framebufferOnly', 'sphericMirrorDistorter'