20 #ifndef _STELMAINGRAPHICSVIEW_HPP_
21 #define _STELMAINGRAPHICSVIEW_HPP_
23 #include <QCoreApplication>
24 #include <QGraphicsView>
26 #include <QOpenGLContext>
31 #define STEL_USE_NEW_OPENGL_WIDGETS 0
33 #if STEL_USE_NEW_OPENGL_WIDGETS
35 class StelQOpenGLWidget;
51 friend class StelGuiItem;
52 friend class StelSkyItem;
54 Q_PROPERTY(
bool fullScreen READ isFullScreen WRITE
setFullScreen)
61 void init(
class QSettings* conf);
94 void saveScreenShot(
const QString& filePrefix=
"stellarium-",
const QString& saveDir=
"",
const bool overwrite=
false);
128 void maxFpsSceneUpdate();
137 virtual void mouseMoveEvent(QMouseEvent* event);
138 virtual void mousePressEvent(QMouseEvent* event);
139 virtual void mouseReleaseEvent(QMouseEvent* event);
140 virtual void keyPressEvent(QKeyEvent* event);
141 virtual void keyReleaseEvent(QKeyEvent* event);
142 virtual void wheelEvent(QWheelEvent* wheelEvent);
143 virtual void moveEvent(QMoveEvent* event);
144 virtual void closeEvent(QCloseEvent* event);
145 virtual void resizeEvent(QResizeEvent* event);
149 virtual void drawBackground(QPainter* painter,
const QRectF &rect);
159 void doScreenshot(
void);
160 void minFpsChanged();
161 void updateNightModeProperty();
165 void startMainLoop();
168 void dumpOpenGLdiagnostics()
const;
171 #if STEL_USE_NEW_OPENGL_WIDGETS
172 void processOpenGLdiagnosticsAndWarnings(QSettings *conf, StelQOpenGLWidget* glWidget)
const;
174 void processOpenGLdiagnosticsAndWarnings(QSettings *conf, StelQGLWidget* glWidget)
const;
180 QGraphicsWidget* rootItem;
181 QGraphicsWidget* skyItem;
182 QGraphicsWidget* guiItem;
183 QGraphicsEffect* nightModeEffect;
186 #if STEL_USE_NEW_OPENGL_WIDGETS
187 StelQOpenGLWidget* glWidget;
189 StelQGLWidget* glWidget;
194 bool flagInvertScreenShotColors;
195 bool flagOverwriteScreenshots;
197 QString screenShotPrefix;
198 QString screenShotDir;
202 bool flagCursorTimeout;
204 double lastEventTimeSec;
207 bool flagMaxFpsUpdatePending;
215 #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.
void updateScene()
Updates the scene and process all events.
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.
virtual void drawBackground(QPainter *painter, const QRectF &rect)
Update the mouse pointer state and schedule next redraw.
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.
Reimplement a QGraphicsView for Stellarium.
void setFullScreen(bool)
Set whether fullscreen is activated or not.
void init(class QSettings *conf)
Start the main initialization of Stellarium.
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...
float getMinFps()
Get the current minimum frames per second.