Stellarium  1.2
Data Structures | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Properties | Friends
StelMainView Class Reference

#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...
 
void setScreenshotFormat (const QString filetype)
 
QString getScreenshotFormat () const
 
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 getFlagScreenshotDateFileName () const
 Get whether date and time should be used for screenshot naming.
 
void setFlagScreenshotDateFileName (bool b)
 Set whether date and time should be used for screenshot naming.
 
void setScreenshotFileMask (const QString filemask)
 
QString getScreenshotFileMask () const
 
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 custom width for screenshots.
 
int getCustomScreenshotHeight () const
 Get custom screenshot height.
 
void setCustomScreenshotHeight (int height)
 Set custom height for screenshots.
 
int getScreenshotDpi () const
 Get screenshot DPI. This is only an entry in the screenshot image metadata. The raster content is not influenced.
 
void setScreenshotDpi (int dpi)
 Set screenshot DPI. This is only an entry in the screenshot image metadata. The raster content is not influenced.
 
float getCustomScreenshotMagnification () const
 Get screenshot magnification. More...
 
bool getFlagCursorTimeout () const
 Get the state of the mouse cursor timeout flag.
 
void setFlagCursorTimeout (bool b)
 Set 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.
 
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 sizeChanged (const QSize &sz)
 emitted when window size has changed
 
void screenshotRequested (void)
 emitted when saveScreenShot is requested with saveScreenShot(). More...
 
void fullScreenChanged (bool b)
 
void reloadShadersRequested ()
 Emitted when the "Reload shaders" action is performed 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 flagScreenshotDateFileNameChanged (bool flag)
 
void customScreenshotWidthChanged (int width)
 
void customScreenshotHeightChanged (int height)
 
void screenshotDpiChanged (int dpi)
 
void screenshotFormatChanged (QString format)
 
void screenshotFileMaskChanged (QString format)
 
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.
 
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.
 
const GLInfogetGLInformation () 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.
 
static QSurfaceFormat getDesiredGLFormat (QSettings *configuration)
 Returns the desired OpenGL format settings.
 

Protected Member Functions

void moveEvent (QMoveEvent *event) override
 Hack to determine current monitor pixel ratio. More...
 
void closeEvent (QCloseEvent *event) override
 Handle window closed event, calling StelApp::quit()
 
void resizeEvent (QResizeEvent *event) override
 Handle window resized events, and change the size of the underlying QGraphicsScene to be the same.
 
void mouseMoveEvent (QMouseEvent *event) override
 Wake up mouse cursor (if it was hidden)
 
bool eventFilter (QObject *obj, QEvent *event) override
 

Properties

bool fullScreen
 
bool flagInvertScreenShotColors
 
bool flagScreenshotDateFileName
 
QString screenShotFileMask
 file type like "png" or "jpg".
 
bool flagOverwriteScreenshots
 if set to true, screenshot is named by date and time format
 
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
 
int screenshotDpi
 used when flagCustomResolutionScreenshots==true
 
QString screenShotFormat
 
bool flagCursorTimeout
 
double cursorTimeout
 
Vec3f skyBackgroundColor
 

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.


Data Structure Documentation

◆ StelMainView::GLInfo

struct StelMainView::GLInfo
Data Fields
QOpenGLFunctions * functions
bool isCoreProfile
bool isGLES
QOpenGLContext * mainContext
GLint maxAnisotropy
QString renderer
bool supportsLuminanceTextures
QSurface * surface
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.

◆ glContext()

QOpenGLContext* StelMainView::glContext ( ) const

◆ initTitleI18n()

void StelMainView::initTitleI18n ( )

This is useful for e.g. chinese.

◆ moveEvent()

void StelMainView::moveEvent ( QMoveEvent *  event)
overrideprotected

◆ 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.
    Note
    To set file type, use setScreenshotFormat() first.

◆ 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.

◆ setScreenshotFormat

void StelMainView::setScreenshotFormat ( const QString  filetype)
slot
  • filetype is the preferred file type (ending) like "png", "jpg", "bmp" etc. The supported filetypes depend on the underlying Qt version. The most popular may be PNG, JPG/JPEG, BMP, TIF (LZW compressed), TIFF (uncompressed), WEBP, but as of Qt5.12, we also have ICO (for thumbnails), PBM (Portable Bitmap), PGM (Portable Graymap), PPM (Portable Pixmap), XBM (X Bitmap) and XPM (X Pixmap).