StelMainView.cpp   StelMainView.cpp 
skipping to change at line 362 skipping to change at line 362
Q_UNUSED(event); Q_UNUSED(event);
widget->setGeometry(0, 0, size().width(), size().height()); widget->setGeometry(0, 0, size().width(), size().height());
StelApp::getInstance().getGui()->forceRefreshGui(); StelApp::getInstance().getGui()->forceRefreshGui();
} }
#if STEL_USE_NEW_OPENGL_WIDGETS #if STEL_USE_NEW_OPENGL_WIDGETS
class StelQOpenGLWidget : public QOpenGLWidget class StelQOpenGLWidget : public QOpenGLWidget
{ {
public: public:
StelQOpenGLWidget(QWidget* parent) : QOpenGLWidget(parent) StelQOpenGLWidget(QWidget* parent) : QOpenGLWidget(parent)
{ {
// TODO: Unclear if tese attributes make sense? // TODO: Unclear if tese attributes make sense?
setAttribute(Qt::WA_PaintOnScreen); setAttribute(Qt::WA_PaintOnScreen);
setAttribute(Qt::WA_NoSystemBackground); setAttribute(Qt::WA_NoSystemBackground);
setAttribute(Qt::WA_OpaquePaintEvent); setAttribute(Qt::WA_OpaquePaintEvent);
} }
protected: protected:
virtual void initializeGL() virtual void initializeGL()
{ {
qDebug() << "It appears this was never called?"; qDebug() << "It appears this was never called?";
qDebug() << "OpenGL supported version: " << QString((char*)glGetStri qDebug() << "OpenGL supported version: " << QString((char*)g
ng(GL_VERSION)); lGetString(GL_VERSION));
QOpenGLWidget::initializeGL(); QOpenGLWidget::initializeGL();
this->makeCurrent(); // Do we need this? this->makeCurrent(); // Do we need this?
// GZ I have no idea how to proceed, sorry. // GZ I have no idea how to proceed, sorry.
QSurfaceFormat format=this->format(); QSurfaceFormat format=this->format();
qDebug() << "Current Format: " << this->format(); qDebug() << "Current Format: " << this->format();
// TODO: Test something? The old tests may be obsolete as all OpenGL // TODO: Test something? The old tests may be obsolete as al
2 formats/contexts have these? l OpenGL2 formats/contexts have these?
} }
virtual void paintGL() virtual void paintGL()
{ {
// TODO: what shall this do exactly? // TODO: what shall this do exactly?
} }
virtual void resizeGL() virtual void resizeGL()
{ {
// TODO: what shall this do exactly? // TODO: what shall this do exactly?
} }
}; };
#else #else
class StelQGLWidget : public QGLWidget class StelQGLWidget : public QGLWidget
{ {
public: public:
StelQGLWidget(QGLContext* ctx, QWidget* parent) : QGLWidget(ctx, par ent) StelQGLWidget(QGLContext* ctx, QWidget* parent) : QGLWidget(ctx, par ent)
{ {
setAttribute(Qt::WA_PaintOnScreen); setAttribute(Qt::WA_PaintOnScreen);
skipping to change at line 480 skipping to change at line 480
// Primary test for OpenGL existence // Primary test for OpenGL existence
if (QGLFormat::openGLVersionFlags() < QGLFormat::OpenGL_Version_2_1) if (QGLFormat::openGLVersionFlags() < QGLFormat::OpenGL_Version_2_1)
{ {
qWarning() << "No OpenGL 2.1 support on this system. Abortin g."; qWarning() << "No OpenGL 2.1 support on this system. Abortin g.";
QMessageBox::critical(0, "Stellarium", q_("No OpenGL 2 found on this system. Please upgrade hardware or use MESA or an older version.") , QMessageBox::Abort, QMessageBox::Abort); QMessageBox::critical(0, "Stellarium", q_("No OpenGL 2 found on this system. Please upgrade hardware or use MESA or an older version.") , QMessageBox::Abort, QMessageBox::Abort);
exit(1); exit(1);
} }
// Create an openGL viewport // Create an openGL viewport
QGLFormat glFormat(QGL::StencilBuffer | QGL::DepthBuffer | QGL::Doub leBuffer); QGLFormat glFormat(QGL::StencilBuffer | QGL::DepthBuffer | QGL::Doub leBuffer);
// Even if setting a version here, it is ignored in StelQGLWidget()! // Even if setting a version here, it may not be accepted in StelQGL
Widget()!
// Currently, not setting a version explicitly works on Windows and
Linux.
// Apparently some Macs have problems however and default to 2.1.
// We try a new CLI flag here which requests 3.3 Compatibiliy Profil
e which modern Macs should deliver.
// OpenGL Specs say this will deliver at least the requested version
, if possible.
// TBD: Maybe this must make a differentiation between OpenGL and Op enGL ES! // TBD: Maybe this must make a differentiation between OpenGL and Op enGL ES!
// glFormat.setVersion(2, 1); // TBD: If this works for Mac, it should be requested on all Macs wi
thout CLI option!
if (qApp->property("onetime_compat33")==true)
{
if (!(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Ve
rsion_3_3))
{
qWarning() << "No OpenGL 3.3 found here. We will get
whatever is available.";
qDebug() << "FYI: OpenGL Versions Supported: " <<
QGLFormat::openGLVersionFlags();
}
glFormat.setVersion(3, 3);
glFormat.setProfile(QGLFormat::CompatibilityProfile);
}
QGLContext* context=new QGLContext(glFormat); QGLContext* context=new QGLContext(glFormat);
if (context->format() != glFormat) if (context->format() != glFormat)
{ {
qWarning() << "Cannot provide OpenGL context. Apparently ins ufficient OpenGL resources on this system."; qWarning() << "Cannot provide requested OpenGL format. Appar ently insufficient OpenGL resources on this system.";
QMessageBox::critical(0, "Stellarium", q_("Cannot acquire ne cessary OpenGL resources."), QMessageBox::Abort, QMessageBox::Abort); QMessageBox::critical(0, "Stellarium", q_("Cannot acquire ne cessary OpenGL resources."), QMessageBox::Abort, QMessageBox::Abort);
exit(1); exit(1);
} }
glWidget = new StelQGLWidget(context, this); glWidget = new StelQGLWidget(context, this);
// This does not return the version number set previously! if (qApp->property("onetime_compat33")==true)
// qDebug() << "glWidget.context.format.version, result:" << glWidge {
t->context()->format().majorVersion() << "." << glWidget->context()->format // This may not return the version number set previously!
().minorVersion(); qDebug() << "StelQGLWidget context format version:" << glWid
get->context()->format().majorVersion() << "." << glWidget->context()->form
at().minorVersion();
qDebug() << "StelQGLWidget has CompatibilityProfile:" << (gl
Widget->context()->format().profile()==QGLFormat::CompatibilityProfile ? "y
es" : "no") << "(" <<glWidget->context()->format().profile() << ")";
}
#endif #endif
setViewport(glWidget); setViewport(glWidget);
setScene(new QGraphicsScene(this)); setScene(new QGraphicsScene(this));
scene()->setItemIndexMethod(QGraphicsScene::NoIndex); scene()->setItemIndexMethod(QGraphicsScene::NoIndex);
rootItem = new QGraphicsWidget(); rootItem = new QGraphicsWidget();
rootItem->setFocusPolicy(Qt::NoFocus); rootItem->setFocusPolicy(Qt::NoFocus);
// Workaround (see Bug #940638) Although we have already explicitly set // Workaround (see Bug #940638) Although we have already explicitly set
skipping to change at line 619 skipping to change at line 637
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 e moment we need init the gui before the // XXX: This should be done in StelApp::init(), unfortunately for th e moment we need init the gui before the
// plugins, because the gui create the QActions needed by some plugi ns. // plugins, because the gui create the QActions needed by some plugi ns.
StelApp::getInstance().initPlugIns(); StelApp::getInstance().initPlugIns();
// activate DE430/431
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()));
QThread::currentThread()->setPriority(QThread::HighestPriority); QThread::currentThread()->setPriority(QThread::HighestPriority);
skipping to change at line 646 skipping to change at line 667
nightModeEffect->setEnabled(StelApp::getInstance().getVisionModeNigh t()); 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
#else #else
void StelMainView::processOpenGLdiagnosticsAndWarnings(QSettings *co nf, StelQGLWidget* glWidget) const void StelMainView::processOpenGLdiagnosticsAndWarnings(QSettings *co nf, StelQGLWidget* glWidget) const
#endif #endif
{ {
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
Q_UNUSED(conf); Q_UNUSED(conf);
#endif #endif
QOpenGLContext* context=glWidget->context()->contextHandle(); QOpenGLContext* context=glWidget->context()->contextHandle();
QSurfaceFormat format=context->format(); QSurfaceFormat format=context->format();
skipping to change at line 832 skipping to change at line 853
#endif #endif
// Although our shaders are only GLSL1.10, there are frequent proble ms with systems just at this level of programmable shaders. // Although our shaders are only GLSL1.10, there are frequent proble ms with systems just at this level of programmable shaders.
// If GLSL version is less than 1.30 or GLSL ES 1.00, Stellarium usu ally does run properly on Windows or various Linux flavours. // If GLSL version is less than 1.30 or GLSL ES 1.00, Stellarium usu ally does run properly on Windows or various Linux flavours.
// Depending on whatever driver/implementation details, Stellarium m ay crash or show only minor graphical errors. // Depending on whatever driver/implementation details, Stellarium m ay crash or show only minor graphical errors.
// On these systems, we show a warning panel that can be suppressed by a config option which is automatically added on first run. // On these systems, we show a warning panel that can be suppressed by a config option which is automatically added on first run.
// Again, based on a sample size of one, Macs have been reported alr eady to always work in this case. // Again, based on a sample size of one, Macs have been reported alr eady to always work in this case.
#ifndef Q_OS_MAC #ifndef Q_OS_MAC
QRegExp glslRegExp("^(\\d\\.\\d\\d)"); QRegExp glslRegExp("^(\\d\\.\\d\\d)");
int pos=glslRegExp.indexIn(glslString); int pos=glslRegExp.indexIn(glslString);
QRegExp glslesRegExp("ES (\\d\\.\\d\\d)"); // VC4 drivers on Raspberry Pi reports ES 1.0.16 or so, we must step
down to one cipher after decimal.
QRegExp glslesRegExp("ES (\\d\\.\\d)");
int posES=glslesRegExp.indexIn(glslString); int posES=glslesRegExp.indexIn(glslString);
if (pos >-1) if (pos >-1)
{ {
float glslVersion=glslRegExp.cap(1).toFloat(); float glslVersion=glslRegExp.cap(1).toFloat();
qDebug() << "GLSL Version Number detected: " << glslVersion; qDebug() << "GLSL Version Number detected: " << glslVersion;
if (glslVersion<1.3f) if (glslVersion<1.3f)
{ {
openGLerror=true; openGLerror=true;
qDebug() << "This is not enough: we need GLSL1.30 or later."; qDebug() << "This is not enough: we need GLSL1.30 or later.";
qDebug() << "You should update graphics drivers, gra phics hardware, or use the --mesa-mode option."; qDebug() << "You should update graphics drivers, gra phics hardware, or use the --mesa-mode option.";
skipping to change at line 1013 skipping to change at line 1035
{ {
QString appNameI18n = q_("Stellarium %1").arg(StelUtils::getApplicat ionVersion()); QString appNameI18n = q_("Stellarium %1").arg(StelUtils::getApplicat ionVersion());
setWindowTitle(appNameI18n); setWindowTitle(appNameI18n);
} }
void StelMainView::setFullScreen(bool b) void StelMainView::setFullScreen(bool b)
{ {
if (b) if (b)
showFullScreen(); showFullScreen();
else else
{
showNormal(); showNormal();
// Not enough. If we had started in fullscreen, the inner pa
rt of the window is at 0/0, with the frame extending to top/left off screen
.
// Therefore moving is not possible. We must move to the sto
red position or at least defaults.
if ( (x()<0) && (y()<0))
{
QSettings *conf = StelApp::getInstance().getSettings
();
QDesktopWidget *desktop = QApplication::desktop();
int screen = conf->value("video/screen_number", 0).t
oInt();
if (screen < 0 || screen >= desktop->screenCount())
{
qWarning() << "WARNING: screen" << screen <<
"not found";
screen = 0;
}
QRect screenGeom = desktop->screenGeometry(screen);
int x = conf->value("video/screen_x", 0).toInt();
int y = conf->value("video/screen_y", 0).toInt();
move(x + screenGeom.x(), y + screenGeom.y());
}
}
emit fullScreenChanged(b);
} }
void StelMainView::updateScene() { void StelMainView::updateScene() {
// For some reason the skyItem is not updated when the night mode sh ader is on. // For some reason the skyItem is not updated when the night mode sh ader is on.
// To fix this we manually do it here. // To fix this we manually do it here.
skyItem->update(); skyItem->update();
scene()->update(); scene()->update();
} }
void StelMainView::thereWasAnEvent() void StelMainView::thereWasAnEvent()
skipping to change at line 1227 skipping to change at line 1269
qDebug() << "INFO Saving screenshot in file: " << QDir::toNativeSepa rators(shotPath.filePath()); qDebug() << "INFO Saving screenshot in file: " << QDir::toNativeSepa rators(shotPath.filePath());
if (!im.save(shotPath.filePath())) { if (!im.save(shotPath.filePath())) {
qWarning() << "WARNING failed to write screenshot to: " << Q Dir::toNativeSeparators(shotPath.filePath()); qWarning() << "WARNING failed to write screenshot to: " << Q Dir::toNativeSeparators(shotPath.filePath());
} }
} }
QPoint StelMainView::getMousePos() QPoint StelMainView::getMousePos()
{ {
return glWidget->mapFromGlobal(QCursor::pos()); return glWidget->mapFromGlobal(QCursor::pos());
} }
void StelMainView::setFocusOnSky()
{
skyItem->setFocus();
}
 End of changes. 12 change blocks. 
38 lines changed or deleted 97 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/