1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef GUI_SAVELOAD_H
24 #define GUI_SAVELOAD_H
25 
26 #include "common/str.h"
27 #include "engines/metaengine.h"
28 
29 namespace GUI {
30 
31 class SaveLoadChooserDialog;
32 
33 class SaveLoadChooser {
34 	typedef Common::String String;
35 	typedef Common::U32String U32String;
36 protected:
37 	SaveLoadChooserDialog *_impl;
38 
39 	const U32String _title;
40 	const U32String _buttonLabel;
41 	const bool _saveMode;
42 
43 	void selectChooser(const MetaEngine *engine);
44 public:
45 	SaveLoadChooser(const U32String &title, const U32String &buttonLabel, bool saveMode);
46 	~SaveLoadChooser();
47 
48 	/**
49 	 * Runs the save/load chooser with the currently active config manager
50 	 * domain as target.
51 	 *
52 	 * @return The selcted save slot. -1 in case none is selected.
53 	 */
54 	int runModalWithCurrentTarget();
55 	int runModalWithMetaEngineAndTarget(const MetaEngine *engine, const String &target);
56 
57 	const Common::U32String &getResultString() const;
58 
59 	/**
60 	 * Creates a default save description for the specified slot. Depending
61 	 * on the ScummVM configuration this might be a simple "Slot #" description
62 	 * or the current date and time.
63 	 *
64 	 * TODO: This might not be the best place to put this, since engines not
65 	 * using this class might want to mimic the same behavior. Check whether
66 	 * moving this to a better place makes sense and find what this place would
67 	 * be.
68 	 *
69 	 * @param slot The slot number (must be >= 0).
70 	 * @return The slot description.
71 	 */
72 	Common::String createDefaultSaveDescription(const int slot) const;
73 };
74 
75 } // End of namespace GUI
76 
77 #endif
78