aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorJohannes Schickel2012-06-10 04:49:42 +0200
committerJohannes Schickel2012-06-10 04:53:17 +0200
commit7c5cf1b400808865a5f601f70d624ad6704a0c8c (patch)
tree488862f566ac55bbadf84440115a12b91a213b5d /gui
parent9b05f4e1039ade7f2d0b774c18a6767113f2c848 (diff)
downloadscummvm-rg350-7c5cf1b400808865a5f601f70d624ad6704a0c8c.tar.gz
scummvm-rg350-7c5cf1b400808865a5f601f70d624ad6704a0c8c.tar.bz2
scummvm-rg350-7c5cf1b400808865a5f601f70d624ad6704a0c8c.zip
GUI: Add helper to SaveLoadChooser, which uses the currently active target.
This reduces the code duplication in all client code, which formerly duplicated the querying of the plugin, game id etc. and now simply calls the newly added method runModalWithCurrentTarget() on a SaveLoadChooser object.
Diffstat (limited to 'gui')
-rw-r--r--gui/saveload.cpp9
-rw-r--r--gui/saveload.h7
2 files changed, 16 insertions, 0 deletions
diff --git a/gui/saveload.cpp b/gui/saveload.cpp
index c7da94357f..366efa7a90 100644
--- a/gui/saveload.cpp
+++ b/gui/saveload.cpp
@@ -76,6 +76,15 @@ SaveLoadChooser::SaveLoadChooser(const String &title, const String &buttonLabel,
SaveLoadChooser::~SaveLoadChooser() {
}
+int SaveLoadChooser::runModalWithCurrentTarget() {
+ const Common::String gameId = ConfMan.get("gameid");
+
+ const EnginePlugin *plugin = 0;
+ EngineMan.findGame(gameId, &plugin);
+
+ return runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
+}
+
int SaveLoadChooser::runModalWithPluginAndTarget(const EnginePlugin *plugin, const String &target) {
if (_gfxWidget)
_gfxWidget->setGfx(0);
diff --git a/gui/saveload.h b/gui/saveload.h
index e6fea0fb52..dc0f0429c7 100644
--- a/gui/saveload.h
+++ b/gui/saveload.h
@@ -67,6 +67,13 @@ public:
virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data);
void setList(const StringArray& list);
+ /**
+ * Runs the save/load chooser with the currently active config manager
+ * domain as target.
+ *
+ * @return The selcted save slot. -1 in case none is selected.
+ */
+ int runModalWithCurrentTarget();
int runModalWithPluginAndTarget(const EnginePlugin *plugin, const String &target);
void open();