1 /** @file savelistdata.h  UI data items representing available saved games.
2  *
3  * @authors Copyright (c) 2016-2017 Jaakko Keränen <jaakko.keranen@iki.fi>
4  *
5  * @par License
6  * GPL: http://www.gnu.org/licenses/gpl.html
7  *
8  * <small>This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version. This program is distributed in the hope that it
12  * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
14  * Public License for more details. You should have received a copy of the GNU
15  * General Public License along with this program; if not, see:
16  * http://www.gnu.org/licenses</small>
17  */
18 
19 #ifndef DENG_CLIENT_UI_SAVELISTDATA_H
20 #define DENG_CLIENT_UI_SAVELISTDATA_H
21 
22 #include <de/ui/ListData>
23 #include <de/ui/ImageItem>
24 #include <doomsday/GameStateFolder>
25 
26 /**
27  * List data model for available saved sessions.
28  */
29 class SaveListData : public de::ui::ListData
30 {
31 public:
32     struct SaveItem : public de::ui::ImageItem,
33                       DENG2_OBSERVES(de::File, Deletion)
34     {
35         GameStateFolder const *saveFolder;
36 
37         SaveItem(GameStateFolder const &saveFolder);
38         ~SaveItem();
39 
40         bool isValid() const;
41         de::String title() const;
42         de::String gameId() const;
43         de::String savePath() const;
44         de::String name() const;
45         de::StringList loadedPackages() const;
46 
47         void fileBeingDeleted(de::File const &);
48     };
49 
50 public:
51     SaveListData();
52 
53     SaveItem &at(Pos pos) override;
54     SaveItem const &at(Pos pos) const override;
55 
56 private:
57     DENG2_PRIVATE(d)
58 };
59 
60 #endif // DENG_CLIENT_UI_SAVELISTDATA_H
61