StelMainGraphicsView.hpp   StelMainGraphicsView.hpp 
skipping to change at line 24 skipping to change at line 24
* *
* 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 _STELMAINGRAPHICSVIEW_HPP_ #ifndef _STELMAINGRAPHICSVIEW_HPP_
#define _STELMAINGRAPHICSVIEW_HPP_ #define _STELMAINGRAPHICSVIEW_HPP_
#include <QGraphicsView> #include <QGraphicsView>
#include <QCoreApplication>
#include <QEventLoop>
class QGLWidget; class QGLWidget;
class QResizeEvent; class QResizeEvent;
class StelGuiBase; class StelGuiBase;
class StelMainScriptAPIProxy; class StelMainScriptAPIProxy;
class StelScriptMgr; class StelScriptMgr;
class StelQGLWidget; class StelQGLWidget;
//! @class StelMainGraphicsView //! @class StelMainGraphicsView
//! Reimplement a QGraphicsView for Stellarium. //! Reimplement a QGraphicsView for Stellarium.
skipping to change at line 48 skipping to change at line 50
public: public:
StelMainGraphicsView(QWidget* parent); StelMainGraphicsView(QWidget* parent);
virtual ~StelMainGraphicsView(); virtual ~StelMainGraphicsView();
//! 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. //! 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
//! @deprecated don't use that.
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();
//! Return the QGraphicsWidget encapsulating the Stellarium main sky view. //! Return the QGraphicsWidget encapsulating the Stellarium main sky view.
//! Use its layout if you want to add widget on the top of the main sky view. //! Use its layout if you want to add widget on the top of the main sky view.
class StelAppGraphicsWidget* getStelAppGraphicsWidget() {return main SkyItem;} class StelAppGraphicsWidget* getStelAppGraphicsWidget() {return main SkyItem;}
//! Return the top level QGraphicsWidget which contains the layout c ontaining the Stellarium main sky view. //! 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. //! Use its layout if you want to add widget on the side of the main sky view.
QGraphicsWidget* getTopLevelGraphicsWidget() {return backItem;} QGraphicsWidget* getTopLevelGraphicsWidget() {return backItem;}
#ifndef DISABLE_SCRIPTING
//! Get the script API proxy (for signal handling) //! Get the script API proxy (for signal handling)
StelMainScriptAPIProxy* getMainScriptAPIProxy() {return scriptAPIPro xy;} StelMainScriptAPIProxy* getMainScriptAPIProxy() {return scriptAPIPro xy;}
//! Get the script manager //! Get the script manager
StelScriptMgr& getScriptMgr() {return *scriptMgr;} StelScriptMgr& getScriptMgr() {return *scriptMgr;}
#endif
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
skipping to change at line 113 skipping to change at line 107
//! @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;}
//! Updates the scene and process all events
void updateScene() {
//#ifdef QT_MAC_USE_COCOA
// This call solves the problems with the qt event d
ispatche. The stack grew huge and many events were discarded
// http://bugreports.qt.nokia.com/browse/QTBUG-7502
// QCoreApplication::processEvents(QEventLoop::AllEvent
s);
//#endif
scene()->update();
}
protected: protected:
virtual void resizeEvent(QResizeEvent* event); 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);
//! 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);
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);
skipping to change at line 150 skipping to change at line 154
//! Start the display loop //! Start the display loop
void startMainLoop(); void startMainLoop();
//! The StelMainGraphicsView singleton //! The StelMainGraphicsView singleton
static StelMainGraphicsView* singleton; static StelMainGraphicsView* singleton;
QGraphicsWidget* backItem; QGraphicsWidget* backItem;
class StelAppGraphicsWidget* mainSkyItem; class StelAppGraphicsWidget* mainSkyItem;
//! The openGL window //! The openGL window
StelQGLWidget* glWidget; StelQGLWidget* glWidget;
class QGLContext* glContext;
StelGuiBase* gui; StelGuiBase* gui;
#ifndef DISABLE_SCRIPTING
// The script API proxy object (for bridging threads) // The script API proxy object (for bridging threads)
StelMainScriptAPIProxy* scriptAPIProxy; StelMainScriptAPIProxy* scriptAPIProxy;
// The script manager based on Qt script engine // The script manager based on Qt script engine
StelScriptMgr* scriptMgr; StelScriptMgr* scriptMgr;
#endif
bool wasDeinit; bool wasDeinit;
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 //! 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 lastEventTimeSec; double lastEventTimeSec;
QTime* qtime;
QTimer* minFpsTimer; QTimer* minFpsTimer;
//! 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. 10 change blocks. 
12 lines changed or deleted 20 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/