From 72ea449431d9db61c45160f7c42d546599e84afe Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 15 Jun 2012 22:47:57 +0200 Subject: [PATCH] GUI: Hook up the new load chooser for > 320x200 and engines which support thumbnails. --- gui/saveload.cpp | 22 +++++++++++++++++----- gui/saveload.h | 6 ++++++ 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/gui/saveload.cpp b/gui/saveload.cpp index e0e6d6187e7..becc3f6b4f5 100644 --- a/gui/saveload.cpp +++ b/gui/saveload.cpp @@ -24,13 +24,14 @@ #include "gui/saveload.h" #include "gui/saveload-dialog.h" +#include "gui/gui-manager.h" #include "engines/metaengine.h" namespace GUI { -SaveLoadChooser::SaveLoadChooser(const String &title, const String &buttonLabel, bool saveMode) { - _impl = new SaveLoadChooserSimple(title, buttonLabel, saveMode); +SaveLoadChooser::SaveLoadChooser(const String &title, const String &buttonLabel, bool saveMode) + : _impl(0), _title(title), _buttonLabel(buttonLabel), _saveMode(saveMode) { } SaveLoadChooser::~SaveLoadChooser() { @@ -38,6 +39,19 @@ SaveLoadChooser::~SaveLoadChooser() { _impl = 0; } +void SaveLoadChooser::selectChooser(const MetaEngine &engine) { + delete _impl; + _impl = 0; + + if (!_saveMode && g_gui.getWidth() > 320 && g_gui.getHeight() > 200 + && engine.hasFeature(MetaEngine::kSavesSupportMetaInfo) + && engine.hasFeature(MetaEngine::kSavesSupportThumbnail)) { + _impl = new LoadChooserThumbnailed(_title); + } else { + _impl = new SaveLoadChooserSimple(_title, _buttonLabel, _saveMode); + } +} + Common::String SaveLoadChooser::createDefaultSaveDescription(const int slot) const { #if defined(USE_SAVEGAME_TIMESTAMP) TimeDate curTime; @@ -51,9 +65,6 @@ Common::String SaveLoadChooser::createDefaultSaveDescription(const int slot) con } int SaveLoadChooser::runModalWithCurrentTarget() { - if (!_impl) - return -1; - const Common::String gameId = ConfMan.get("gameid"); const EnginePlugin *plugin = 0; @@ -63,6 +74,7 @@ int SaveLoadChooser::runModalWithCurrentTarget() { } int SaveLoadChooser::runModalWithPluginAndTarget(const EnginePlugin *plugin, const String &target) { + selectChooser(**plugin); if (!_impl) return -1; diff --git a/gui/saveload.h b/gui/saveload.h index ac61291b622..26a8cd1bad7 100644 --- a/gui/saveload.h +++ b/gui/saveload.h @@ -33,6 +33,12 @@ class SaveLoadChooser { typedef Common::String String; protected: SaveLoadChooserDialog *_impl; + + const String _title; + const String _buttonLabel; + const bool _saveMode; + + void selectChooser(const MetaEngine &engine); public: SaveLoadChooser(const String &title, const String &buttonLabel, bool saveMode); ~SaveLoadChooser();