From b60bb408fde7c2ec67f9e42c6fb2d867a45fa4e7 Mon Sep 17 00:00:00 2001 From: Pieter van der Kloet Date: Tue, 6 Sep 2011 02:02:34 +0200 Subject: [PATCH] Added some useful error messages when things go wrong with Ogre --- apps/launcher/graphicspage.cpp | 40 ++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/apps/launcher/graphicspage.cpp b/apps/launcher/graphicspage.cpp index 87d955271..dc88b3ee8 100644 --- a/apps/launcher/graphicspage.cpp +++ b/apps/launcher/graphicspage.cpp @@ -189,24 +189,6 @@ void GraphicsPage::setupOgre() "openmw", "ogre.cfg")); file.setFileName(ogreCfg); - /* Not yet supported by OpenMW as it only seems to look in the user directory for ogre.cfg - QString ogreCfg = "./ogre.cfg"; - file.setFileName(ogreCfg); - - if (!file.exists()) { - file.setFileName(QString::fromStdString(Files::getPath(Files::Path_ConfigUser, - "openmw", "ogre.cfg"))); - } - - if (!file.exists()) { - file.setFileName(QString::fromStdString(Files::getPath(Files::Path_ConfigGlobal, - "openmw", "ogre.cfg"))); - } - - if (!file.exists()) { - file.setFileName(ogreCfg); - }*/ - try { mOgre = new Ogre::Root(pluginCfg.toStdString(), file.fileName().toStdString(), "./launcherOgre.log"); @@ -428,7 +410,27 @@ void GraphicsPage::writeConfig() mOpenGLRenderSystem->setConfigOption("Video Mode", mOGLResolutionComboBox->currentText().toStdString()); } - //mOpenGLRenderSystem->validateConfigOptions(); + // Now we validate the options + QString ogreError = QString::fromStdString(mSelectedRenderSystem->validateConfigOptions()); + + if (!ogreError.isEmpty()) { + QMessageBox msgBox; + msgBox.setWindowTitle("Error validating configuration"); + msgBox.setIcon(QMessageBox::Critical); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.setText(tr("
A problem occured while validating the graphics options

\ + The graphics options could not be saved.

\ + Press \"Show Details...\" for more information.
")); + msgBox.setDetailedText(ogreError); + msgBox.exec(); + + Ogre::LogManager::getSingletonPtr()->logMessage( "Caught exception in validateConfigOptions"); + + qCritical("Error validating configuration"); + + std::exit(1); + } + // Write the settings to the config file mOgre->saveConfig();