StelAppGraphicsScene.hpp   StelAppGraphicsScene.hpp 
skipping to change at line 25 skipping to change at line 25
* 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., 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 _STELAPPGRAPHICSSCENE_HPP_ #ifndef _STELAPPGRAPHICSSCENE_HPP_
#define _STELAPPGRAPHICSSCENE_HPP_ #define _STELAPPGRAPHICSSCENE_HPP_
#include <QGraphicsScene> #include <QGraphicsScene>
class QTimer;
//! A special QGraphicsScene for use in Stellarium. //! A special QGraphicsScene for use in Stellarium.
//! It manages initialization of the program and redirects users inputs to the core and GUI //! It manages initialization of the program and redirects users inputs to the core and GUI
class StelAppGraphicsScene : public QGraphicsScene class StelAppGraphicsScene : public QGraphicsScene
{ {
Q_OBJECT; Q_OBJECT
public: public:
StelAppGraphicsScene(); StelAppGraphicsScene();
~StelAppGraphicsScene(); ~StelAppGraphicsScene();
//! Get the StelMainWindow singleton instance. //! Get the StelMainWindow singleton instance.
//! @return the StelMainWindow singleton instance //! @return the StelMainWindow singleton instance
static StelAppGraphicsScene& getInstance() {Q_ASSERT(singleton); ret urn *singleton;} static StelAppGraphicsScene& getInstance() {Q_ASSERT(singleton); ret urn *singleton;}
//! Initialize the StelAppGraphicsScene //! Initialize the StelAppGraphicsScene
void init(); void init();
//! Start the display loop //! Start the display loop
void startMainLoop(); void startMainLoop();
//! Define the type of viewport distorter to use //! Define the type of viewport distorter to use
//! @param type can be only 'fisheye_to_spheric_mirror' or anything else for no distorter //! @param type can be only 'fisheye_to_spheric_mirror' or anything else for no distorter
void setViewPortDistorterType(const QString& type); void setViewPortDistorterType(const QString& type);
//! Get the type of viewport distorter currently used //! Get the type of viewport distorter currently used
QString getViewPortDistorterType() const; QString getViewPortDistorterType() const;
//! Paint the whole Core of stellarium
//! This method is called automatically by the GraphicsView
void drawBackground(QPainter *painter, const QRectF &rect);
void glWindowHasBeenResized(int w, int h); void glWindowHasBeenResized(int w, int h);
//! Switch to native OpenGL painting, i.e not using QPainter
//! @sa After this call revertToQtPainting MUST be called
void switchToNativeOpenGLPainting();
//! Revert openGL state so that Qt painting works again
//! @return a painter that can be used
QPainter* revertToQtPainting();
QPainter* switchToQPainting();
void revertToOpenGL();
//! Get the state of the mouse cursor timeout flag //! Get the state of the mouse cursor timeout flag
bool getFlagCursorTimeout() {return flagCursorTimeout;} bool getFlagCursorTimeout() {return flagCursorTimeout;}
//! Get the mouse cursor timeout in seconds //! Get the mouse cursor timeout in seconds
float getCursorTimeout() const {return cursorTimeout;} float getCursorTimeout() const {return cursorTimeout;}
//! Get the state of the mouse cursor timeout flag //! Get the state of the mouse cursor timeout flag
void setFlagCursorTimeout(bool b) {flagCursorTimeout=b;} void setFlagCursorTimeout(bool b) {flagCursorTimeout=b;}
//! Set the mouse cursor timeout in seconds //! Set the mouse cursor timeout in seconds
void setCursorTimeout(float t) {cursorTimeout=t;} void setCursorTimeout(float t) {cursorTimeout=t;}
public slots:
void minFpsChanged();
protected: protected:
virtual void keyPressEvent(QKeyEvent* event); virtual void keyPressEvent(QKeyEvent* event);
virtual void keyReleaseEvent(QKeyEvent* event); virtual void keyReleaseEvent(QKeyEvent* event);
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
virtual void wheelEvent(QGraphicsSceneWheelEvent * wheelEvent); virtual void wheelEvent(QGraphicsSceneWheelEvent * wheelEvent);
//! Paint the whole Core of stellarium.
//! This method is called automatically by the GraphicsView
void drawBackground(QPainter *painter, const QRectF &rect);
private: private:
//! Notify that an event was handled by the program and therefore th e //! Notify that an event was handled by the program and therefore th e
//! FPS should be maximized for a couple of seconds. //! FPS should be maximized for a couple of seconds.
void thereWasAnEvent(); void thereWasAnEvent();
double previousTime; double previousTime;
double lastEventTimeSec; double lastEventTimeSec;
// Main elements of the StelApp // Main elements of the StelApp
class ViewportDistorter *distorter; class StelViewportDistorter *distorter;
// The StelAppGraphicsScene singleton // The StelAppGraphicsScene singleton
static StelAppGraphicsScene* singleton; static StelAppGraphicsScene* singleton;
QPainter* tempPainter;
// Number of second before the mouse cursor disappears // Number of second before the mouse cursor disappears
float cursorTimeout; float cursorTimeout;
bool flagCursorTimeout; bool flagCursorTimeout;
QTimer* minFpsTimer;
}; };
#endif // _STELAPPGRAPHICSSCENE_HPP_ #endif // _STELAPPGRAPHICSSCENE_HPP_
 End of changes. 10 change blocks. 
19 lines changed or deleted 14 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/