ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

editgamedialog.cpp

Go to the documentation of this file.
00001 /* ScummVM - Graphic Adventure Engine
00002  *
00003  * ScummVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #include "gui/editgamedialog.h"
00024 
00025 #include "common/config-manager.h"
00026 #include "common/gui_options.h"
00027 #include "common/translation.h"
00028 #include "common/system.h"
00029 
00030 #include "gui/browser.h"
00031 #include "gui/gui-manager.h"
00032 #include "gui/message.h"
00033 #ifdef ENABLE_EVENTRECORDER
00034 #include "gui/onscreendialog.h"
00035 #include "gui/recorderdialog.h"
00036 #include "gui/EventRecorder.h"
00037 #endif
00038 #include "gui/widgets/edittext.h"
00039 #include "gui/widgets/tab.h"
00040 #include "gui/widgets/popup.h"
00041 #include "gui/widgets/scrollcontainer.h"
00042 
00043 #if defined(USE_CLOUD) && defined(USE_LIBCURL)
00044 #include "backends/cloud/cloudmanager.h"
00045 #endif
00046 
00047 using Common::ConfigManager;
00048 
00049 namespace GUI {
00050 
00051 enum {
00052     kStartCmd = 'STRT',
00053     kAboutCmd = 'ABOU',
00054     kOptionsCmd = 'OPTN',
00055     kAddGameCmd = 'ADDG',
00056     kEditGameCmd = 'EDTG',
00057     kRemoveGameCmd = 'REMG',
00058     kLoadGameCmd = 'LOAD',
00059     kQuitCmd = 'QUIT',
00060     kSearchCmd = 'SRCH',
00061     kListSearchCmd = 'LSSR',
00062     kSearchClearCmd = 'SRCL',
00063 
00064     kCmdGlobalGraphicsOverride = 'OGFX',
00065     kCmdGlobalAudioOverride = 'OSFX',
00066     kCmdGlobalMIDIOverride = 'OMID',
00067     kCmdGlobalMT32Override = 'OM32',
00068     kCmdGlobalVolumeOverride = 'OVOL',
00069 
00070     kCmdChooseSoundFontCmd = 'chsf',
00071 
00072     kCmdExtraBrowser = 'PEXT',
00073     kCmdExtraPathClear = 'PEXC',
00074     kCmdGameBrowser = 'PGME',
00075     kCmdSaveBrowser = 'PSAV',
00076     kCmdSavePathClear = 'PSAC',
00077 
00078     kGraphicsTabContainerReflowCmd = 'gtcr'
00079 };
00080 
00081 /*
00082 * TODO: Clean up this ugly design: we subclass EditTextWidget to perform
00083 * input validation. It would be much more elegant to use a decorator pattern,
00084 * or a validation callback, or something like that.
00085 */
00086 class DomainEditTextWidget : public EditTextWidget {
00087 public:
00088     DomainEditTextWidget(GuiObject *boss, const String &name, const String &text, const char *tooltip = 0)
00089         : EditTextWidget(boss, name, text, tooltip) {}
00090 
00091 protected:
00092     bool tryInsertChar(byte c, int pos) {
00093         if (Common::isAlnum(c) || c == '-' || c == '_') {
00094             _editString.insertChar(c, pos);
00095             return true;
00096         }
00097         return false;
00098     }
00099 };
00100 
00101 EditGameDialog::EditGameDialog(const String &domain)
00102     : OptionsDialog(domain, "GameOptions") {
00103     EngineMan.upgradeTargetIfNecessary(domain);
00104 
00105     // Retrieve all game specific options.
00106 
00107     // Retrieve the plugin, since we need to access the engine's MetaEngine
00108     // implementation.
00109     const Plugin *plugin = nullptr;
00110     QualifiedGameDescriptor qgd = EngineMan.findTarget(domain, &plugin);
00111     if (plugin) {
00112         _engineOptions = plugin->get<MetaEngine>().getExtraGuiOptions(domain);
00113     } else {
00114         warning("Plugin for target \"%s\" not found! Game specific settings might be missing", domain.c_str());
00115     }
00116 
00117     // GAME: Path to game data (r/o), extra data (r/o), and save data (r/w)
00118     String gamePath(ConfMan.get("path", _domain));
00119     String extraPath(ConfMan.get("extrapath", _domain));
00120     String savePath(ConfMan.get("savepath", _domain));
00121 
00122     // GAME: Determine the description string
00123     String description(ConfMan.get("description", domain));
00124     if (description.empty() && qgd.description) {
00125         description = qgd.description;
00126     }
00127 
00128     // GUI:  Add tab widget
00129     TabWidget *tab = new TabWidget(this, "GameOptions.TabWidget");
00130 
00131     //
00132     // 1) The game tab
00133     //
00134     tab->addTab(_("Game"));
00135 
00136     // GUI:  Label & edit widget for the game ID
00137     if (g_system->getOverlayWidth() > 320)
00138         new StaticTextWidget(tab, "GameOptions_Game.Id", _("ID:"), _("Short game identifier used for referring to saved games and running the game from the command line"));
00139     else
00140         new StaticTextWidget(tab, "GameOptions_Game.Id", _c("ID:", "lowres"), _("Short game identifier used for referring to saved games and running the game from the command line"));
00141     _domainWidget = new DomainEditTextWidget(tab, "GameOptions_Game.Domain", _domain, _("Short game identifier used for referring to saved games and running the game from the command line"));
00142 
00143     // GUI:  Label & edit widget for the description
00144     if (g_system->getOverlayWidth() > 320)
00145         new StaticTextWidget(tab, "GameOptions_Game.Name", _("Name:"), _("Full title of the game"));
00146     else
00147         new StaticTextWidget(tab, "GameOptions_Game.Name", _c("Name:", "lowres"), _("Full title of the game"));
00148     _descriptionWidget = new EditTextWidget(tab, "GameOptions_Game.Desc", description, _("Full title of the game"));
00149 
00150     // Language popup
00151     _langPopUpDesc = new StaticTextWidget(tab, "GameOptions_Game.LangPopupDesc", _("Language:"), _("Language of the game. This will not turn your Spanish game version into English"));
00152     _langPopUp = new PopUpWidget(tab, "GameOptions_Game.LangPopup", _("Language of the game. This will not turn your Spanish game version into English"));
00153     _langPopUp->appendEntry(_("<default>"), (uint32)Common::UNK_LANG);
00154     _langPopUp->appendEntry("", (uint32)Common::UNK_LANG);
00155     const Common::LanguageDescription *l = Common::g_languages;
00156     for (; l->code; ++l) {
00157         if (checkGameGUIOptionLanguage(l->id, _guioptionsString))
00158             _langPopUp->appendEntry(l->description, l->id);
00159     }
00160 
00161     // Platform popup
00162     if (g_system->getOverlayWidth() > 320)
00163         _platformPopUpDesc = new StaticTextWidget(tab, "GameOptions_Game.PlatformPopupDesc", _("Platform:"), _("Platform the game was originally designed for"));
00164     else
00165         _platformPopUpDesc = new StaticTextWidget(tab, "GameOptions_Game.PlatformPopupDesc", _c("Platform:", "lowres"), _("Platform the game was originally designed for"));
00166     _platformPopUp = new PopUpWidget(tab, "GameOptions_Game.PlatformPopup", _("Platform the game was originally designed for"));
00167     _platformPopUp->appendEntry(_("<default>"));
00168     _platformPopUp->appendEntry("");
00169     const Common::PlatformDescription *p = Common::g_platforms;
00170     for (; p->code; ++p) {
00171         _platformPopUp->appendEntry(p->description, p->id);
00172     }
00173 
00174     //
00175     // 2) The engine tab (shown only if there are custom engine options)
00176     //
00177     if (_engineOptions.size() > 0) {
00178         tab->addTab(_("Engine"));
00179 
00180         addEngineControls(tab, "GameOptions_Engine.", _engineOptions);
00181     }
00182 
00183     //
00184     // 3) The graphics tab
00185     //
00186     _graphicsTabId = tab->addTab(g_system->getOverlayWidth() > 320 ? _("Graphics") : _("GFX"));
00187     ScrollContainerWidget *graphicsContainer = new ScrollContainerWidget(tab, "GameOptions_Graphics.Container", kGraphicsTabContainerReflowCmd);
00188     graphicsContainer->setBackgroundType(ThemeEngine::kDialogBackgroundNone);
00189     graphicsContainer->setTarget(this);
00190 
00191     if (g_system->getOverlayWidth() > 320)
00192         _globalGraphicsOverride = new CheckboxWidget(graphicsContainer, "GameOptions_Graphics_Container.EnableTabCheckbox", _("Override global graphic settings"), 0, kCmdGlobalGraphicsOverride);
00193     else
00194         _globalGraphicsOverride = new CheckboxWidget(graphicsContainer, "GameOptions_Graphics_Container.EnableTabCheckbox", _c("Override global graphic settings", "lowres"), 0, kCmdGlobalGraphicsOverride);
00195 
00196     addGraphicControls(graphicsContainer, "GameOptions_Graphics_Container.");
00197 
00198     //
00199     // 4) The audio tab
00200     //
00201     tab->addTab(_("Audio"));
00202 
00203     if (g_system->getOverlayWidth() > 320)
00204         _globalAudioOverride = new CheckboxWidget(tab, "GameOptions_Audio.EnableTabCheckbox", _("Override global audio settings"), 0, kCmdGlobalAudioOverride);
00205     else
00206         _globalAudioOverride = new CheckboxWidget(tab, "GameOptions_Audio.EnableTabCheckbox", _c("Override global audio settings", "lowres"), 0, kCmdGlobalAudioOverride);
00207 
00208     addAudioControls(tab, "GameOptions_Audio.");
00209     addSubtitleControls(tab, "GameOptions_Audio.");
00210 
00211     //
00212     // 5) The volume tab
00213     //
00214     if (g_system->getOverlayWidth() > 320)
00215         tab->addTab(_("Volume"));
00216     else
00217         tab->addTab(_c("Volume", "lowres"));
00218 
00219     if (g_system->getOverlayWidth() > 320)
00220         _globalVolumeOverride = new CheckboxWidget(tab, "GameOptions_Volume.EnableTabCheckbox", _("Override global volume settings"), 0, kCmdGlobalVolumeOverride);
00221     else
00222         _globalVolumeOverride = new CheckboxWidget(tab, "GameOptions_Volume.EnableTabCheckbox", _c("Override global volume settings", "lowres"), 0, kCmdGlobalVolumeOverride);
00223 
00224     addVolumeControls(tab, "GameOptions_Volume.");
00225 
00226     //
00227     // 6) The MIDI tab
00228     //
00229     _globalMIDIOverride = NULL;
00230     if (!_guioptions.contains(GUIO_NOMIDI)) {
00231         tab->addTab(_("MIDI"));
00232 
00233         if (g_system->getOverlayWidth() > 320)
00234             _globalMIDIOverride = new CheckboxWidget(tab, "GameOptions_MIDI.EnableTabCheckbox", _("Override global MIDI settings"), 0, kCmdGlobalMIDIOverride);
00235         else
00236             _globalMIDIOverride = new CheckboxWidget(tab, "GameOptions_MIDI.EnableTabCheckbox", _c("Override global MIDI settings", "lowres"), 0, kCmdGlobalMIDIOverride);
00237 
00238         addMIDIControls(tab, "GameOptions_MIDI.");
00239     }
00240 
00241     //
00242     // 7) The MT-32 tab
00243     //
00244     _globalMT32Override = NULL;
00245     if (!_guioptions.contains(GUIO_NOMIDI)) {
00246         tab->addTab(_("MT-32"));
00247 
00248         if (g_system->getOverlayWidth() > 320)
00249             _globalMT32Override = new CheckboxWidget(tab, "GameOptions_MT32.EnableTabCheckbox", _("Override global MT-32 settings"), 0, kCmdGlobalMT32Override);
00250         else
00251             _globalMT32Override = new CheckboxWidget(tab, "GameOptions_MT32.EnableTabCheckbox", _c("Override global MT-32 settings", "lowres"), 0, kCmdGlobalMT32Override);
00252 
00253         addMT32Controls(tab, "GameOptions_MT32.");
00254     }
00255 
00256     //
00257     // 8) The Paths tab
00258     //
00259     if (g_system->getOverlayWidth() > 320)
00260         tab->addTab(_("Paths"));
00261     else
00262         tab->addTab(_c("Paths", "lowres"));
00263 
00264     // These buttons have to be extra wide, or the text will be truncated
00265     // in the small version of the GUI.
00266 
00267     // GUI:  Button + Label for the game path
00268     if (g_system->getOverlayWidth() > 320)
00269         new ButtonWidget(tab, "GameOptions_Paths.Gamepath", _("Game Path:"), 0, kCmdGameBrowser);
00270     else
00271         new ButtonWidget(tab, "GameOptions_Paths.Gamepath", _c("Game Path:", "lowres"), 0, kCmdGameBrowser);
00272     _gamePathWidget = new StaticTextWidget(tab, "GameOptions_Paths.GamepathText", gamePath);
00273 
00274     // GUI:  Button + Label for the additional path
00275     if (g_system->getOverlayWidth() > 320)
00276         new ButtonWidget(tab, "GameOptions_Paths.Extrapath", _("Extra Path:"), _("Specifies path to additional data used by the game"), kCmdExtraBrowser);
00277     else
00278         new ButtonWidget(tab, "GameOptions_Paths.Extrapath", _c("Extra Path:", "lowres"), _("Specifies path to additional data used by the game"), kCmdExtraBrowser);
00279     _extraPathWidget = new StaticTextWidget(tab, "GameOptions_Paths.ExtrapathText", extraPath, _("Specifies path to additional data used by the game"));
00280 
00281     _extraPathClearButton = addClearButton(tab, "GameOptions_Paths.ExtraPathClearButton", kCmdExtraPathClear);
00282 
00283     // GUI:  Button + Label for the save path
00284     if (g_system->getOverlayWidth() > 320)
00285         new ButtonWidget(tab, "GameOptions_Paths.Savepath", _("Save Path:"), _("Specifies where your saved games are put"), kCmdSaveBrowser);
00286     else
00287         new ButtonWidget(tab, "GameOptions_Paths.Savepath", _c("Save Path:", "lowres"), _("Specifies where your saved games are put"), kCmdSaveBrowser);
00288     _savePathWidget = new StaticTextWidget(tab, "GameOptions_Paths.SavepathText", savePath, _("Specifies where your saved games are put"));
00289 
00290     _savePathClearButton = addClearButton(tab, "GameOptions_Paths.SavePathClearButton", kCmdSavePathClear);
00291 
00292     // Activate the first tab
00293     tab->setActiveTab(0);
00294     _tabWidget = tab;
00295 
00296     // Add OK & Cancel buttons
00297     new ButtonWidget(this, "GameOptions.Cancel", _("Cancel"), 0, kCloseCmd);
00298     new ButtonWidget(this, "GameOptions.Ok", _("OK"), 0, kOKCmd);
00299 }
00300 
00301 void EditGameDialog::setupGraphicsTab() {
00302     OptionsDialog::setupGraphicsTab();
00303     _globalGraphicsOverride->setVisible(true);
00304 }
00305 
00306 void EditGameDialog::open() {
00307     OptionsDialog::open();
00308 
00309     String extraPath(ConfMan.get("extrapath", _domain));
00310     if (extraPath.empty() || !ConfMan.hasKey("extrapath", _domain)) {
00311         _extraPathWidget->setLabel(_c("None", "path"));
00312     }
00313 
00314     String savePath(ConfMan.get("savepath", _domain));
00315     if (savePath.empty() || !ConfMan.hasKey("savepath", _domain)) {
00316         _savePathWidget->setLabel(_("Default"));
00317     }
00318 
00319     int sel, i;
00320     bool e;
00321 
00322     // En-/disable dialog items depending on whether overrides are active or not.
00323 
00324     e = ConfMan.hasKey("gfx_mode", _domain) ||
00325         ConfMan.hasKey("render_mode", _domain) ||
00326         ConfMan.hasKey("fullscreen", _domain) ||
00327         ConfMan.hasKey("aspect_ratio", _domain);
00328     _globalGraphicsOverride->setState(e);
00329 
00330     e = ConfMan.hasKey("music_driver", _domain) ||
00331         ConfMan.hasKey("output_rate", _domain) ||
00332         ConfMan.hasKey("opl_driver", _domain) ||
00333         ConfMan.hasKey("subtitles", _domain) ||
00334         ConfMan.hasKey("talkspeed", _domain);
00335     _globalAudioOverride->setState(e);
00336 
00337     e = ConfMan.hasKey("music_volume", _domain) ||
00338         ConfMan.hasKey("sfx_volume", _domain) ||
00339         ConfMan.hasKey("speech_volume", _domain);
00340     _globalVolumeOverride->setState(e);
00341 
00342     if (!_guioptions.contains(GUIO_NOMIDI)) {
00343         e = ConfMan.hasKey("soundfont", _domain) ||
00344             ConfMan.hasKey("multi_midi", _domain) ||
00345             ConfMan.hasKey("midi_gain", _domain);
00346         _globalMIDIOverride->setState(e);
00347     }
00348 
00349     if (!_guioptions.contains(GUIO_NOMIDI)) {
00350         e = ConfMan.hasKey("native_mt32", _domain) ||
00351             ConfMan.hasKey("enable_gs", _domain);
00352         _globalMT32Override->setState(e);
00353     }
00354 
00355     // TODO: game path
00356 
00357     const Common::Language lang = Common::parseLanguage(ConfMan.get("language", _domain));
00358 
00359     if (ConfMan.hasKey("language", _domain)) {
00360         _langPopUp->setSelectedTag(lang);
00361     } else {
00362         _langPopUp->setSelectedTag((uint32)Common::UNK_LANG);
00363     }
00364 
00365     if (_langPopUp->numEntries() <= 3) { // If only one language is avaliable
00366         _langPopUpDesc->setEnabled(false);
00367         _langPopUp->setEnabled(false);
00368     }
00369 
00370     // Set the state of engine-specific checkboxes
00371     for (uint j = 0; j < _engineOptions.size(); ++j) {
00372         // The default values for engine-specific checkboxes are not set when
00373         // ScummVM starts, as this would require us to load and poll all of the
00374         // engine plugins on startup. Thus, we set the state of each custom
00375         // option checkbox to what is specified by the engine plugin, and
00376         // update it only if a value has been set in the configuration of the
00377         // currently selected game.
00378         bool isChecked = _engineOptions[j].defaultState;
00379         if (ConfMan.hasKey(_engineOptions[j].configOption, _domain))
00380             isChecked = ConfMan.getBool(_engineOptions[j].configOption, _domain);
00381         _engineCheckboxes[j]->setState(isChecked);
00382     }
00383 
00384     const Common::PlatformDescription *p = Common::g_platforms;
00385     const Common::Platform platform = Common::parsePlatform(ConfMan.get("platform", _domain));
00386     sel = 0;
00387     for (i = 0; p->code; ++p, ++i) {
00388         if (platform == p->id)
00389             sel = i + 2;
00390     }
00391     _platformPopUp->setSelected(sel);
00392 }
00393 
00394 void EditGameDialog::apply() {
00395     ConfMan.set("description", _descriptionWidget->getEditString(), _domain);
00396 
00397     Common::Language lang = (Common::Language)_langPopUp->getSelectedTag();
00398     if (lang < 0)
00399         ConfMan.removeKey("language", _domain);
00400     else
00401         ConfMan.set("language", Common::getLanguageCode(lang), _domain);
00402 
00403     String gamePath(_gamePathWidget->getLabel());
00404     if (!gamePath.empty())
00405         ConfMan.set("path", gamePath, _domain);
00406 
00407     String extraPath(_extraPathWidget->getLabel());
00408     if (!extraPath.empty() && (extraPath != _c("None", "path")))
00409         ConfMan.set("extrapath", extraPath, _domain);
00410     else
00411         ConfMan.removeKey("extrapath", _domain);
00412 
00413     String savePath(_savePathWidget->getLabel());
00414     if (!savePath.empty() && (savePath != _("Default")))
00415         ConfMan.set("savepath", savePath, _domain);
00416     else
00417         ConfMan.removeKey("savepath", _domain);
00418 
00419     Common::Platform platform = (Common::Platform)_platformPopUp->getSelectedTag();
00420     if (platform < 0)
00421         ConfMan.removeKey("platform", _domain);
00422     else
00423         ConfMan.set("platform", Common::getPlatformCode(platform), _domain);
00424 
00425     // Set the state of engine-specific checkboxes
00426     for (uint i = 0; i < _engineOptions.size(); i++) {
00427         ConfMan.setBool(_engineOptions[i].configOption, _engineCheckboxes[i]->getState(), _domain);
00428     }
00429 
00430     OptionsDialog::apply();
00431 }
00432 
00433 void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
00434     switch (cmd) {
00435     case kCmdGlobalGraphicsOverride:
00436         setGraphicSettingsState(data != 0);
00437         g_gui.scheduleTopDialogRedraw();
00438         break;
00439     case kCmdGlobalAudioOverride:
00440         setAudioSettingsState(data != 0);
00441         setSubtitleSettingsState(data != 0);
00442         if (_globalVolumeOverride == NULL)
00443             setVolumeSettingsState(data != 0);
00444         g_gui.scheduleTopDialogRedraw();
00445         break;
00446     case kCmdGlobalMIDIOverride:
00447         setMIDISettingsState(data != 0);
00448         g_gui.scheduleTopDialogRedraw();
00449         break;
00450     case kCmdGlobalMT32Override:
00451         setMT32SettingsState(data != 0);
00452         g_gui.scheduleTopDialogRedraw();
00453         break;
00454     case kCmdGlobalVolumeOverride:
00455         setVolumeSettingsState(data != 0);
00456         g_gui.scheduleTopDialogRedraw();
00457         break;
00458     case kCmdChooseSoundFontCmd:
00459     {
00460         BrowserDialog browser(_("Select SoundFont"), false);
00461 
00462         if (browser.runModal() > 0) {
00463             // User made this choice...
00464             Common::FSNode file(browser.getResult());
00465             _soundFont->setLabel(file.getPath());
00466 
00467             if (!file.getPath().empty() && (file.getPath() != _c("None", "path")))
00468                 _soundFontClearButton->setEnabled(true);
00469             else
00470                 _soundFontClearButton->setEnabled(false);
00471 
00472             g_gui.scheduleTopDialogRedraw();
00473         }
00474         break;
00475     }
00476 
00477     // Change path for the game
00478     case kCmdGameBrowser:
00479     {
00480         BrowserDialog browser(_("Select directory with game data"), true);
00481         if (browser.runModal() > 0) {
00482             // User made his choice...
00483             Common::FSNode dir(browser.getResult());
00484 
00485             // TODO: Verify the game can be found in the new directory... Best
00486             // done with optional specific gameid to pluginmgr detectgames?
00487             // FSList files = dir.listDir(FSNode::kListFilesOnly);
00488 
00489             _gamePathWidget->setLabel(dir.getPath());
00490             g_gui.scheduleTopDialogRedraw();
00491         }
00492         g_gui.scheduleTopDialogRedraw();
00493         break;
00494     }
00495 
00496     // Change path for extra game data (eg, using sword cutscenes when playing via CD)
00497     case kCmdExtraBrowser:
00498     {
00499         BrowserDialog browser(_("Select additional game directory"), true);
00500         if (browser.runModal() > 0) {
00501             // User made his choice...
00502             Common::FSNode dir(browser.getResult());
00503             _extraPathWidget->setLabel(dir.getPath());
00504             g_gui.scheduleTopDialogRedraw();
00505         }
00506         g_gui.scheduleTopDialogRedraw();
00507         break;
00508     }
00509     // Change path for stored save game (perm and temp) data
00510     case kCmdSaveBrowser:
00511     {
00512         BrowserDialog browser(_("Select directory for saved games"), true);
00513         if (browser.runModal() > 0) {
00514             // User made his choice...
00515             Common::FSNode dir(browser.getResult());
00516             _savePathWidget->setLabel(dir.getPath());
00517 #if defined(USE_CLOUD) && defined(USE_LIBCURL)
00518             MessageDialog warningMessage(_("Saved games sync feature doesn't work with non-default directories. If you want your saved games to sync, use default directory."));
00519             warningMessage.runModal();
00520 #endif
00521             g_gui.scheduleTopDialogRedraw();
00522         }
00523         g_gui.scheduleTopDialogRedraw();
00524         break;
00525     }
00526 
00527     case kCmdExtraPathClear:
00528         _extraPathWidget->setLabel(_c("None", "path"));
00529         break;
00530 
00531     case kCmdSavePathClear:
00532         _savePathWidget->setLabel(_("Default"));
00533         break;
00534 
00535     case kOKCmd:
00536     {
00537         // Write back changes made to config object
00538         String newDomain(_domainWidget->getEditString());
00539         if (newDomain != _domain) {
00540             if (newDomain.empty()
00541                 || newDomain.hasPrefix("_")
00542                 || newDomain == ConfigManager::kApplicationDomain
00543                 || ConfMan.hasGameDomain(newDomain)) {
00544                 MessageDialog alert(_("This game ID is already taken. Please choose another one."));
00545                 alert.runModal();
00546                 return;
00547             }
00548             ConfMan.renameGameDomain(_domain, newDomain);
00549             _domain = newDomain;
00550         }
00551     }
00552     // fall through
00553     default:
00554         OptionsDialog::handleCommand(sender, cmd, data);
00555     }
00556 }
00557 
00558 } // End of namespace GUI


Generated on Sat Apr 4 2020 05:00:36 for ResidualVM by doxygen 1.7.1
curved edge   curved edge