20 #ifndef _STELMAINGRAPHICSVIEW_HPP_ 21 #define _STELMAINGRAPHICSVIEW_HPP_ 23 #include <QCoreApplication> 24 #include <QGraphicsView> 26 #include <QOpenGLContext> 28 #ifdef OPENGL_DEBUG_LOGGING 29 #include <QOpenGLDebugMessage> 33 class StelGraphicsScene;
45 friend class StelGuiItem;
46 friend class StelRootItem;
47 friend class StelGraphicsScene;
48 friend class NightModeGraphicsEffect;
50 Q_PROPERTY(
bool fullScreen READ isFullScreen WRITE
setFullScreen NOTIFY fullScreenChanged)
58 QOpenGLContext* mainContext;
59 QOpenGLFunctions* functions;
115 void saveScreenShot(
const QString& filePrefix=
"stellarium-",
const QString& saveDir=
"",
const bool overwrite=
false);
140 void setMinFps(
float m) {minfps=m; minFpsTimer->setInterval(1000/minfps);}
167 virtual void moveEvent(QMoveEvent* event) Q_DECL_OVERRIDE;
169 virtual void closeEvent(QCloseEvent* event) Q_DECL_OVERRIDE;
172 virtual void resizeEvent(QResizeEvent* event) Q_DECL_OVERRIDE;
180 void fullScreenChanged(
bool b);
186 void updateIconsRequested();
190 void doScreenshot(
void);
192 #ifdef OPENGL_DEBUG_LOGGING 193 void logGLMessage(
const QOpenGLDebugMessage& debugMessage);
194 void contextDestroyed();
196 void updateNightModeProperty(
bool b);
198 void reloadShaders();
206 QSurfaceFormat getDesiredGLFormat()
const;
208 void dumpOpenGLdiagnostics()
const;
211 void processOpenGLdiagnosticsAndWarnings(QSettings *conf, QOpenGLContext* context)
const;
218 QSettings* configuration;
220 class StelRootItem* rootItem;
221 QGraphicsWidget* guiItem;
222 QGraphicsEffect* nightModeEffect;
226 StelGLWidget* glWidget;
228 StelGraphicsScene* stelScene;
234 bool flagInvertScreenShotColors;
235 bool flagOverwriteScreenshots;
237 QString screenShotPrefix;
238 QString screenShotDir;
242 bool flagCursorTimeout;
244 bool flagUseButtonsBackground;
246 double lastEventTimeSec;
254 #ifdef OPENGL_DEBUG_LOGGING 255 QOpenGLDebugLogger* glLogger;
260 #endif // _STELMAINGRAPHICSVIEW_HPP_ void focusSky()
Return focus to the sky item. To be used when we close a dialog.
void setFlagCursorTimeout(bool b)
Get the state of the mouse cursor timeout flag.
bool getFlagOverwriteScreenShots() const
Get whether existing files are overwritten when saving screenshot.
void reloadShadersRequested()
Emitted when the "Reload shaders" action is perfomed Interested objects should subscribe to this sign...
QPoint getMousePos()
Return mouse position coordinates.
void setFlagUseButtonsBackground(bool b)
Set the state of the flag of usage background for GUI buttons.
void setCursorTimeout(float t)
Set the mouse cursor timeout in seconds.
Contains some basic info about the OpenGL context used.
void setFlagOverwriteScreenShots(bool b)
Set whether existing files are overwritten when saving screenshot.
void setMinFps(float m)
Set the minimum frames per second.
void screenshotRequested(void)
emitted when saveScreenShot is requested with saveScreenShot().
static StelMainView & getInstance()
Get the StelMainView singleton instance.
void initTitleI18n()
Set the application title for the current language.
Abstract class defining the base interface for all GUIs.
void glContextMakeCurrent()
Make the main GL context (the one returned from glContext()) current on the main view surface...
virtual void moveEvent(QMoveEvent *event) Q_DECL_OVERRIDE
Hack to determine current monitor pixel ratio.
bool needsMaxFPS() const
Determines if we should render as fast as possible, or limit the FPS.
bool getFlagInvertScreenShotColors() const
Get whether colors are inverted when saving screenshot.
void saveScreenShot(const QString &filePrefix="stellarium-", const QString &saveDir="", const bool overwrite=false)
Save a screen shot.
float getCursorTimeout() const
Get the mouse cursor timeout in seconds.
bool getFlagCursorTimeout()
Get the state of the mouse cursor timeout flag.
void setMaxFps(float m)
Set the maximum frames per second.
void glContextDoneCurrent()
Releases the main GL context.
Reimplement a QGraphicsView for Stellarium.
void setFullScreen(bool)
Set whether fullscreen is activated or not.
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...
GLInfo getGLInformation() const
Returns the information about the GL context, this does not require the context to be active...
void deinitGL()
Delete openGL textures (to call before the GLContext disappears)
void setFlagInvertScreenShotColors(bool b)
Set whether colors should be inverted when saving screenshot.
float getMaxFps()
Get the current maximum frames per second.
QGraphicsWidget * getGuiWidget() const
Return the parent gui widget, this should be used as parent to all the StelDialog instances...
Singleton main Stellarium application class.
bool getFlagUseButtonsBackground()
Get the state of the flag of usage background for GUI buttons.
void thereWasAnEvent()
Notify that an event was handled by the program and therefore the FPS should be maximized for a coupl...
QOpenGLContext * glContext() const
Returns the main application OpenGL context, which should be used for all drawing Stellarium does...
float getMinFps()
Get the current minimum frames per second.
void init()
Start the main initialization of Stellarium.