StelMainGraphicsView.hpp   StelMainGraphicsView.hpp 
skipping to change at line 27 skipping to change at line 27
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA.
*/ */
#ifndef _STELMAINGRAPHICSVIEW_HPP_ #ifndef _STELMAINGRAPHICSVIEW_HPP_
#define _STELMAINGRAPHICSVIEW_HPP_ #define _STELMAINGRAPHICSVIEW_HPP_
#include <QGraphicsView> #include <QGraphicsView>
class QGLWidget; class QGLWidget;
class QResizeEvent; class QResizeEvent;
class StelGuiBase;
class StelMainScriptAPIProxy;
class StelScriptMgr;
class StelQGLWidget;
//! @class StelMainGraphicsView //! @class StelMainGraphicsView
//! Reimplement a QGraphicsView for Stellarium. //! Reimplement a QGraphicsView for Stellarium.
//! It is the class creating the singleton GL Widget, the main StelApp inst ance as well as the main GUI. //! It is the class creating the singleton GL Widget, the main StelApp inst ance as well as the main GUI.
class StelMainGraphicsView : public QGraphicsView class StelMainGraphicsView : public QGraphicsView
{ {
Q_OBJECT Q_OBJECT
public: public:
StelMainGraphicsView(QWidget* parent, int argc, char** argv); StelMainGraphicsView(QWidget* parent);
virtual ~StelMainGraphicsView(); virtual ~StelMainGraphicsView();
//! Start the main initialization of Stellarium //! Start the main initialization of Stellarium
void init(); void init(class QSettings* conf);
//! Get the StelMainGraphicsView singleton instance. //! Get the StelMainGraphicsView singleton instance.
static StelMainGraphicsView& getInstance() {Q_ASSERT(singleton); ret urn *singleton;} static StelMainGraphicsView& getInstance() {Q_ASSERT(singleton); ret urn *singleton;}
//! Get the main QGLWidget //! Get the main QGLWidget
//! @deprecated don't use that //! @deprecated don't use that.
QGLWidget* getOpenGLWin() {return glWidget;} QGLWidget* getOpenGLWin() {return (QGLWidget*)glWidget;}
//! Swap openGL buffer.
//! @deprecated don't use that.
void swapBuffer();
void makeGLContextCurrent();
//! Delete openGL textures (to call before the GLContext disappears) //! Delete openGL textures (to call before the GLContext disappears)
void deinitGL(); void deinitGL();
//! Add a new progress bar in the lower right corner of the screen. //! Return the QGraphicsWidget encapsulating the Stellarium main sky
//! When the progress bar is not used anymore, just delete it. view.
//! @return a pointer to the progress bar //! Use its layout if you want to add widget on the top of the main
class QProgressBar* addProgressBar(); sky view.
class StelAppGraphicsWidget* getStelAppGraphicsWidget() {return main
//! Activate all the QActions associated to the widget SkyItem;}
void activateKeyActions(bool b);
//! Return the top level QGraphicsWidget which contains the layout c
ontaining the Stellarium main sky view.
//! Use its layout if you want to add widget on the side of the main
sky view.
QGraphicsWidget* getTopLevelGraphicsWidget() {return backItem;}
//! Get the script API proxy (for signal handling)
StelMainScriptAPIProxy* getMainScriptAPIProxy() {return scriptAPIPro
xy;}
//! Get the script manager
StelScriptMgr& getScriptMgr() {return *scriptMgr;}
public slots: public slots:
//////////////////////////////////////////////////////////////////// /////// //////////////////////////////////////////////////////////////////// ///////
// 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="");
//! Get whether colors are inverted when saving screenshot //! Get whether colors are inverted when saving screenshot
bool getFlagInvertScreenShotColors() const {return flagInvertScreenS hotColors;} bool getFlagInvertScreenShotColors() const {return flagInvertScreenS hotColors;}
//! Set whether colors should be inverted when saving screenshot //! Set whether colors should be inverted when saving screenshot
void setFlagInvertScreenShotColors(bool b) {flagInvertScreenShotColo rs=b;} void setFlagInvertScreenShotColors(bool b) {flagInvertScreenShotColo rs=b;}
//! Get the state of the mouse cursor timeout flag
bool getFlagCursorTimeout() {return flagCursorTimeout;}
//! Get the mouse cursor timeout in seconds
float getCursorTimeout() const {return cursorTimeout;}
//! Get the state of the mouse cursor timeout flag
void setFlagCursorTimeout(bool b) {flagCursorTimeout=b;}
//! Set the mouse cursor timeout in seconds
void setCursorTimeout(float t) {cursorTimeout=t;}
//! Set the minimum frames per second. Usually this minimum will be
switched to after there are no
//! user events for some seconds to save power. However, if can be u
seful to set this to a high
//! value to improve playing smoothness in scripts.
//! @param m the new minimum fps setting.
void setMinFps(float m) {minfps=m; minFpsChanged();}
//! Get the current minimum frames per second.
float getMinFps() {return minfps;}
//! Set the maximum frames per second.
//! @param m the new maximum fps setting.
void setMaxFps(float m) {maxfps = m;}
//! Get the current maximum frames per second.
float getMaxFps() {return maxfps;}
protected: protected:
virtual void resizeEvent(QResizeEvent* event); virtual void resizeEvent(QResizeEvent* event);
virtual void mouseMoveEvent(QMouseEvent* event);
virtual void mousePressEvent(QMouseEvent* event);
virtual void mouseReleaseEvent(QMouseEvent* event);
virtual void keyPressEvent(QKeyEvent* event);
virtual void keyReleaseEvent(QKeyEvent* event);
virtual void wheelEvent(QWheelEvent* wheelEvent);
//! Update the mouse pointer state and schedule next redraw.
//! This method is called automatically by Qt.
virtual void drawBackground(QPainter* painter, const QRectF &rect);
virtual void drawForeground(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);
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();
private: private:
//! The StelMainWindow singleton //! Start the display loop
void startMainLoop();
//! The StelMainGraphicsView singleton
static StelMainGraphicsView* singleton; static StelMainGraphicsView* singleton;
QGraphicsWidget* backItem;
class StelAppGraphicsWidget* mainSkyItem;
//! The openGL window //! The openGL window
QGLWidget* glWidget; StelQGLWidget* glWidget;
class StelApp* stelApp;
StelGuiBase* gui;
// The script API proxy object (for bridging threads)
StelMainScriptAPIProxy* scriptAPIProxy;
// The script manager based on Qt script engine
StelScriptMgr* scriptMgr;
bool wasDeinit; bool wasDeinit;
bool flagInvertScreenShotColors; bool flagInvertScreenShotColors;
QString screenShotPrefix; QString screenShotPrefix;
QString screenShotDir; QString screenShotDir;
// Number of second before the mouse cursor disappears
float cursorTimeout;
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;
QTime* qtime;
QTimer* minFpsTimer;
//! The minimum desired frame rate in frame per second.
float minfps;
//! The maximum desired frame rate in frame per second.
float maxfps;
}; };
#endif // _STELMAINGRAPHICSVIEW_HPP_ #endif // _STELMAINGRAPHICSVIEW_HPP_
 End of changes. 12 change blocks. 
14 lines changed or deleted 101 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/