Stellarium  0.18.3
Data Structures | 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>

Data Structures

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

Public Slots

void setFullScreen (bool)
 Set whether fullscreen is activated or not.
 
void focusSky ()
 Return focus to the sky item. To be used when we close a dialog.
 
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.
 
void setFlagInvertScreenShotColors (bool b)
 Set whether colors should be inverted when saving screenshot.
 
bool getFlagOverwriteScreenShots () const
 Get whether existing files are overwritten when saving screenshot.
 
void setFlagOverwriteScreenShots (bool b)
 Set whether existing files are overwritten when saving screenshot.
 
bool getFlagUseCustomScreenshotSize () const
 Get whether custom size should be used for screenshots.
 
void setFlagUseCustomScreenshotSize (bool b)
 Set whether custom size should be used for screenshots.
 
int getCustomScreenshotWidth () const
 Get custom screenshot width.
 
void setCustomScreenshotWidth (int width)
 Set whether custom size should be used for screenshots.
 
int getCustomScreenshotHeight () const
 Get custom screenshot height.
 
void setCustomScreenshotHeight (int height)
 Set whether custom size should be used for screenshots.
 
float getCustomScreenshotMagnification () const
 Get screenshot magnification. More...
 
bool getFlagCursorTimeout () const
 Get the state of the mouse cursor timeout flag.
 
void setFlagCursorTimeout (bool b)
 Get the state of the mouse cursor timeout flag.
 
double getCursorTimeout () const
 Get the mouse cursor timeout in seconds.
 
void setCursorTimeout (double t)
 Set the mouse cursor timeout in seconds.
 
void setMinFps (float m)
 Set the minimum frames per second. More...
 
float getMinFps () const
 Get the current minimum frames per second.
 
void setMaxFps (float m)
 Set the maximum frames per second. More...
 
float getMaxFps () const
 Get the current maximum frames per second.
 
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 setSkyBackgroundColor (Vec3f color)
 Set the sky background color. (Actually forwards to the StelRootItem.) Everything else than black creates a work of art!
 
Vec3f getSkyBackgroundColor () const
 Get the sky background color. (Actually retrieves from the StelRootItem.) Everything else than black creates a work of art!
 

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.
 
void updateIconsRequested ()
 
void flagInvertScreenShotColorsChanged (bool b)
 
void flagOverwriteScreenshotsChanged (bool b)
 
void flagUseCustomScreenshotSizeChanged (bool use)
 
void customScreenshotWidthChanged (int width)
 
void customScreenshotHeightChanged (int height)
 
void skyBackgroundColorChanged (Vec3f color)
 
void flagCursorTimeoutChanged (bool b)
 
void cursorTimeoutChanged (double t)
 

Public Member Functions

 StelMainView (QSettings *settings)
 
void init ()
 Start the main initialization of Stellarium.
 
void deinit ()
 
void initTitleI18n ()
 Set the application title for the current language. More...
 
void deinitGL ()
 Delete openGL textures (to call before the GLContext disappears)
 
QGraphicsWidget * getGuiWidget () const
 Return the parent gui widget, this should be used as parent to all the StelDialog instances. More...
 
QPoint getMousePos () const
 Return mouse position coordinates.
 
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.
 
void glContextDoneCurrent ()
 Releases the main GL context.
 
GLInfo getGLInformation () const
 Returns the information about the GL context, this does not require the context to be active.
 

Static Public Member Functions

static StelMainViewgetInstance ()
 Get the StelMainView singleton instance.
 

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()
 
virtual void resizeEvent (QResizeEvent *event) Q_DECL_OVERRIDE
 Handle window resized events, and change the size of the underlying QGraphicsScene to be the same.
 
virtual void mouseMoveEvent (QMouseEvent *event) Q_DECL_OVERRIDE
 Wake up mouse cursor (if it was hidden)
 

Properties

bool fullScreen
 
bool flagInvertScreenShotColors
 
bool flagOverwriteScreenshots
 
bool flagUseCustomScreenshotSize
 if set to true, screenshot is named exactly screenShotPrefix.png and overwrites existing file
 
int customScreenshotWidth
 if true, the next 2 values are observed for screenshots.
 
int customScreenshotHeight
 used when flagCustomResolutionScreenshots==true
 
bool flagCursorTimeout
 
double cursorTimeout
 
Vec3f skyBackgroundColor
 

Friends

class StelGuiItem
 
class StelRootItem
 
class StelGraphicsScene
 
class NightModeGraphicsEffect
 

Detailed Description

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


Data Structure Documentation

◆ StelMainView::GLInfo

struct StelMainView::GLInfo
Data Fields
QOpenGLFunctions * functions
QOpenGLContext * mainContext
QString renderer
QString vendor

Member Function Documentation

◆ getCustomScreenshotMagnification

float StelMainView::getCustomScreenshotMagnification ( ) const
inlineslot

This should be used by StarMgr, text drawing and other elements which may want to enlarge their output in screenshots to keep them visible.

◆ getGuiWidget()

QGraphicsWidget* StelMainView::getGuiWidget ( ) const
inline

◆ glContext()

QOpenGLContext* StelMainView::glContext ( ) const

◆ initTitleI18n()

void StelMainView::initTitleI18n ( )

This is useful for e.g. chinese.

◆ moveEvent()

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

◆ needsMaxFPS

bool StelMainView::needsMaxFPS ( ) const
slot

This depends on the time the last user event happened.

◆ saveScreenShot

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

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.

◆ screenshotRequested

void StelMainView::screenshotRequested ( void  )
signal

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?

◆ setMaxFps

void StelMainView::setMaxFps ( float  m)
inlineslot
Parameters
mthe new maximum fps setting.

◆ setMinFps

void StelMainView::setMinFps ( float  m)
inlineslot

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.

◆ thereWasAnEvent

void StelMainView::thereWasAnEvent ( )
slot