Add GL error handling to welcome page.

Handle the sceneGraphError() so that the application
does not crash.
==[ Subject: One line only short meaningful description for logs ]===|

Change-Id: I04e7e92d78795969f5686709522edfc6004cd932
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
This commit is contained in:
Friedemann Kleint
2014-03-05 11:52:24 +01:00
parent 8d6e3d22a9
commit bf75e5c085

View File

@@ -50,6 +50,7 @@
#include <QDesktopServices> #include <QDesktopServices>
#include <QPainter> #include <QPainter>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QMessageBox>
#include <QCoreApplication> #include <QCoreApplication>
#include <QDir> #include <QDir>
@@ -116,6 +117,9 @@ signals:
private slots: private slots:
void welcomePluginAdded(QObject*); void welcomePluginAdded(QObject*);
#if QT_VERSION >= 0x050300
void sceneGraphError(QQuickWindow::SceneGraphError, const QString &message);
#endif
private: private:
void facilitateQml(QQmlEngine *engine); void facilitateQml(QQmlEngine *engine);
@@ -144,6 +148,10 @@ WelcomeMode::WelcomeMode() :
setContext(Core::Context(Core::Constants::C_WELCOME_MODE)); setContext(Core::Context(Core::Constants::C_WELCOME_MODE));
m_welcomePage = new QQuickView; m_welcomePage = new QQuickView;
#if QT_VERSION >= 0x050300
connect(m_welcomePage, SIGNAL(sceneGraphError(QQuickWindow::SceneGraphError,QString)),
this, SLOT(sceneGraphError(QQuickWindow::SceneGraphError,QString)));
#endif // Qt 5.3
m_welcomePage->setObjectName(QLatin1String("WelcomePage")); m_welcomePage->setObjectName(QLatin1String("WelcomePage"));
m_welcomePage->setResizeMode(QQuickView::SizeRootObjectToView); m_welcomePage->setResizeMode(QQuickView::SizeRootObjectToView);
@@ -187,6 +195,19 @@ WelcomeMode::~WelcomeMode()
delete m_networkAccessManagerFactory; delete m_networkAccessManagerFactory;
} }
#if QT_VERSION >= 0x050300
void WelcomeMode::sceneGraphError(QQuickWindow::SceneGraphError, const QString &message)
{
QMessageBox *messageBox =
new QMessageBox(QMessageBox::Warning,
tr("Welcome Mode Load Error"), message,
QMessageBox::Close, m_modeWidget);
messageBox->setModal(false);
messageBox->setAttribute(Qt::WA_DeleteOnClose);
messageBox->show();
}
#endif // Qt 5.3
bool sortFunction(Utils::IWelcomePage * a, Utils::IWelcomePage *b) bool sortFunction(Utils::IWelcomePage * a, Utils::IWelcomePage *b)
{ {
return a->priority() < b->priority(); return a->priority() < b->priority();