diff options
author | Johannes Schickel | 2012-06-10 04:14:17 +0200 |
---|---|---|
committer | Johannes Schickel | 2012-06-10 04:19:45 +0200 |
commit | 15046a7529e3c755de1f00b4a2666786eb2bd4f8 (patch) | |
tree | 44ebb357905b837264abc117713d49ff47619239 | |
parent | 0e5ae35e345d6e7f38177e158dcc871cf7a034d3 (diff) | |
download | scummvm-rg350-15046a7529e3c755de1f00b4a2666786eb2bd4f8.tar.gz scummvm-rg350-15046a7529e3c755de1f00b4a2666786eb2bd4f8.tar.bz2 scummvm-rg350-15046a7529e3c755de1f00b4a2666786eb2bd4f8.zip |
GUI: Get rid of SaveLoadChooser::setSaveMode.
We already pass the title and process button name to the constructor of
SaveLoadChooser and then do not offer any way of changing it, thus changing
the edit mode of the chooser is kind of pointless and was never actually used.
Instead we pass the mode on SaveLoadChooser construction now.
-rw-r--r-- | engines/agi/saveload.cpp | 6 | ||||
-rw-r--r-- | engines/cge/events.cpp | 6 | ||||
-rw-r--r-- | engines/cruise/menu.cpp | 5 | ||||
-rw-r--r-- | engines/dialogs.cpp | 6 | ||||
-rw-r--r-- | engines/dreamweb/saveload.cpp | 6 | ||||
-rw-r--r-- | engines/hugo/file.cpp | 6 | ||||
-rw-r--r-- | engines/mohawk/myst.cpp | 3 | ||||
-rw-r--r-- | engines/mohawk/riven.cpp | 3 | ||||
-rw-r--r-- | engines/parallaction/saveload.cpp | 3 | ||||
-rw-r--r-- | engines/sci/engine/kfile.cpp | 6 | ||||
-rw-r--r-- | engines/toon/toon.cpp | 6 | ||||
-rw-r--r-- | engines/tsage/scenes.cpp | 6 | ||||
-rw-r--r-- | gui/launcher.cpp | 2 | ||||
-rw-r--r-- | gui/saveload.cpp | 8 | ||||
-rw-r--r-- | gui/saveload.h | 3 |
15 files changed, 25 insertions, 50 deletions
diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp index d58e55a6b9..cb7792af8e 100644 --- a/engines/agi/saveload.cpp +++ b/engines/agi/saveload.cpp @@ -802,8 +802,7 @@ int AgiEngine::scummVMSaveLoadDialog(bool isSave) { int slot; if (isSave) { - dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save")); - dialog->setSaveMode(true); + dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true); slot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); desc = dialog->getResultString(); @@ -824,8 +823,7 @@ int AgiEngine::scummVMSaveLoadDialog(bool isSave) { if (desc.size() > 28) desc = Common::String(desc.c_str(), 28); } else { - dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore")); - dialog->setSaveMode(false); + dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false); slot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); } diff --git a/engines/cge/events.cpp b/engines/cge/events.cpp index 3c561c5659..e903584100 100644 --- a/engines/cge/events.cpp +++ b/engines/cge/events.cpp @@ -73,8 +73,7 @@ bool Keyboard::getKey(Common::Event &event) { const EnginePlugin *plugin = NULL; EngineMan.findGame(_vm->_gameDescription->gameid, &plugin); - GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Save game:", "Save"); - dialog->setSaveMode(true); + GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Save game:", "Save", true); int16 savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); Common::String savegameDescription = dialog->getResultString(); delete dialog; @@ -88,8 +87,7 @@ bool Keyboard::getKey(Common::Event &event) { const EnginePlugin *plugin = NULL; EngineMan.findGame(_vm->_gameDescription->gameid, &plugin); - GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Restore game:", "Restore"); - dialog->setSaveMode(false); + GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Restore game:", "Restore", false); int16 savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); delete dialog; diff --git a/engines/cruise/menu.cpp b/engines/cruise/menu.cpp index e763e2b8a1..988355e777 100644 --- a/engines/cruise/menu.cpp +++ b/engines/cruise/menu.cpp @@ -211,11 +211,10 @@ static void handleSaveLoad(bool saveFlag) { EngineMan.findGame(_vm->getGameId(), &plugin); GUI::SaveLoadChooser *dialog; if (saveFlag) - dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save")); + dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true); else - dialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load")); + dialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load"), false); - dialog->setSaveMode(saveFlag); int slot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); if (slot >= 0) { diff --git a/engines/dialogs.cpp b/engines/dialogs.cpp index 1b54c7e26a..3fa01ddcbf 100644 --- a/engines/dialogs.cpp +++ b/engines/dialogs.cpp @@ -111,10 +111,8 @@ MainMenuDialog::MainMenuDialog(Engine *engine) _aboutDialog = new GUI::AboutDialog(); _optionsDialog = new ConfigDialog(_engine->hasFeature(Engine::kSupportsSubtitleOptions)); - _loadDialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load")); - _loadDialog->setSaveMode(false); - _saveDialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save")); - _saveDialog->setSaveMode(true); + _loadDialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load"), false); + _saveDialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true); } MainMenuDialog::~MainMenuDialog() { diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp index c8fb537fec..e659c03e13 100644 --- a/engines/dreamweb/saveload.cpp +++ b/engines/dreamweb/saveload.cpp @@ -161,8 +161,7 @@ void DreamWebEngine::doLoad(int savegameId) { const EnginePlugin *plugin = NULL; Common::String gameId = ConfMan.get("gameid"); EngineMan.findGame(gameId, &plugin); - GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore")); - dialog->setSaveMode(false); + GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false); savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); delete dialog; } @@ -248,8 +247,7 @@ void DreamWebEngine::saveGame() { const EnginePlugin *plugin = NULL; Common::String gameId = ConfMan.get("gameid"); EngineMan.findGame(gameId, &plugin); - GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save")); - dialog->setSaveMode(true); + GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true); int savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); Common::String game_description = dialog->getResultString(); if (game_description.empty()) diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp index 2217cef92a..3c94b2ee3d 100644 --- a/engines/hugo/file.cpp +++ b/engines/hugo/file.cpp @@ -336,8 +336,7 @@ bool FileManager::saveGame(const int16 slot, const Common::String &descrip) { EngineMan.findGame(_vm->getGameId(), &plugin); if (slot == -1) { - GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Save game:", "Save"); - dialog->setSaveMode(true); + GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Save game:", "Save", true); savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); savegameDescription = dialog->getResultString(); delete dialog; @@ -441,8 +440,7 @@ bool FileManager::restoreGame(const int16 slot) { EngineMan.findGame(_vm->getGameId(), &plugin); if (slot == -1) { - GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Restore game:", "Restore"); - dialog->setSaveMode(false); + GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Restore game:", "Restore", false); savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); delete dialog; } else { diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp index c22b30ad4d..0efd412bd0 100644 --- a/engines/mohawk/myst.cpp +++ b/engines/mohawk/myst.cpp @@ -252,8 +252,7 @@ Common::Error MohawkEngine_Myst::run() { _gfx = new MystGraphics(this); _console = new MystConsole(this); _gameState = new MystGameState(this, _saveFileMan); - _loadDialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load")); - _loadDialog->setSaveMode(false); + _loadDialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load"), false); _optionsDialog = new MystOptionsDialog(this); _cursor = new MystCursorManager(this); _rnd = new Common::RandomSource("myst"); diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp index 07b1b59929..b7866a3cb7 100644 --- a/engines/mohawk/riven.cpp +++ b/engines/mohawk/riven.cpp @@ -713,8 +713,7 @@ void MohawkEngine_Riven::delayAndUpdate(uint32 ms) { } void MohawkEngine_Riven::runLoadDialog() { - GUI::SaveLoadChooser slc(_("Load game:"), _("Load")); - slc.setSaveMode(false); + GUI::SaveLoadChooser slc(_("Load game:"), _("Load"), false); Common::String gameId = ConfMan.get("gameid"); diff --git a/engines/parallaction/saveload.cpp b/engines/parallaction/saveload.cpp index 3ab25f203f..3bd736b915 100644 --- a/engines/parallaction/saveload.cpp +++ b/engines/parallaction/saveload.cpp @@ -180,8 +180,7 @@ void SaveLoad_ns::doSaveGame(uint16 slot, const char* name) { } int SaveLoad::selectSaveFile(Common::String &selectedName, bool saveMode, const Common::String &caption, const Common::String &button) { - GUI::SaveLoadChooser slc(caption, button); - slc.setSaveMode(saveMode); + GUI::SaveLoadChooser slc(caption, button, saveMode); selectedName.clear(); diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp index 8d1b078697..6c40be87e2 100644 --- a/engines/sci/engine/kfile.cpp +++ b/engines/sci/engine/kfile.cpp @@ -564,8 +564,7 @@ reg_t kSaveGame(EngineState *s, int argc, reg_t *argv) { g_sci->_soundCmd->pauseAll(true); // pause music const EnginePlugin *plugin = NULL; EngineMan.findGame(g_sci->getGameIdStr(), &plugin); - GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save")); - dialog->setSaveMode(true); + GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true); savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); game_description = dialog->getResultString(); if (game_description.empty()) { @@ -671,8 +670,7 @@ reg_t kRestoreGame(EngineState *s, int argc, reg_t *argv) { g_sci->_soundCmd->pauseAll(true); // pause music const EnginePlugin *plugin = NULL; EngineMan.findGame(g_sci->getGameIdStr(), &plugin); - GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore")); - dialog->setSaveMode(false); + GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false); savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); delete dialog; if (savegameId < 0) { diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp index 657e18635f..9da06ce5be 100644 --- a/engines/toon/toon.cpp +++ b/engines/toon/toon.cpp @@ -2961,8 +2961,7 @@ bool ToonEngine::saveGame(int32 slot, const Common::String &saveGameDesc) { EngineMan.findGame(_gameDescription->gameid, &plugin); if (slot == -1) { - GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Save game:", "Save"); - dialog->setSaveMode(true); + GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Save game:", "Save", true); savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); savegameDescription = dialog->getResultString(); delete dialog; @@ -3057,8 +3056,7 @@ bool ToonEngine::loadGame(int32 slot) { EngineMan.findGame(_gameDescription->gameid, &plugin); if (slot == -1) { - GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Restore game:", "Restore"); - dialog->setSaveMode(false); + GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Restore game:", "Restore", false); savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); delete dialog; } else { diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp index 0756d71d4c..8fe7b8c458 100644 --- a/engines/tsage/scenes.cpp +++ b/engines/tsage/scenes.cpp @@ -573,11 +573,9 @@ void Game::handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName EngineMan.findGame(g_vm->getGameId(), &plugin); GUI::SaveLoadChooser *dialog; if (saveFlag) - dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save")); + dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), saveFlag); else - dialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load")); - - dialog->setSaveMode(saveFlag); + dialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load"), saveFlag); saveSlot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); saveName = dialog->getResultString(); diff --git a/gui/launcher.cpp b/gui/launcher.cpp index c8ed3126c4..26fafa5279 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -677,7 +677,7 @@ LauncherDialog::LauncherDialog() _browser = new BrowserDialog(_("Select directory with game data"), true); // Create Load dialog - _loadDialog = new SaveLoadChooser(_("Load game:"), _("Load")); + _loadDialog = new SaveLoadChooser(_("Load game:"), _("Load"), false); } void LauncherDialog::selectTarget(const String &target) { diff --git a/gui/saveload.cpp b/gui/saveload.cpp index 3dc9961906..c7da94357f 100644 --- a/gui/saveload.cpp +++ b/gui/saveload.cpp @@ -40,7 +40,7 @@ enum { }; -SaveLoadChooser::SaveLoadChooser(const String &title, const String &buttonLabel) +SaveLoadChooser::SaveLoadChooser(const String &title, const String &buttonLabel, bool saveMode) : Dialog("SaveLoadChooser"), _delSupport(0), _list(0), _chooseButton(0), _deleteButton(0), _gfxWidget(0) { _delSupport = _metaInfoSupport = _thumbnailSupport = _saveDateSupport = _playTimeSupport = false; @@ -51,7 +51,7 @@ SaveLoadChooser::SaveLoadChooser(const String &title, const String &buttonLabel) // Add choice list _list = new GUI::ListWidget(this, "SaveLoadChooser.List"); _list->setNumberingMode(GUI::kListNumberingZero); - setSaveMode(false); + _list->setEditable(saveMode); _gfxWidget = new GUI::GraphicsWidget(this, 0, 0, 10, 10); @@ -117,10 +117,6 @@ const Common::String &SaveLoadChooser::getResultString() const { return (selItem >= 0) ? _list->getSelectedString() : _resultString; } -void SaveLoadChooser::setSaveMode(bool saveMode) { - _list->setEditable(saveMode); -} - void SaveLoadChooser::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { int selItem = _list->getSelected(); diff --git a/gui/saveload.h b/gui/saveload.h index adaf311fd2..e6fea0fb52 100644 --- a/gui/saveload.h +++ b/gui/saveload.h @@ -62,7 +62,7 @@ protected: void updateSaveList(); void updateSelection(bool redraw); public: - SaveLoadChooser(const String &title, const String &buttonLabel); + SaveLoadChooser(const String &title, const String &buttonLabel, bool saveMode); ~SaveLoadChooser(); virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data); @@ -71,7 +71,6 @@ public: void open(); const Common::String &getResultString() const; - void setSaveMode(bool saveMode); virtual void reflowLayout(); |