StelMainView.cpp   StelMainView.cpp 
skipping to change at line 427 skipping to change at line 427
if (!format().depth()) if (!format().depth())
qWarning("Could not get depth buffer; results will b e suboptimal"); qWarning("Could not get depth buffer; results will b e suboptimal");
if (!format().doubleBuffer()) if (!format().doubleBuffer())
qWarning("Could not get double buffer; results will be suboptimal"); qWarning("Could not get double buffer; results will be suboptimal");
} }
}; };
#endif #endif
StelMainView::StelMainView(QWidget* parent) StelMainView::StelMainView(QWidget* parent)
: QGraphicsView(parent), guiItem(NULL), gui(NULL), : QGraphicsView(parent), guiItem(NULL),
gui(NULL),
flagInvertScreenShotColors(false), flagInvertScreenShotColors(false),
flagOverwriteScreenshots(false), flagOverwriteScreenshots(false),
screenShotPrefix("stellarium-"), screenShotPrefix("stellarium-"),
screenShotDir(""), screenShotDir(""),
cursorTimeout(-1.f), flagCursorTimeout(false), minFpsTimer(NULL), maxfps(10000.f) cursorTimeout(-1.f), flagCursorTimeout(false), minFpsTimer(NULL), maxfps(10000.f)
{ {
StelApp::initStatic(); StelApp::initStatic();
// Can't create 2 StelMainView instances // Can't create 2 StelMainView instances
Q_ASSERT(!singleton); Q_ASSERT(!singleton);
skipping to change at line 568 skipping to change at line 569
// Should be check of requirements disabled? // Should be check of requirements disabled?
if (conf->value("main/check_requirements", true).toBool()) if (conf->value("main/check_requirements", true).toBool())
{ {
// Find out lots of debug info about supported version of Op enGL and vendor/renderer. // Find out lots of debug info about supported version of Op enGL and vendor/renderer.
processOpenGLdiagnosticsAndWarnings(conf, glWidget); processOpenGLdiagnosticsAndWarnings(conf, glWidget);
} }
stelApp= new StelApp(); stelApp= new StelApp();
stelApp->setGui(gui); stelApp->setGui(gui);
stelApp->init(conf); stelApp->init(conf);
StelActionMgr *actionMgr = stelApp->getStelActionManager(); StelActionMgr *actionMgr = stelApp->getStelActionManager();
actionMgr->addAction("actionSave_Screenshot_Global", N_("Miscellaneo us"), N_("Save screenshot"), this, "saveScreenShot()", "Ctrl+S"); actionMgr->addAction("actionSave_Screenshot_Global", N_("Miscellaneo us"), N_("Save screenshot"), this, "saveScreenShot()", "Ctrl+S");
actionMgr->addAction("actionSet_Full_Screen_Global", N_("Display Opt ions"), N_("Full-screen mode"), this, "fullScreen", "F11"); actionMgr->addAction("actionSet_Full_Screen_Global", N_("Display Opt ions"), N_("Full-screen mode"), this, "fullScreen", "F11");
StelPainter::initGLShaders(); StelPainter::initGLShaders();
skyItem = new StelSkyItem(); skyItem = new StelSkyItem();
guiItem = new StelGuiItem(); guiItem = new StelGuiItem();
QGraphicsAnchorLayout* l = new QGraphicsAnchorLayout(rootItem); QGraphicsAnchorLayout* l = new QGraphicsAnchorLayout(rootItem);
l->setSpacing(0); l->setSpacing(0);
l->setContentsMargins(0,0,0,0); l->setContentsMargins(0,0,0,0);
l->addCornerAnchors(skyItem, Qt::TopLeftCorner, l, Qt::TopLeftCorner ); l->addCornerAnchors(skyItem, Qt::TopLeftCorner, l, Qt::TopLeftCorner );
l->addCornerAnchors(skyItem, Qt::BottomRightCorner, l, Qt::BottomRig htCorner); l->addCornerAnchors(skyItem, Qt::BottomRightCorner, l, Qt::BottomRig htCorner);
l->addCornerAnchors(guiItem, Qt::BottomLeftCorner, l, Qt::BottomLeft Corner); l->addCornerAnchors(guiItem, Qt::BottomLeftCorner, l, Qt::BottomLeft Corner);
l->addCornerAnchors(guiItem, Qt::TopRightCorner, l, Qt::TopRightCorn er); l->addCornerAnchors(guiItem, Qt::TopRightCorner, l, Qt::TopRightCorn er);
rootItem->setLayout(l); rootItem->setLayout(l);
scene()->addItem(rootItem); scene()->addItem(rootItem);
nightModeEffect = new NightModeGraphicsEffect(this); nightModeEffect = new NightModeGraphicsEffect(this);
updateNightModeProperty(); updateNightModeProperty(StelApp::getInstance().getVisionModeNight()) ;
rootItem->setGraphicsEffect(nightModeEffect); rootItem->setGraphicsEffect(nightModeEffect);
QSize size = glWidget->windowHandle()->screen()->size(); QSize size = glWidget->windowHandle()->screen()->size();
size = QSize(conf->value("video/screen_w", size.width()).toInt(), size = QSize(conf->value("video/screen_w", size.width()).toInt(),
conf->value("video/screen_h", size.height()).toInt()); conf->value("video/screen_h", size.height()).toInt());
bool fullscreen = conf->value("video/fullscreen", true).toBool(); bool fullscreen = conf->value("video/fullscreen", true).toBool();
// Without this, the screen is not shown on a Mac + we should use re size() for correct work of fullscreen/windowed mode switch. --AW WTF??? // Without this, the screen is not shown on a Mac + we should use re size() for correct work of fullscreen/windowed mode switch. --AW WTF???
resize(size); resize(size);
skipping to change at line 633 skipping to change at line 635
move(x + screenGeom.x(), y + screenGeom.y()); move(x + screenGeom.x(), y + screenGeom.y());
} }
flagInvertScreenShotColors = conf->value("main/invert_screenshots_co lors", false).toBool(); flagInvertScreenShotColors = conf->value("main/invert_screenshots_co lors", false).toBool();
setFlagCursorTimeout(conf->value("gui/flag_mouse_cursor_timeout", fa lse).toBool()); setFlagCursorTimeout(conf->value("gui/flag_mouse_cursor_timeout", fa lse).toBool());
setCursorTimeout(conf->value("gui/mouse_cursor_timeout", 10.f).toFlo at()); setCursorTimeout(conf->value("gui/mouse_cursor_timeout", 10.f).toFlo at());
maxfps = conf->value("video/maximum_fps",10000.f).toFloat(); maxfps = conf->value("video/maximum_fps",10000.f).toFloat();
minfps = conf->value("video/minimum_fps",10000.f).toFloat(); minfps = conf->value("video/minimum_fps",10000.f).toFloat();
flagMaxFpsUpdatePending = false; flagMaxFpsUpdatePending = false;
// XXX: This should be done in StelApp::init(), unfortunately for th // XXX: This should be done in StelApp::init(), unfortunately for th
e moment we need init the gui before the e moment we need to init the gui before the
// plugins, because the gui create the QActions needed by some plugi // plugins, because the gui creates the QActions needed by some plug
ns. ins.
StelApp::getInstance().initPlugIns(); StelApp::getInstance().initPlugIns();
// activate DE430/431 // activate DE430/431
StelApp::getInstance().getCore()->initEphemeridesFunctions(); StelApp::getInstance().getCore()->initEphemeridesFunctions();
// The script manager can only be fully initialized after the plugin s have loaded. // The script manager can only be fully initialized after the plugin s have loaded.
StelApp::getInstance().initScriptMgr(); StelApp::getInstance().initScriptMgr();
// Set the global stylesheet, this is only useful for the tooltips. // Set the global stylesheet, this is only useful for the tooltips.
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui( )); StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui( ));
if (gui!=NULL) if (gui!=NULL)
setStyleSheet(gui->getStelStyle().qtStyleSheet); setStyleSheet(gui->getStelStyle().qtStyleSheet);
connect(&StelApp::getInstance(), SIGNAL(visionNightModeChanged(bool) ), this, SLOT(updateNightModeProperty())); connect(&StelApp::getInstance(), SIGNAL(visionNightModeChanged(bool) ), this, SLOT(updateNightModeProperty(bool)));
QThread::currentThread()->setPriority(QThread::HighestPriority); QThread::currentThread()->setPriority(QThread::HighestPriority);
#ifndef NDEBUG
// Get an overview of module callOrders
if (qApp->property("verbose")==true)
{
StelApp::getInstance().dumpModuleActionPriorities(StelModule
::ActionDraw);
StelApp::getInstance().dumpModuleActionPriorities(StelModule
::ActionUpdate);
StelApp::getInstance().dumpModuleActionPriorities(StelModule
::ActionHandleMouseClicks);
StelApp::getInstance().dumpModuleActionPriorities(StelModule
::ActionHandleMouseMoves);
StelApp::getInstance().dumpModuleActionPriorities(StelModule
::ActionHandleKeys);
}
#endif
startMainLoop(); startMainLoop();
} }
void StelMainView::updateNightModeProperty() void StelMainView::updateNightModeProperty(bool b)
{ {
// So that the bottom bar tooltips get properly rendered in night mo de. // So that the bottom bar tooltips get properly rendered in night mo de.
setProperty("nightMode", StelApp::getInstance().getVisionModeNight() setProperty("nightMode", b);
); nightModeEffect->setEnabled(b);
nightModeEffect->setEnabled(StelApp::getInstance().getVisionModeNigh
t());
} }
// This is a series of various diagnostics based on "bugs" reported for 0.1 3.0 and 0.13.1. // This is a series of various diagnostics based on "bugs" reported for 0.1 3.0 and 0.13.1.
// Almost all can be traced to insufficient driver level. // Almost all can be traced to insufficient driver level.
// No changes of OpenGL state is done here. // No changes of OpenGL state is done here.
// If problems are detected, warn the user one time, but continue. Warning panel will be suppressed on next start. // If problems are detected, warn the user one time, but continue. Warning panel will be suppressed on next start.
// Work in progress, as long as we get reports about bad systems or until O penGL startup is finalized and safe. // Work in progress, as long as we get reports about bad systems or until O penGL startup is finalized and safe.
// Several tests do not apply to MacOS X. // Several tests do not apply to MacOS X.
#if STEL_USE_NEW_OPENGL_WIDGETS #if STEL_USE_NEW_OPENGL_WIDGETS
void StelMainView::processOpenGLdiagnosticsAndWarnings(QSettings *co nf, StelQOpenGLWidget* glWidget) const void StelMainView::processOpenGLdiagnosticsAndWarnings(QSettings *co nf, StelQOpenGLWidget* glWidget) const
skipping to change at line 720 skipping to change at line 733
#endif #endif
if ( openGLerror || if ( openGLerror ||
((format.renderableType()==QSurfaceFormat::OpenGL ) && (format .version() < QPair<int, int>(2, 1)) && !isMesa) || ((format.renderableType()==QSurfaceFormat::OpenGL ) && (format .version() < QPair<int, int>(2, 1)) && !isMesa) ||
((format.renderableType()==QSurfaceFormat::OpenGL ) && (format .version() < QPair<int, int>(2, 0)) && isMesa) || // Mesa defaults to 2.0 but works! ((format.renderableType()==QSurfaceFormat::OpenGL ) && (format .version() < QPair<int, int>(2, 0)) && isMesa) || // Mesa defaults to 2.0 but works!
((format.renderableType()==QSurfaceFormat::OpenGLES) && (format .version() < QPair<int, int>(2, 0))) ) ((format.renderableType()==QSurfaceFormat::OpenGLES) && (format .version() < QPair<int, int>(2, 0))) )
{ {
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
if ((!isANGLE) && (!isMesa)) if ((!isANGLE) && (!isMesa))
qWarning() << "Oops... Insufficient OpenGL version. Please update drivers, graphics hardware, or use --angle-mode (or even --me sa-mode) option."; qWarning() << "Oops... Insufficient OpenGL version. Please update drivers, graphics hardware, or use --angle-mode (or even --me sa-mode) option.";
else if (isANGLE) else if (isANGLE)
qWarning() << "Oops... Insufficient OpenGL version i n ANGLE. Please update drivers, graphics hardware, or use --mesa-mode optio n."; qWarning() << "Oops... Insufficient OpenGLES version in ANGLE. Please update drivers, graphics hardware, or use --mesa-mode opt ion.";
else else
qWarning() << "Oops... Insufficient OpenGL version. Mesa failed! Please send a bug report."; qWarning() << "Oops... Insufficient OpenGL version. Mesa failed! Please send a bug report.";
QMessageBox::critical(0, "Stellarium", q_("Insufficient Open GL version. Please update drivers, graphics hardware, or use --angle-mode ( or --mesa-mode) option."), QMessageBox::Abort, QMessageBox::Abort); QMessageBox::critical(0, "Stellarium", q_("Insufficient Open GL version. Please update drivers, graphics hardware, or use --angle-mode ( or --mesa-mode) option."), QMessageBox::Abort, QMessageBox::Abort);
#else #else
qWarning() << "Oops... Insufficient OpenGL version. Please u pdate drivers, or graphics hardware."; qWarning() << "Oops... Insufficient OpenGL version. Please u pdate drivers, or graphics hardware.";
QMessageBox::critical(0, "Stellarium", q_("Insufficient Open GL version. Please update drivers, or graphics hardware."), QMessageBox::Ab ort, QMessageBox::Abort); QMessageBox::critical(0, "Stellarium", q_("Insufficient Open GL version. Please update drivers, or graphics hardware."), QMessageBox::Ab ort, QMessageBox::Abort);
#endif #endif
exit(1); exit(1);
} }
skipping to change at line 1144 skipping to change at line 1157
} }
minFpsTimer = new QTimer(this); minFpsTimer = new QTimer(this);
connect(minFpsTimer, SIGNAL(timeout()), this, SLOT(updateScene())); connect(minFpsTimer, SIGNAL(timeout()), this, SLOT(updateScene()));
minFpsTimer->start((int)(1./getMinFps()*1000.)); minFpsTimer->start((int)(1./getMinFps()*1000.));
} }
void StelMainView::mouseMoveEvent(QMouseEvent* event) void StelMainView::mouseMoveEvent(QMouseEvent* event)
{ {
// We notify the applicatio to increase the fps if a button has been // We notify the application to increase the fps if a button has bee n
// clicked, but also if the cursor is currently hidden, so that it g ets // clicked, but also if the cursor is currently hidden, so that it g ets
// restored. // restored.
if (event->buttons() || QGuiApplication::overrideCursor()!=0) if (event->buttons() || QGuiApplication::overrideCursor()!=0)
thereWasAnEvent(); // Refresh screen ASAP thereWasAnEvent(); // Refresh screen ASAP
QGraphicsView::mouseMoveEvent(event); QGraphicsView::mouseMoveEvent(event);
} }
void StelMainView::mousePressEvent(QMouseEvent* event) void StelMainView::mousePressEvent(QMouseEvent* event)
{ {
thereWasAnEvent(); // Refresh screen ASAP thereWasAnEvent(); // Refresh screen ASAP
skipping to change at line 1174 skipping to change at line 1187
void StelMainView::wheelEvent(QWheelEvent* event) void StelMainView::wheelEvent(QWheelEvent* event)
{ {
thereWasAnEvent(); // Refresh screen ASAP thereWasAnEvent(); // Refresh screen ASAP
QGraphicsView::wheelEvent(event); QGraphicsView::wheelEvent(event);
} }
void StelMainView::moveEvent(QMoveEvent * event) void StelMainView::moveEvent(QMoveEvent * event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
// We use the glWidget instead of the even, as we want the screen th at shows most of the widget. // We use the glWidget instead of the event, as we want the screen t hat shows most of the widget.
StelApp::getInstance().setDevicePixelsPerPixel(glWidget->windowHandl e()->devicePixelRatio()); StelApp::getInstance().setDevicePixelsPerPixel(glWidget->windowHandl e()->devicePixelRatio());
} }
void StelMainView::closeEvent(QCloseEvent* event) void StelMainView::closeEvent(QCloseEvent* event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
StelApp::getInstance().quit(); StelApp::getInstance().quit();
} }
void StelMainView::keyPressEvent(QKeyEvent* event) void StelMainView::keyPressEvent(QKeyEvent* event)
 End of changes. 11 change blocks. 
15 lines changed or deleted 31 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/