StelAppGraphicsWidget.cpp   StelAppGraphicsWidget.cpp 
skipping to change at line 35 skipping to change at line 35
#include "StelViewportEffect.hpp" #include "StelViewportEffect.hpp"
#include <QPainter> #include <QPainter>
#include <QPaintEngine> #include <QPaintEngine>
#include <QGraphicsSceneMouseEvent> #include <QGraphicsSceneMouseEvent>
#include <QGraphicsScene> #include <QGraphicsScene>
#include <QGLFramebufferObject> #include <QGLFramebufferObject>
#include <QSettings> #include <QSettings>
StelAppGraphicsWidget::StelAppGraphicsWidget() StelAppGraphicsWidget::StelAppGraphicsWidget()
: paintState(0), useBuffers(false), backgroundBuffer(NULL), foregrou ndBuffer(NULL), viewportEffect(NULL) : paintState(0), useBuffers(false), backgroundBuffer(NULL), foregrou ndBuffer(NULL), viewportEffect(NULL), doPaint(true)
{ {
previousPaintTime = StelApp::getTotalRunTime(); previousPaintTime = StelApp::getTotalRunTime();
setFocusPolicy(Qt::StrongFocus); setFocusPolicy(Qt::StrongFocus);
stelApp = new StelApp(); stelApp = new StelApp();
} }
StelAppGraphicsWidget::~StelAppGraphicsWidget() StelAppGraphicsWidget::~StelAppGraphicsWidget()
{ {
delete stelApp; delete stelApp;
stelApp = NULL; stelApp = NULL;
skipping to change at line 58 skipping to change at line 58
if (foregroundBuffer) delete foregroundBuffer; if (foregroundBuffer) delete foregroundBuffer;
foregroundBuffer = NULL; foregroundBuffer = NULL;
if (viewportEffect) delete viewportEffect; if (viewportEffect) delete viewportEffect;
viewportEffect = NULL; viewportEffect = NULL;
StelApp::deinitStatic(); StelApp::deinitStatic();
} }
void StelAppGraphicsWidget::init(QSettings* conf) void StelAppGraphicsWidget::init(QSettings* conf)
{ {
stelApp->init(conf);
Q_ASSERT(viewportEffect==NULL); Q_ASSERT(viewportEffect==NULL);
setViewportEffect(conf->value("video/viewport_effect", "none").toStr ing()); setViewportEffect(conf->value("video/viewport_effect", "none").toStr ing());
stelApp->init(conf);
//previousPaintTime needs to be updated after the time zone is set //previousPaintTime needs to be updated after the time zone is set
//in StelLocaleMgr::init(), otherwise this causes an invalid value o f //in StelLocaleMgr::init(), otherwise this causes an invalid value o f
//deltaT the first time it is calculated in paintPartial(), which in //deltaT the first time it is calculated in paintPartial(), which in
//turn causes Stellarium to start with a wrong time. //turn causes Stellarium to start with a wrong time.
previousPaintTime = StelApp::getTotalRunTime(); previousPaintTime = StelApp::getTotalRunTime();
} }
void StelAppGraphicsWidget::setViewportEffect(const QString& name) void StelAppGraphicsWidget::setViewportEffect(const QString& name)
{ {
skipping to change at line 159 skipping to change at line 159
paintState = 0; paintState = 0;
return false; return false;
} }
Q_ASSERT(false); Q_ASSERT(false);
return false; return false;
} }
void StelAppGraphicsWidget::paint(QPainter* painter, const QStyleOptionGrap hicsItem*, QWidget*) void StelAppGraphicsWidget::paint(QPainter* painter, const QStyleOptionGrap hicsItem*, QWidget*)
{ {
// Don't even try to draw if we don't have a core yet (fix a bug dur ing splash screen) // Don't even try to draw if we don't have a core yet (fix a bug dur ing splash screen)
if (!stelApp || !stelApp->getCore()) if (!stelApp || !stelApp->getCore() || !doPaint)
return; return;
StelPainter::setQPainter(painter); StelPainter::setQPainter(painter);
if (useBuffers) if (useBuffers)
{ {
StelPainter::makeMainGLContextCurrent(); StelPainter::makeMainGLContextCurrent();
initBuffers(); initBuffers();
backgroundBuffer->bind(); backgroundBuffer->bind();
QPainter* pa = new QPainter(backgroundBuffer); QPainter* pa = new QPainter(backgroundBuffer);
skipping to change at line 243 skipping to change at line 243
// Apply distortion on the mouse position. // Apply distortion on the mouse position.
QPointF pos = event->scenePos(); QPointF pos = event->scenePos();
distortPos(&pos); distortPos(&pos);
pos.setY(scene()->height() - 1 - pos.y()); pos.setY(scene()->height() - 1 - pos.y());
stelApp->handleMove(pos.x(), pos.y(), event->buttons()); stelApp->handleMove(pos.x(), pos.y(), event->buttons());
} }
void StelAppGraphicsWidget::mousePressEvent(QGraphicsSceneMouseEvent* event ) void StelAppGraphicsWidget::mousePressEvent(QGraphicsSceneMouseEvent* event )
{ {
// Apply distortion on the mouse position. // Apply distortion on the mouse position.
// Widget gets focus on clicked
setFocus();
QPointF pos = event->scenePos(); QPointF pos = event->scenePos();
distortPos(&pos); distortPos(&pos);
pos.setY(scene()->height() - 1 - pos.y()); pos.setY(scene()->height() - 1 - pos.y());
QMouseEvent newEvent(QEvent::MouseButtonPress, QPoint(pos.x(),pos.y( )), event->button(), event->buttons(), event->modifiers()); QMouseEvent newEvent(QEvent::MouseButtonPress, QPoint(pos.x(),pos.y( )), event->button(), event->buttons(), event->modifiers());
stelApp->handleClick(&newEvent); stelApp->handleClick(&newEvent);
} }
void StelAppGraphicsWidget::mouseReleaseEvent(QGraphicsSceneMouseEvent* eve nt) void StelAppGraphicsWidget::mouseReleaseEvent(QGraphicsSceneMouseEvent* eve nt)
{ {
// Apply distortion on the mouse position. // Apply distortion on the mouse position.
 End of changes. 5 change blocks. 
3 lines changed or deleted 5 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/