[Scummvm-cvs-logs] scummvm master -> 9b05f4e1039ade7f2d0b774c18a6767113f2c848

lordhoto lordhoto at gmail.com
Sun Jun 10 04:22:28 CEST 2012


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
15046a7529 GUI: Get rid of SaveLoadChooser::setSaveMode.
5c8b7af495 MOHAWK: Do not call close on SaveLoadChooser.
9b05f4e103 PARALLACTION: Do not call close on a SaveLoadChooser.


Commit: 15046a7529e3c755de1f00b4a2666786eb2bd4f8
    https://github.com/scummvm/scummvm/commit/15046a7529e3c755de1f00b4a2666786eb2bd4f8
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-06-09T19:19:45-07:00

Commit Message:
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.

Changed paths:
    engines/agi/saveload.cpp
    engines/cge/events.cpp
    engines/cruise/menu.cpp
    engines/dialogs.cpp
    engines/dreamweb/saveload.cpp
    engines/hugo/file.cpp
    engines/mohawk/myst.cpp
    engines/mohawk/riven.cpp
    engines/parallaction/saveload.cpp
    engines/sci/engine/kfile.cpp
    engines/toon/toon.cpp
    engines/tsage/scenes.cpp
    gui/launcher.cpp
    gui/saveload.cpp
    gui/saveload.h



diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp
index d58e55a..cb7792a 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 3c561c5..e903584 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 e763e2b..988355e 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 1b54c7e..3fa01dd 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 c8fb537..e659c03 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 2217cef..3c94b2e 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 c22b30a..0efd412 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 07b1b59..b7866a3 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 3ab25f2..3bd736b 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 8d1b078..6c40be8 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 657e186..9da06ce 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 0756d71..8fe7b8c 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 c8ed312..26fafa5 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 3dc9961..c7da943 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 adaf311..e6fea0f 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();
 


Commit: 5c8b7af4958edb4d53d2ac5ea575124a318b5cca
    https://github.com/scummvm/scummvm/commit/5c8b7af4958edb4d53d2ac5ea575124a318b5cca
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-06-09T19:19:57-07:00

Commit Message:
MOHAWK: Do not call close on SaveLoadChooser.

This is actually always called when a dialog closes, thus manual closing is
not required. It furthermore is actually *bad* to call this from outside the
dialog's code, since it will remove the top dialog from the dialog stack and
thus mess up the GUI in case multiple dialogs are opened.

Changed paths:
    engines/mohawk/riven.cpp



diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index b7866a3..d66e46f 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -723,8 +723,6 @@ void MohawkEngine_Riven::runLoadDialog() {
 	int slot = slc.runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
 	if (slot >= 0)
 		loadGameState(slot);
-
-	slc.close();
 }
 
 Common::Error MohawkEngine_Riven::loadGameState(int slot) {


Commit: 9b05f4e1039ade7f2d0b774c18a6767113f2c848
    https://github.com/scummvm/scummvm/commit/9b05f4e1039ade7f2d0b774c18a6767113f2c848
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-06-09T19:19:57-07:00

Commit Message:
PARALLACTION: Do not call close on a SaveLoadChooser.

Changed paths:
    engines/parallaction/saveload.cpp



diff --git a/engines/parallaction/saveload.cpp b/engines/parallaction/saveload.cpp
index 3bd736b..8592336 100644
--- a/engines/parallaction/saveload.cpp
+++ b/engines/parallaction/saveload.cpp
@@ -192,7 +192,6 @@ int SaveLoad::selectSaveFile(Common::String &selectedName, bool saveMode, const
 	int idx = slc.runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
 	if (idx >= 0) {
 		selectedName = slc.getResultString();
-		slc.close();
 	}
 
 	return idx;






More information about the Scummvm-git-logs mailing list