Stellarium  0.90.0
List of all members | Classes | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Properties | Friends
StelMainView Class Reference

Reimplement a QGraphicsView for Stellarium. More...

#include <StelMainView.hpp>

+ Inheritance diagram for StelMainView:
+ Collaboration diagram for StelMainView:

Classes

struct  GLInfo
 Contains some basic info about the OpenGL context used. More...
 

Public Slots

void setFullScreen (bool)
 Set whether fullscreen is activated or not. More...
 
void focusSky ()
 Return focus to the sky item. To be used when we close a dialog. More...
 
void saveScreenShot (const QString &filePrefix="stellarium-", const QString &saveDir="", const bool overwrite=false)
 Save a screen shot. More...
 
bool getFlagInvertScreenShotColors () const
 Get whether colors are inverted when saving screenshot. More...
 
void setFlagInvertScreenShotColors (bool b)
 Set whether colors should be inverted when saving screenshot. More...
 
bool getFlagOverwriteScreenShots () const
 Get whether existing files are overwritten when saving screenshot. More...
 
void setFlagOverwriteScreenShots (bool b)
 Set whether existing files are overwritten when saving screenshot. More...
 
bool getFlagCursorTimeout ()
 Get the state of the mouse cursor timeout flag. More...
 
float getCursorTimeout () const
 Get the mouse cursor timeout in seconds. More...
 
void setFlagCursorTimeout (bool b)
 Get the state of the mouse cursor timeout flag. More...
 
void setCursorTimeout (float t)
 Set the mouse cursor timeout in seconds. More...
 
void setMinFps (float m)
 Set the minimum frames per second. More...
 
float getMinFps ()
 Get the current minimum frames per second. More...
 
void setMaxFps (float m)
 Set the maximum frames per second. More...
 
float getMaxFps ()
 Get the current maximum frames per second. More...
 
void thereWasAnEvent ()
 Notify that an event was handled by the program and therefore the FPS should be maximized for a couple of seconds. More...
 
bool needsMaxFPS () const
 Determines if we should render as fast as possible, or limit the FPS. More...
 
void setFlagUseButtonsBackground (bool b)
 Set the state of the flag of usage background for GUI buttons. More...
 
bool getFlagUseButtonsBackground ()
 Get the state of the flag of usage background for GUI buttons. More...
 

Signals

void screenshotRequested (void)
 emitted when saveScreenShot is requested with saveScreenShot(). More...
 
void fullScreenChanged (bool b)
 
void reloadShadersRequested ()
 Emitted when the "Reload shaders" action is perfomed Interested objects should subscribe to this signal and reload their shaders when this is emitted. More...
 
void updateIconsRequested ()
 

Public Member Functions

 StelMainView (QSettings *settings)
 
void init ()
 Start the main initialization of Stellarium. More...
 
void deinit ()
 
void initTitleI18n ()
 Set the application title for the current language. More...
 
void deinitGL ()
 Delete openGL textures (to call before the GLContext disappears) More...
 
QGraphicsWidget * getGuiWidget () const
 Return the parent gui widget, this should be used as parent to all the StelDialog instances. More...
 
QPoint getMousePos ()
 Return mouse position coordinates. More...
 
QOpenGLContext * glContext () const
 Returns the main application OpenGL context, which should be used for all drawing Stellarium does. More...
 
void glContextMakeCurrent ()
 Make the main GL context (the one returned from glContext()) current on the main view surface. More...
 
void glContextDoneCurrent ()
 Releases the main GL context. More...
 
GLInfo getGLInformation () const
 Returns the information about the GL context, this does not require the context to be active. More...
 

Static Public Member Functions

static StelMainViewgetInstance ()
 Get the StelMainView singleton instance. More...
 

Protected Member Functions

virtual void moveEvent (QMoveEvent *event) Q_DECL_OVERRIDE
 Hack to determine current monitor pixel ratio. More...
 
virtual void closeEvent (QCloseEvent *event) Q_DECL_OVERRIDE
 Handle window closed event, calling StelApp::quit() More...
 
virtual void resizeEvent (QResizeEvent *event) Q_DECL_OVERRIDE
 Handle window resized events, and change the size of the underlying QGraphicsScene to be the same. More...
 

Properties

bool fullScreen
 

Friends

class StelGuiItem
 
class StelRootItem
 
class StelGraphicsScene
 
class NightModeGraphicsEffect
 

Detailed Description

Reimplement a QGraphicsView for Stellarium.

It is the class creating the singleton GL Widget, the main StelApp instance as well as the main GUI.

Definition at line 43 of file StelMainView.hpp.

Member Function Documentation

virtual void StelMainView::closeEvent ( QCloseEvent *  event)
protectedvirtual

Handle window closed event, calling StelApp::quit()

void StelMainView::deinitGL ( )

Delete openGL textures (to call before the GLContext disappears)

void StelMainView::focusSky ( )
slot

Return focus to the sky item. To be used when we close a dialog.

float StelMainView::getCursorTimeout ( ) const
inlineslot

Get the mouse cursor timeout in seconds.

Definition at line 130 of file StelMainView.hpp.

bool StelMainView::getFlagCursorTimeout ( )
inlineslot

Get the state of the mouse cursor timeout flag.

Definition at line 128 of file StelMainView.hpp.

bool StelMainView::getFlagInvertScreenShotColors ( ) const
inlineslot

Get whether colors are inverted when saving screenshot.

Definition at line 118 of file StelMainView.hpp.

bool StelMainView::getFlagOverwriteScreenShots ( ) const
inlineslot

Get whether existing files are overwritten when saving screenshot.

Definition at line 123 of file StelMainView.hpp.

bool StelMainView::getFlagUseButtonsBackground ( )
inlineslot

Get the state of the flag of usage background for GUI buttons.

Definition at line 162 of file StelMainView.hpp.

GLInfo StelMainView::getGLInformation ( ) const
inline

Returns the information about the GL context, this does not require the context to be active.

Definition at line 97 of file StelMainView.hpp.

QGraphicsWidget* StelMainView::getGuiWidget ( ) const
inline

Return the parent gui widget, this should be used as parent to all the StelDialog instances.

Definition at line 81 of file StelMainView.hpp.

static StelMainView& StelMainView::getInstance ( )
inlinestatic

Get the StelMainView singleton instance.

Definition at line 74 of file StelMainView.hpp.

float StelMainView::getMaxFps ( )
inlineslot

Get the current maximum frames per second.

Definition at line 148 of file StelMainView.hpp.

float StelMainView::getMinFps ( )
inlineslot

Get the current minimum frames per second.

Definition at line 142 of file StelMainView.hpp.

QPoint StelMainView::getMousePos ( )

Return mouse position coordinates.

QOpenGLContext* StelMainView::glContext ( ) const

Returns the main application OpenGL context, which should be used for all drawing Stellarium does.

See also
glContextMakeCurrent()
glContextDoneCurrent()
void StelMainView::glContextDoneCurrent ( )

Releases the main GL context.

void StelMainView::glContextMakeCurrent ( )

Make the main GL context (the one returned from glContext()) current on the main view surface.

void StelMainView::init ( )

Start the main initialization of Stellarium.

void StelMainView::initTitleI18n ( )

Set the application title for the current language.

This is useful for e.g. chinese.

virtual void StelMainView::moveEvent ( QMoveEvent *  event)
protectedvirtual

Hack to determine current monitor pixel ratio.

bool StelMainView::needsMaxFPS ( ) const
slot

Determines if we should render as fast as possible, or limit the FPS.

This depends on the time the last user event happened.

void StelMainView::reloadShadersRequested ( )
signal

Emitted when the "Reload shaders" action is perfomed Interested objects should subscribe to this signal and reload their shaders when this is emitted.

virtual void StelMainView::resizeEvent ( QResizeEvent *  event)
protectedvirtual

Handle window resized events, and change the size of the underlying QGraphicsScene to be the same.

void StelMainView::saveScreenShot ( const QString &  filePrefix = "stellarium-",
const QString &  saveDir = "",
const bool  overwrite = false 
)
slot

Save a screen shot.

The format of the file, and hence the filename extension depends on the architecture and build type.

  • filePrefix changes the beginning of the file name
  • saveDir changes the directory where the screenshot is saved If saveDir is "" then StelFileMgr::getScreenshotDir() will be used
  • overwrite if true,
  • filePrefix is used as filename, and existing file will be overwritten.
void StelMainView::screenshotRequested ( void  )
signal

emitted when saveScreenShot is requested with saveScreenShot().

doScreenshot() does the actual work (it has to do it in the main thread, where as saveScreenShot() might get called from another one.

Remarks
FS: is threaded access here even a possibility anymore, or a remnant of older code?
void StelMainView::setCursorTimeout ( float  t)
inlineslot

Set the mouse cursor timeout in seconds.

Definition at line 134 of file StelMainView.hpp.

void StelMainView::setFlagCursorTimeout ( bool  b)
inlineslot

Get the state of the mouse cursor timeout flag.

Definition at line 132 of file StelMainView.hpp.

void StelMainView::setFlagInvertScreenShotColors ( bool  b)
inlineslot

Set whether colors should be inverted when saving screenshot.

Definition at line 120 of file StelMainView.hpp.

void StelMainView::setFlagOverwriteScreenShots ( bool  b)
inlineslot

Set whether existing files are overwritten when saving screenshot.

Definition at line 125 of file StelMainView.hpp.

void StelMainView::setFlagUseButtonsBackground ( bool  b)
inlineslot

Set the state of the flag of usage background for GUI buttons.

Definition at line 160 of file StelMainView.hpp.

void StelMainView::setFullScreen ( bool  )
slot

Set whether fullscreen is activated or not.

void StelMainView::setMaxFps ( float  m)
inlineslot

Set the maximum frames per second.

Parameters
mthe new maximum fps setting.

Definition at line 146 of file StelMainView.hpp.

void StelMainView::setMinFps ( float  m)
inlineslot

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.

Parameters
mthe new minimum fps setting.

Definition at line 140 of file StelMainView.hpp.

void StelMainView::thereWasAnEvent ( )
slot

Notify that an event was handled by the program and therefore the FPS should be maximized for a couple of seconds.


The documentation for this class was generated from the following file: