aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorThierry Crozat2011-05-15 16:31:58 +0100
committerThierry Crozat2011-05-16 00:11:32 +0100
commit0b8d2c4d60b347543fc3a151489da2d55ca59a7f (patch)
tree1dbc2200739e51e584792175f08aedbe6675e9c9 /gui
parent3c59e37035742ce843f3e12039b5169e4bdd0168 (diff)
downloadscummvm-rg350-0b8d2c4d60b347543fc3a151489da2d55ca59a7f.tar.gz
scummvm-rg350-0b8d2c4d60b347543fc3a151489da2d55ca59a7f.tar.bz2
scummvm-rg350-0b8d2c4d60b347543fc3a151489da2d55ca59a7f.zip
GUI: Apply graphics mode change when closing global options dialog
Diffstat (limited to 'gui')
-rw-r--r--gui/options.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/gui/options.cpp b/gui/options.cpp
index d3501390db..e42d6c62ee 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -305,8 +305,14 @@ void OptionsDialog::close() {
if (getResult()) {
// Graphic options
+ bool graphicsModeChanged = false;
if (_fullscreenCheckbox) {
if (_enableGraphicSettings) {
+ if (ConfMan.getBool("fullscreen", _domain) != _fullscreenCheckbox->getState())
+ graphicsModeChanged = true;
+ if (ConfMan.getBool("aspect_ratio", _domain) != _aspectCheckbox->getState())
+ graphicsModeChanged = true;
+
ConfMan.setBool("fullscreen", _fullscreenCheckbox->getState(), _domain);
ConfMan.setBool("aspect_ratio", _aspectCheckbox->getState(), _domain);
ConfMan.setBool("disable_dithering", _disableDitheringCheckbox->getState(), _domain);
@@ -318,6 +324,8 @@ void OptionsDialog::close() {
while (gm->name) {
if (gm->id == (int)_gfxPopUp->getSelectedTag()) {
+ if (ConfMan.get("gfx_mode", _domain) != gm->name)
+ graphicsModeChanged = true;
ConfMan.set("gfx_mode", gm->name, _domain);
isSet = true;
break;
@@ -338,6 +346,48 @@ void OptionsDialog::close() {
ConfMan.removeKey("render_mode", _domain);
}
}
+
+ // Setup graphics again if needed
+ if (_domain == Common::ConfigManager::kApplicationDomain && graphicsModeChanged) {
+ g_system->beginGFXTransaction();
+ g_system->setGraphicsMode(ConfMan.get("gfx_mode", _domain).c_str());
+
+ if (ConfMan.hasKey("aspect_ratio"))
+ g_system->setFeatureState(OSystem::kFeatureAspectRatioCorrection, ConfMan.getBool("aspect_ratio", _domain));
+ if (ConfMan.hasKey("fullscreen"))
+ g_system->setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen", _domain));
+ OSystem::TransactionError gfxError = g_system->endGFXTransaction();
+ if (gfxError != OSystem::kTransactionSuccess) {
+ // Revert ConfMan to what OSystem is using.
+ Common::String message = "Failed to apply some of the graphic options changes:";
+
+ if (gfxError & OSystem::kTransactionModeSwitchFailed) {
+ const OSystem::GraphicsMode *gm = g_system->getSupportedGraphicsModes();
+ while (gm->name) {
+ if (gm->id == g_system->getGraphicsMode()) {
+ ConfMan.set("gfx_mode", gm->name, _domain);
+ break;
+ }
+ gm++;
+ }
+ message += "\nthe video mode could not be changed.";
+ }
+
+ if (gfxError & OSystem::kTransactionAspectRatioFailed) {
+ ConfMan.setBool("aspect_ratio", g_system->getFeatureState(OSystem::kFeatureAspectRatioCorrection), _domain);
+ message += "\nthe fullscreen setting could not be changed";
+ }
+
+ if (gfxError & OSystem::kTransactionFullscreenFailed) {
+ ConfMan.setBool("fullscreen", g_system->getFeatureState(OSystem::kFeatureFullscreenMode), _domain);
+ message += "\nthe aspect ratio setting could not be changed";
+ }
+
+ // And display the error
+ GUI::MessageDialog dialog(message);
+ dialog.runModal();
+ }
+ }
// Volume options
if (_musicVolumeSlider) {