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     // Retrieve all game specific options.
00104     const Plugin *plugin = nullptr;
00105     // To allow for game domains without a gameid.
00106     // TODO: Is it intentional that this is still supported?
00107     String gameId(ConfMan.get("gameid", domain));
00108     if (gameId.empty())
00109         gameId = domain;
00110     // Retrieve the plugin, since we need to access the engine's MetaEngine
00111     // implementation.
00112     PlainGameDescriptor pgd = EngineMan.findGame(gameId, &plugin);
00113     if (plugin) {
00114         _engineOptions = plugin->get<MetaEngine>().getExtraGuiOptions(domain);
00115     } else {
00116         warning("Plugin for target \"%s\" not found! Game specific settings might be missing", domain.c_str());
00117     }
00118 
00119     // GAME: Path to game data (r/o), extra data (r/o), and save data (r/w)
00120     String gamePath(ConfMan.get("path", _domain));
00121     String extraPath(ConfMan.get("extrapath", _domain));
00122     String savePath(ConfMan.get("savepath", _domain));
00123 
00124     // GAME: Determine the description string
00125     String description(ConfMan.get("description", domain));
00126     if (description.empty() && pgd.description) {
00127         description = pgd.description;
00128     }
00129 
00130     // GUI:  Add tab widget
00131     TabWidget *tab = new TabWidget(this, "GameOptions.TabWidget");
00132 
00133     //
00134     // 1) The game tab
00135     //
00136     tab->addTab(_("Game"));
00137 
00138     // GUI:  Label & edit widget for the game ID
00139     if (g_system->getOverlayWidth() > 320)
00140         new StaticTextWidget(tab, "GameOptions_Game.Id", _("ID:"), _("Short game identifier used for referring to saved games and running the game from the command line"));
00141     else
00142         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"));
00143     _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"));
00144 
00145     // GUI:  Label & edit widget for the description
00146     if (g_system->getOverlayWidth() > 320)
00147         new StaticTextWidget(tab, "GameOptions_Game.Name", _("Name:"), _("Full title of the game"));
00148     else
00149         new StaticTextWidget(tab, "GameOptions_Game.Name", _c("Name:", "lowres"), _("Full title of the game"));
00150     _descriptionWidget = new EditTextWidget(tab, "GameOptions_Game.Desc", description, _("Full title of the game"));
00151 
00152     // Language popup
00153     _langPopUpDesc = new StaticTextWidget(tab, "GameOptions_Game.LangPopupDesc", _("Language:"), _("Language of the game. This will not turn your Spanish game version into English"));
00154     _langPopUp = new PopUpWidget(tab, "GameOptions_Game.LangPopup", _("Language of the game. This will not turn your Spanish game version into English"));
00155     _langPopUp->appendEntry(_("<default>"), (uint32)Common::UNK_LANG);
00156     _langPopUp->appendEntry("", (uint32)Common::UNK_LANG);
00157     const Common::LanguageDescription *l = Common::g_languages;
00158     for (; l->code; ++l) {
00159         if (checkGameGUIOptionLanguage(l->id, _guioptionsString))
00160             _langPopUp->appendEntry(l->description, l->id);
00161     }
00162 
00163     // Platform popup
00164     if (g_system->getOverlayWidth() > 320)
00165         _platformPopUpDesc = new StaticTextWidget(tab, "GameOptions_Game.PlatformPopupDesc", _("Platform:"), _("Platform the game was originally designed for"));
00166     else
00167         _platformPopUpDesc = new StaticTextWidget(tab, "GameOptions_Game.PlatformPopupDesc", _c("Platform:", "lowres"), _("Platform the game was originally designed for"));
00168     _platformPopUp = new PopUpWidget(tab, "GameOptions_Game.PlatformPopup", _("Platform the game was originally designed for"));
00169     _platformPopUp->appendEntry(_("<default>"));
00170     _platformPopUp->appendEntry("");
00171     const Common::PlatformDescription *p = Common::g_platforms;
00172     for (; p->code; ++p) {
00173         _platformPopUp->appendEntry(p->description, p->id);
00174     }
00175 
00176     //
00177     // 2) The engine tab (shown only if there are custom engine options)
00178     //
00179     if (_engineOptions.size() > 0) {
00180         tab->addTab(_("Engine"));
00181 
00182         addEngineControls(tab, "GameOptions_Engine.", _engineOptions);
00183     }
00184 
00185     //
00186     // 3) The graphics tab
00187     //
00188     _graphicsTabId = tab->addTab(g_system->getOverlayWidth() > 320 ? _("Graphics") : _("GFX"));
00189     ScrollContainerWidget *graphicsContainer = new ScrollContainerWidget(tab, "GameOptions_Graphics.Container", kGraphicsTabContainerReflowCmd);
00190     graphicsContainer->setBackgroundType(ThemeEngine::kDialogBackgroundNone);
00191     graphicsContainer->setTarget(this);
00192 
00193     if (g_system->getOverlayWidth() > 320)
00194         _globalGraphicsOverride = new CheckboxWidget(graphicsContainer, "GameOptions_Graphics_Container.EnableTabCheckbox", _("Override global graphic settings"), 0, kCmdGlobalGraphicsOverride);
00195     else
00196         _globalGraphicsOverride = new CheckboxWidget(graphicsContainer, "GameOptions_Graphics_Container.EnableTabCheckbox", _c("Override global graphic settings", "lowres"), 0, kCmdGlobalGraphicsOverride);
00197 
00198     addGraphicControls(graphicsContainer, "GameOptions_Graphics_Container.");
00199 
00200     //
00201     // 4) The audio tab
00202     //
00203     tab->addTab(_("Audio"));
00204 
00205     if (g_system->getOverlayWidth() > 320)
00206         _globalAudioOverride = new CheckboxWidget(tab, "GameOptions_Audio.EnableTabCheckbox", _("Override global audio settings"), 0, kCmdGlobalAudioOverride);
00207     else
00208         _globalAudioOverride = new CheckboxWidget(tab, "GameOptions_Audio.EnableTabCheckbox", _c("Override global audio settings", "lowres"), 0, kCmdGlobalAudioOverride);
00209 
00210     addAudioControls(tab, "GameOptions_Audio.");
00211     addSubtitleControls(tab, "GameOptions_Audio.");
00212 
00213     //
00214     // 5) The volume tab
00215     //
00216     if (g_system->getOverlayWidth() > 320)
00217         tab->addTab(_("Volume"));
00218     else
00219         tab->addTab(_c("Volume", "lowres"));
00220 
00221     if (g_system->getOverlayWidth() > 320)
00222         _globalVolumeOverride = new CheckboxWidget(tab, "GameOptions_Volume.EnableTabCheckbox", _("Override global volume settings"), 0, kCmdGlobalVolumeOverride);
00223     else
00224         _globalVolumeOverride = new CheckboxWidget(tab, "GameOptions_Volume.EnableTabCheckbox", _c("Override global volume settings", "lowres"), 0, kCmdGlobalVolumeOverride);
00225 
00226     addVolumeControls(tab, "GameOptions_Volume.");
00227 
00228     //
00229     // 6) The MIDI tab
00230     //
00231     _globalMIDIOverride = NULL;
00232     if (!_guioptions.contains(GUIO_NOMIDI)) {
00233         tab->addTab(_("MIDI"));
00234 
00235         if (g_system->getOverlayWidth() > 320)
00236             _globalMIDIOverride = new CheckboxWidget(tab, "GameOptions_MIDI.EnableTabCheckbox", _("Override global MIDI settings"), 0, kCmdGlobalMIDIOverride);
00237         else
00238             _globalMIDIOverride = new CheckboxWidget(tab, "GameOptions_MIDI.EnableTabCheckbox", _c("Override global MIDI settings", "lowres"), 0, kCmdGlobalMIDIOverride);
00239 
00240         addMIDIControls(tab, "GameOptions_MIDI.");
00241     }
00242 
00243     //
00244     // 7) The MT-32 tab
00245     //
00246     _globalMT32Override = NULL;
00247     if (!_guioptions.contains(GUIO_NOMIDI)) {
00248         tab->addTab(_("MT-32"));
00249 
00250         if (g_system->getOverlayWidth() > 320)
00251             _globalMT32Override = new CheckboxWidget(tab, "GameOptions_MT32.EnableTabCheckbox", _("Override global MT-32 settings"), 0, kCmdGlobalMT32Override);
00252         else
00253             _globalMT32Override = new CheckboxWidget(tab, "GameOptions_MT32.EnableTabCheckbox", _c("Override global MT-32 settings", "lowres"), 0, kCmdGlobalMT32Override);
00254 
00255         addMT32Controls(tab, "GameOptions_MT32.");
00256     }
00257 
00258     //
00259     // 8) The Paths tab
00260     //
00261     if (g_system->getOverlayWidth() > 320)
00262         tab->addTab(_("Paths"));
00263     else
00264         tab->addTab(_c("Paths", "lowres"));
00265 
00266     // These buttons have to be extra wide, or the text will be truncated
00267     // in the small version of the GUI.
00268 
00269     // GUI:  Button + Label for the game path
00270     if (g_system->getOverlayWidth() > 320)
00271         new ButtonWidget(tab, "GameOptions_Paths.Gamepath", _("Game Path:"), 0, kCmdGameBrowser);
00272     else
00273         new ButtonWidget(tab, "GameOptions_Paths.Gamepath", _c("Game Path:", "lowres"), 0, kCmdGameBrowser);
00274     _gamePathWidget = new StaticTextWidget(tab, "GameOptions_Paths.GamepathText", gamePath);
00275 
00276     // GUI:  Button + Label for the additional path
00277     if (g_system->getOverlayWidth() > 320)
00278         new ButtonWidget(tab, "GameOptions_Paths.Extrapath", _("Extra Path:"), _("Specifies path to additional data used by the game"), kCmdExtraBrowser);
00279     else
00280         new ButtonWidget(tab, "GameOptions_Paths.Extrapath", _c("Extra Path:", "lowres"), _("Specifies path to additional data used by the game"), kCmdExtraBrowser);
00281     _extraPathWidget = new StaticTextWidget(tab, "GameOptions_Paths.ExtrapathText", extraPath, _("Specifies path to additional data used by the game"));
00282 
00283     _extraPathClearButton = addClearButton(tab, "GameOptions_Paths.ExtraPathClearButton", kCmdExtraPathClear);
00284 
00285     // GUI:  Button + Label for the save path
00286     if (g_system->getOverlayWidth() > 320)
00287         new ButtonWidget(tab, "GameOptions_Paths.Savepath", _("Save Path:"), _("Specifies where your saved games are put"), kCmdSaveBrowser);
00288     else
00289         new ButtonWidget(tab, "GameOptions_Paths.Savepath", _c("Save Path:", "lowres"), _("Specifies where your saved games are put"), kCmdSaveBrowser);
00290     _savePathWidget = new StaticTextWidget(tab, "GameOptions_Paths.SavepathText", savePath, _("Specifies where your saved games are put"));
00291 
00292     _savePathClearButton = addClearButton(tab, "GameOptions_Paths.SavePathClearButton", kCmdSavePathClear);
00293 
00294     // Activate the first tab
00295     tab->setActiveTab(0);
00296     _tabWidget = tab;
00297 
00298     // Add OK & Cancel buttons
00299     new ButtonWidget(this, "GameOptions.Cancel", _("Cancel"), 0, kCloseCmd);
00300     new ButtonWidget(this, "GameOptions.Ok", _("OK"), 0, kOKCmd);
00301 }
00302 
00303 void EditGameDialog::setupGraphicsTab() {
00304     OptionsDialog::setupGraphicsTab();
00305     _globalGraphicsOverride->setVisible(true);
00306 }
00307 
00308 void EditGameDialog::open() {
00309     OptionsDialog::open();
00310 
00311     String extraPath(ConfMan.get("extrapath", _domain));
00312     if (extraPath.empty() || !ConfMan.hasKey("extrapath", _domain)) {
00313         _extraPathWidget->setLabel(_c("None", "path"));
00314     }
00315 
00316     String savePath(ConfMan.get("savepath", _domain));
00317     if (savePath.empty() || !ConfMan.hasKey("savepath", _domain)) {
00318         _savePathWidget->setLabel(_("Default"));
00319     }
00320 
00321     int sel, i;
00322     bool e;
00323 
00324     // En-/disable dialog items depending on whether overrides are active or not.
00325 
00326     e = ConfMan.hasKey("gfx_mode", _domain) ||
00327         ConfMan.hasKey("render_mode", _domain) ||
00328         ConfMan.hasKey("fullscreen", _domain) ||
00329         ConfMan.hasKey("aspect_ratio", _domain);
00330     _globalGraphicsOverride->setState(e);
00331 
00332     e = ConfMan.hasKey("music_driver", _domain) ||
00333         ConfMan.hasKey("output_rate", _domain) ||
00334         ConfMan.hasKey("opl_driver", _domain) ||
00335         ConfMan.hasKey("subtitles", _domain) ||
00336         ConfMan.hasKey("talkspeed", _domain);
00337     _globalAudioOverride->setState(e);
00338 
00339     e = ConfMan.hasKey("music_volume", _domain) ||
00340         ConfMan.hasKey("sfx_volume", _domain) ||
00341         ConfMan.hasKey("speech_volume", _domain);
00342     _globalVolumeOverride->setState(e);
00343 
00344     if (!_guioptions.contains(GUIO_NOMIDI)) {
00345         e = ConfMan.hasKey("soundfont", _domain) ||
00346             ConfMan.hasKey("multi_midi", _domain) ||
00347             ConfMan.hasKey("midi_gain", _domain);
00348         _globalMIDIOverride->setState(e);
00349     }
00350 
00351     if (!_guioptions.contains(GUIO_NOMIDI)) {
00352         e = ConfMan.hasKey("native_mt32", _domain) ||
00353             ConfMan.hasKey("enable_gs", _domain);
00354         _globalMT32Override->setState(e);
00355     }
00356 
00357     // TODO: game path
00358 
00359     const Common::Language lang = Common::parseLanguage(ConfMan.get("language", _domain));
00360 
00361     if (ConfMan.hasKey("language", _domain)) {
00362         _langPopUp->setSelectedTag(lang);
00363     } else {
00364         _langPopUp->setSelectedTag((uint32)Common::UNK_LANG);
00365     }
00366 
00367     if (_langPopUp->numEntries() <= 3) { // If only one language is avaliable
00368         _langPopUpDesc->setEnabled(false);
00369         _langPopUp->setEnabled(false);
00370     }
00371 
00372     // Set the state of engine-specific checkboxes
00373     for (uint j = 0; j < _engineOptions.size(); ++j) {
00374         // The default values for engine-specific checkboxes are not set when
00375         // ScummVM starts, as this would require us to load and poll all of the
00376         // engine plugins on startup. Thus, we set the state of each custom
00377         // option checkbox to what is specified by the engine plugin, and
00378         // update it only if a value has been set in the configuration of the
00379         // currently selected game.
00380         bool isChecked = _engineOptions[j].defaultState;
00381         if (ConfMan.hasKey(_engineOptions[j].configOption, _domain))
00382             isChecked = ConfMan.getBool(_engineOptions[j].configOption, _domain);
00383         _engineCheckboxes[j]->setState(isChecked);
00384     }
00385 
00386     const Common::PlatformDescription *p = Common::g_platforms;
00387     const Common::Platform platform = Common::parsePlatform(ConfMan.get("platform", _domain));
00388     sel = 0;
00389     for (i = 0; p->code; ++p, ++i) {
00390         if (platform == p->id)
00391             sel = i + 2;
00392     }
00393     _platformPopUp->setSelected(sel);
00394 }
00395 
00396 void EditGameDialog::apply() {
00397     ConfMan.set("description", _descriptionWidget->getEditString(), _domain);
00398 
00399     Common::Language lang = (Common::Language)_langPopUp->getSelectedTag();
00400     if (lang < 0)
00401         ConfMan.removeKey("language", _domain);
00402     else
00403         ConfMan.set("language", Common::getLanguageCode(lang), _domain);
00404 
00405     String gamePath(_gamePathWidget->getLabel());
00406     if (!gamePath.empty())
00407         ConfMan.set("path", gamePath, _domain);
00408 
00409     String extraPath(_extraPathWidget->getLabel());
00410     if (!extraPath.empty() && (extraPath != _c("None", "path")))
00411         ConfMan.set("extrapath", extraPath, _domain);
00412     else
00413         ConfMan.removeKey("extrapath", _domain);
00414 
00415     String savePath(_savePathWidget->getLabel());
00416     if (!savePath.empty() && (savePath != _("Default")))
00417         ConfMan.set("savepath", savePath, _domain);
00418     else
00419         ConfMan.removeKey("savepath", _domain);
00420 
00421     Common::Platform platform = (Common::Platform)_platformPopUp->getSelectedTag();
00422     if (platform < 0)
00423         ConfMan.removeKey("platform", _domain);
00424     else
00425         ConfMan.set("platform", Common::getPlatformCode(platform), _domain);
00426 
00427     // Set the state of engine-specific checkboxes
00428     for (uint i = 0; i < _engineOptions.size(); i++) {
00429         ConfMan.setBool(_engineOptions[i].configOption, _engineCheckboxes[i]->getState(), _domain);
00430     }
00431 
00432     OptionsDialog::apply();
00433 }
00434 
00435 void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
00436     switch (cmd) {
00437     case kCmdGlobalGraphicsOverride:
00438         setGraphicSettingsState(data != 0);
00439         g_gui.scheduleTopDialogRedraw();
00440         break;
00441     case kCmdGlobalAudioOverride:
00442         setAudioSettingsState(data != 0);
00443         setSubtitleSettingsState(data != 0);
00444         if (_globalVolumeOverride == NULL)
00445             setVolumeSettingsState(data != 0);
00446         g_gui.scheduleTopDialogRedraw();
00447         break;
00448     case kCmdGlobalMIDIOverride:
00449         setMIDISettingsState(data != 0);
00450         g_gui.scheduleTopDialogRedraw();
00451         break;
00452     case kCmdGlobalMT32Override:
00453         setMT32SettingsState(data != 0);
00454         g_gui.scheduleTopDialogRedraw();
00455         break;
00456     case kCmdGlobalVolumeOverride:
00457         setVolumeSettingsState(data != 0);
00458         g_gui.scheduleTopDialogRedraw();
00459         break;
00460     case kCmdChooseSoundFontCmd:
00461     {
00462         BrowserDialog browser(_("Select SoundFont"), false);
00463 
00464         if (browser.runModal() > 0) {
00465             // User made this choice...
00466             Common::FSNode file(browser.getResult());
00467             _soundFont->setLabel(file.getPath());
00468 
00469             if (!file.getPath().empty() && (file.getPath() != _c("None", "path")))
00470                 _soundFontClearButton->setEnabled(true);
00471             else
00472                 _soundFontClearButton->setEnabled(false);
00473 
00474             g_gui.scheduleTopDialogRedraw();
00475         }
00476         break;
00477     }
00478 
00479     // Change path for the game
00480     case kCmdGameBrowser:
00481     {
00482         BrowserDialog browser(_("Select directory with game data"), true);
00483         if (browser.runModal() > 0) {
00484             // User made his choice...
00485             Common::FSNode dir(browser.getResult());
00486 
00487             // TODO: Verify the game can be found in the new directory... Best
00488             // done with optional specific gameid to pluginmgr detectgames?
00489             // FSList files = dir.listDir(FSNode::kListFilesOnly);
00490 
00491             _gamePathWidget->setLabel(dir.getPath());
00492             g_gui.scheduleTopDialogRedraw();
00493         }
00494         g_gui.scheduleTopDialogRedraw();
00495         break;
00496     }
00497 
00498     // Change path for extra game data (eg, using sword cutscenes when playing via CD)
00499     case kCmdExtraBrowser:
00500     {
00501         BrowserDialog browser(_("Select additional game directory"), true);
00502         if (browser.runModal() > 0) {
00503             // User made his choice...
00504             Common::FSNode dir(browser.getResult());
00505             _extraPathWidget->setLabel(dir.getPath());
00506             g_gui.scheduleTopDialogRedraw();
00507         }
00508         g_gui.scheduleTopDialogRedraw();
00509         break;
00510     }
00511     // Change path for stored save game (perm and temp) data
00512     case kCmdSaveBrowser:
00513     {
00514         BrowserDialog browser(_("Select directory for saved games"), true);
00515         if (browser.runModal() > 0) {
00516             // User made his choice...
00517             Common::FSNode dir(browser.getResult());
00518             _savePathWidget->setLabel(dir.getPath());
00519 #if defined(USE_CLOUD) && defined(USE_LIBCURL)
00520             MessageDialog warningMessage(_("Saved games sync feature doesn't work with non-default directories. If you want your saved games to sync, use default directory."));
00521             warningMessage.runModal();
00522 #endif
00523             g_gui.scheduleTopDialogRedraw();
00524         }
00525         g_gui.scheduleTopDialogRedraw();
00526         break;
00527     }
00528 
00529     case kCmdExtraPathClear:
00530         _extraPathWidget->setLabel(_c("None", "path"));
00531         break;
00532 
00533     case kCmdSavePathClear:
00534         _savePathWidget->setLabel(_("Default"));
00535         break;
00536 
00537     case kOKCmd:
00538     {
00539         // Write back changes made to config object
00540         String newDomain(_domainWidget->getEditString());
00541         if (newDomain != _domain) {
00542             if (newDomain.empty()
00543                 || newDomain.hasPrefix("_")
00544                 || newDomain == ConfigManager::kApplicationDomain
00545                 || ConfMan.hasGameDomain(newDomain)) {
00546                 MessageDialog alert(_("This game ID is already taken. Please choose another one."));
00547                 alert.runModal();
00548                 return;
00549             }
00550             ConfMan.renameGameDomain(_domain, newDomain);
00551             _domain = newDomain;
00552         }
00553     }
00554     // fall through
00555     default:
00556         OptionsDialog::handleCommand(sender, cmd, data);
00557     }
00558 }
00559 
00560 } // End of namespace GUI


Generated on Sat Mar 16 2019 05:01:26 for ResidualVM by doxygen 1.7.1
curved edge   curved edge