diff options
author | Johannes Schickel | 2012-06-15 22:47:57 +0200 |
---|---|---|
committer | Johannes Schickel | 2012-06-15 23:03:18 +0200 |
commit | 72ea449431d9db61c45160f7c42d546599e84afe (patch) | |
tree | 698c577a6c9e50cf60a27029878273f83ef313d6 | |
parent | b4882ce6bdb8f3a0df0085fa43ed3bbaf5cb47e1 (diff) | |
download | scummvm-rg350-72ea449431d9db61c45160f7c42d546599e84afe.tar.gz scummvm-rg350-72ea449431d9db61c45160f7c42d546599e84afe.tar.bz2 scummvm-rg350-72ea449431d9db61c45160f7c42d546599e84afe.zip |
GUI: Hook up the new load chooser for > 320x200 and engines which support thumbnails.
-rw-r--r-- | gui/saveload.cpp | 22 | ||||
-rw-r--r-- | gui/saveload.h | 6 |
2 files changed, 23 insertions, 5 deletions
diff --git a/gui/saveload.cpp b/gui/saveload.cpp index e0e6d6187e..becc3f6b4f 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 ac61291b62..26a8cd1bad 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(); |