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);}
162 virtual void moveEvent(QMoveEvent* event) Q_DECL_OVERRIDE;
164 virtual void closeEvent(QCloseEvent* event) Q_DECL_OVERRIDE;
167 virtual void resizeEvent(QResizeEvent* event) Q_DECL_OVERRIDE;
175 void fullScreenChanged(
bool b);
178 void doScreenshot(
void);
180 #ifdef OPENGL_DEBUG_LOGGING 181 void logGLMessage(
const QOpenGLDebugMessage& debugMessage);
182 void contextDestroyed();
184 void updateNightModeProperty(
bool b);
192 QSurfaceFormat getDesiredGLFormat()
const;
194 void dumpOpenGLdiagnostics()
const;
197 void processOpenGLdiagnosticsAndWarnings(QSettings *conf, QOpenGLContext* context)
const;
204 QSettings* configuration;
206 class StelRootItem* rootItem;
207 QGraphicsWidget* guiItem;
208 QGraphicsEffect* nightModeEffect;
212 StelGLWidget* glWidget;
214 StelGraphicsScene* stelScene;
220 bool flagInvertScreenShotColors;
221 bool flagOverwriteScreenshots;
223 QString screenShotPrefix;
224 QString screenShotDir;
228 bool flagCursorTimeout;
230 double lastEventTimeSec;
238 #ifdef OPENGL_DEBUG_LOGGING 239 QOpenGLDebugLogger* glLogger;
244 #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.
QPoint getMousePos()
Return mouse position coordinates.
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.
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.