Changed error handling for Ogre config and made the launcher exit cleanly

pull/21/head
Pieter van der Kloet 13 years ago
parent 283a9183d0
commit 5dbbc5bb7b

@ -183,7 +183,7 @@ void GraphicsPage::setupOgre()
qCritical("Error creating Ogre::Root, the error reported was:\n %s", qPrintable(ogreError));
std::exit(1);
QApplication::exit(1);
}
// Get the available renderers and put them in the combobox
@ -216,7 +216,7 @@ void GraphicsPage::setupOgre()
Please make sure the plugins.cfg file exists and contains a valid rendering plugin.<br>"));
msgBox.exec();
std::exit(1);
QApplication::exit(1);
}
// Now fill the GUI elements
@ -388,7 +388,7 @@ void GraphicsPage::writeConfig()
if (!ogreError.isEmpty()) {
QMessageBox msgBox;
msgBox.setWindowTitle("Error validating configuration");
msgBox.setWindowTitle("Error validating Ogre configuration");
msgBox.setIcon(QMessageBox::Critical);
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setText(tr("<br><b>A problem occured while validating the graphics options</b><br><br> \
@ -401,11 +401,33 @@ void GraphicsPage::writeConfig()
qCritical("Error validating configuration");
std::exit(1);
QApplication::exit(1);
}
// Write the settings to the config file
mOgre->saveConfig();
try
{
mOgre->saveConfig();
}
catch(Ogre::Exception &ex)
{
QString ogreError = QString::fromStdString(ex.getFullDescription().c_str());
QMessageBox msgBox;
msgBox.setWindowTitle("Error writing Ogre configuration file");
msgBox.setIcon(QMessageBox::Critical);
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setText(tr("<br><b>Could not write the graphics configuration</b><br><br> \
Please make sure you have the right permissions and try again.<br><br> \
Press \"Show Details...\" for more information.<br>"));
msgBox.setDetailedText(ogreError);
msgBox.exec();
qCritical("Error saving Ogre configuration, the error reported was:\n %s", qPrintable(ogreError));
QApplication::exit(1);
}
}

@ -340,7 +340,7 @@ void MainDialog::writeConfig()
Please make sure you have the right permissions and try again.<br>").arg(file.fileName()));
msgBox.exec();
std::exit(1);
QApplication::exit(1);
}
QTextStream in(&file);
@ -366,7 +366,7 @@ void MainDialog::writeConfig()
Please make sure you have the right permissions and try again.<br>").arg(file.fileName()));
msgBox.exec();
std::exit(1);;
QApplication::exit(1);
}
file.write(buffer);

Loading…
Cancel
Save