StelMainGraphicsView.hpp   StelMainView.hpp 
skipping to change at line 23 skipping to change at line 23
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#ifndef _STELMAINGRAPHICSVIEW_HPP_ #ifndef _STELMAINGRAPHICSVIEW_HPP_
#define _STELMAINGRAPHICSVIEW_HPP_ #define _STELMAINGRAPHICSVIEW_HPP_
#include <QGraphicsView> #include "config.h"
#include <QDeclarativeView>
#include <QCoreApplication> #include <QCoreApplication>
#include <QEventLoop> #include <QEventLoop>
class QDeclarativeItem;
class QGLWidget; class QGLWidget;
class QMoveEvent;
class QResizeEvent; class QResizeEvent;
class StelGuiBase; class StelGuiBase;
class StelMainScriptAPIProxy;
class StelScriptMgr;
class StelQGLWidget; class StelQGLWidget;
class QMoveEvent;
//! @class StelMainGraphicsView //! @class StelMainView
//! Reimplement a QGraphicsView for Stellarium. //! Reimplement a QGraphicsView for Stellarium.
//! It is the class creating the main StelApp instance as well as the main //! It is the class creating the singleton GL Widget, the main StelApp inst
GUI. ance as well as the main GUI.
class StelMainGraphicsView : public QGraphicsView class StelMainView : public QDeclarativeView
{ {
Q_OBJECT friend class StelGuiItem;
friend class StelSkyItem;
Q_OBJECT
Q_PROPERTY(bool fullScreen READ isFullScreen WRITE setFullScreen)
public: public:
StelMainGraphicsView(QWidget* parent); StelMainView(QWidget* parent = NULL);
virtual ~StelMainGraphicsView(); virtual ~StelMainView();
//! Start the main initialization of Stellarium //! Start the main initialization of Stellarium
void init(class QSettings* conf); void init(class QSettings* conf);
//! Get the StelMainGraphicsView singleton instance.
static StelMainGraphicsView& getInstance() {Q_ASSERT(singleton); ret
urn *singleton;}
//! Delete textures (to call before the renderer disappears)
void deinit(); void deinit();
//! Return the QGraphicsWidget encapsulating the Stellarium main sky //! Set the application title for the current language.
view. //! This is useful for e.g. chinese.
//! Use its layout if you want to add widget on the top of the main void initTitleI18n();
sky view.
class StelAppGraphicsWidget* getStelAppGraphicsWidget() {return main //! Get the StelMainView singleton instance.
SkyItem;} static StelMainView& getInstance() {Q_ASSERT(singleton); return *sin
gleton;}
//! Return the top level QGraphicsWidget which contains the layout c
ontaining the Stellarium main sky view. //! Delete openGL textures (to call before the GLContext disappears)
//! Use its layout if you want to add widget on the side of the main void deinitGL();
sky view. //! Return focus to the sky item. To be used when we close a dialog
QGraphicsWidget* getTopLevelGraphicsWidget() {return backItem;} .
void focusSky();
#ifndef DISABLE_SCRIPTING //! Return the parent gui widget, this should be used as parent to a
//! Get the script API proxy (for signal handling) ll
StelMainScriptAPIProxy* getMainScriptAPIProxy() {return scriptAPIPro //! the StelDialog instances.
xy;} QGraphicsWidget* getGuiWidget() const {return guiWidget;}
//! Get the script manager
StelScriptMgr& getScriptMgr() {return *scriptMgr;}
#endif
public slots: public slots:
//! Set whether fullscreen is activated or not
void setFullScreen(bool);
//////////////////////////////////////////////////////////////////// /////// //////////////////////////////////////////////////////////////////// ///////
// Specific methods // Specific methods
//! Save a screen shot. //! Save a screen shot.
//! The format of the file, and hence the filename extension //! The format of the file, and hence the filename extension
//! depends on the architecture and build type. //! depends on the architecture and build type.
//! @arg filePrefix changes the beginning of the file name //! @arg filePrefix changes the beginning of the file name
//! @arg shotDir changes the directory where the screenshot is saved //! @arg shotDir changes the directory where the screenshot is saved
//! If shotDir is "" then StelFileMgr::getScreenshotDir() will be us ed //! If shotDir is "" then StelFileMgr::getScreenshotDir() will be us ed
void saveScreenShot(const QString& filePrefix="stellarium-", const Q String& saveDir=""); void saveScreenShot(const QString& filePrefix="stellarium-", const Q String& saveDir="");
skipping to change at line 107 skipping to change at line 111
//! @param m the new minimum fps setting. //! @param m the new minimum fps setting.
void setMinFps(float m) {minfps=m; minFpsChanged();} void setMinFps(float m) {minfps=m; minFpsChanged();}
//! Get the current minimum frames per second. //! Get the current minimum frames per second.
float getMinFps() {return minfps;} float getMinFps() {return minfps;}
//! Set the maximum frames per second. //! Set the maximum frames per second.
//! @param m the new maximum fps setting. //! @param m the new maximum fps setting.
void setMaxFps(float m) {maxfps = m;} void setMaxFps(float m) {maxfps = m;}
//! Get the current maximum frames per second. //! Get the current maximum frames per second.
float getMaxFps() {return maxfps;} float getMaxFps() {return maxfps;}
void maxFpsSceneUpdate();
//! Updates the scene and process all events //! Updates the scene and process all events
void updateScene() { void updateScene();
scene()->update();
} //! Notify that an event was handled by the program and therefore th
e
//! FPS should be maximized for a couple of seconds.
void thereWasAnEvent();
protected: protected:
virtual void resizeEvent(QResizeEvent* event);
virtual void mouseMoveEvent(QMouseEvent* event); virtual void mouseMoveEvent(QMouseEvent* event);
virtual void mousePressEvent(QMouseEvent* event); virtual void mousePressEvent(QMouseEvent* event);
virtual void mouseReleaseEvent(QMouseEvent* event); virtual void mouseReleaseEvent(QMouseEvent* event);
virtual void keyPressEvent(QKeyEvent* event); virtual void keyPressEvent(QKeyEvent* event);
virtual void keyReleaseEvent(QKeyEvent* event); virtual void keyReleaseEvent(QKeyEvent* event);
virtual void wheelEvent(QWheelEvent* wheelEvent); virtual void wheelEvent(QWheelEvent* wheelEvent);
virtual void moveEvent(QMoveEvent* event);
virtual void closeEvent(QCloseEvent* event);
//! Update the mouse pointer state and schedule next redraw. //! Update the mouse pointer state and schedule next redraw.
//! This method is called automatically by Qt. //! This method is called automatically by Qt.
virtual void drawBackground(QPainter* painter, const QRectF &rect); virtual void drawBackground(QPainter* painter, const QRectF &rect);
signals: signals:
//! emitted when saveScreenShot is requested with saveScreenShot(). //! emitted when saveScreenShot is requested with saveScreenShot().
//! doScreenshot() does the actual work (it has to do it in the main //! doScreenshot() does the actual work (it has to do it in the main
//! thread, where as saveScreenShot() might get called from another one. //! thread, where as saveScreenShot() might get called from another one.
void screenshotRequested(void); void screenshotRequested(void);
skipping to change at line 141 skipping to change at line 149
private slots: private slots:
// Do the actual screenshot generation in the main thread with this method. // Do the actual screenshot generation in the main thread with this method.
void doScreenshot(void); void doScreenshot(void);
void minFpsChanged(); void minFpsChanged();
private: private:
//! Start the display loop //! Start the display loop
void startMainLoop(); void startMainLoop();
//! The StelMainGraphicsView singleton QString getSupportedOpenGLVersion() const;
static StelMainGraphicsView* singleton;
QGraphicsWidget* backItem;
class StelAppGraphicsWidget* mainSkyItem;
//! Handles all rendering (e.g. GL) functionality.
class StelRenderer* renderer;
StelGuiBase* gui; //! The StelMainView singleton
static StelMainView* singleton;
#ifndef DISABLE_SCRIPTING //! This is created by the StelGuiItem, but need to be publicly
// The script API proxy object (for bridging threads) //! accessible so that StelDialog instances can reparent to it.
StelMainScriptAPIProxy* scriptAPIProxy; QGraphicsWidget *guiWidget;
QDeclarativeItem* skyItem;
// The script manager based on Qt script engine
StelScriptMgr* scriptMgr;
#endif
bool wasDeinit; //! The openGL window
StelQGLWidget* glWidget;
StelGuiBase* gui;
class StelApp* stelApp;
bool flagInvertScreenShotColors; bool flagInvertScreenShotColors;
QString screenShotPrefix; QString screenShotPrefix;
QString screenShotDir; QString screenShotDir;
// Number of second before the mouse cursor disappears // Number of second before the mouse cursor disappears
float cursorTimeout; float cursorTimeout;
bool flagCursorTimeout; bool flagCursorTimeout;
//! Notify that an event was handled by the program and therefore th
e
//! FPS should be maximized for a couple of seconds.
void thereWasAnEvent();
double lastEventTimeSec; double lastEventTimeSec;
QTimer* minFpsTimer; QTimer* minFpsTimer;
bool flagMaxFpsUpdatePending;
//! The minimum desired frame rate in frame per second. //! The minimum desired frame rate in frame per second.
float minfps; float minfps;
//! The maximum desired frame rate in frame per second. //! The maximum desired frame rate in frame per second.
float maxfps; float maxfps;
}; };
#endif // _STELMAINGRAPHICSVIEW_HPP_ #endif // _STELMAINGRAPHICSVIEW_HPP_
 End of changes. 22 change blocks. 
62 lines changed or deleted 58 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/