Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UI|SavegameSelectionWidget: Added a basic UI widget for saved session…
… management I'm not at all happy with how this works from a usability perspective. The main point was to get something working that can improved further once automatic conversion of legacy saved games is working. Note that is (heavily) based on the MPSelectionWidget.
- Loading branch information
1 parent
05dc05e
commit 4b1b58e
Showing
5 changed files
with
389 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
doomsday/client/include/ui/widgets/savegameselectionwidget.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/** @file savegameselectionwidget.h | ||
* | ||
* @authors Copyright © 2014 Jaakko Keränen <jaakko.keranen@iki.fi> | ||
* @authors Copyright © 2014 Daniel Swanson <danij@dengine.net> | ||
* | ||
* @par License | ||
* GPL: http://www.gnu.org/licenses/gpl.html | ||
* | ||
* <small>This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by the | ||
* Free Software Foundation; either version 2 of the License, or (at your | ||
* option) any later version. This program is distributed in the hope that it | ||
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty | ||
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
* Public License for more details. You should have received a copy of the GNU | ||
* General Public License along with this program; if not, see: | ||
* http://www.gnu.org/licenses</small> | ||
*/ | ||
|
||
#ifndef DENG_CLIENT_SAVEGAMESELECTIONWIDGET_H | ||
#define DENG_CLIENT_SAVEGAMESELECTIONWIDGET_H | ||
|
||
#include <de/MenuWidget> | ||
#include <de/game/SavedSession> | ||
|
||
/** | ||
* Menu that populates itself with available saved game sessions. | ||
* | ||
* @ingroup ui | ||
*/ | ||
class SavegameSelectionWidget : public de::MenuWidget | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
DENG2_DEFINE_AUDIENCE(Selection, void gameSelected(de::game::SavedSession const &session)) | ||
|
||
/** | ||
* Action for loading a saved session. | ||
*/ | ||
class LoadAction : public de::Action | ||
{ | ||
public: | ||
LoadAction(de::game::SavedSession const &session); | ||
void trigger(); | ||
|
||
private: | ||
DENG2_PRIVATE(d) | ||
}; | ||
|
||
public: | ||
SavegameSelectionWidget(); | ||
|
||
/** | ||
* Enables or disables loading saved game sessions by pressing the menu items in the | ||
* widget. By default, this is enabled. If disabled, one will only get a notification | ||
* about the selection. | ||
* | ||
* @param enableLoad @c true to allow automatic loading, @c false to disallow. | ||
*/ | ||
void setLoadGameWhenSelected(bool enableLoad); | ||
|
||
void setColumns(int numberOfColumns); | ||
|
||
de::game::SavedSession const &savedSession(de::ui::DataPos pos) const; | ||
|
||
// Events. | ||
void update(); | ||
|
||
signals: | ||
void availabilityChanged(); | ||
void gameSelected(); | ||
|
||
private: | ||
DENG2_PRIVATE(d) | ||
}; | ||
|
||
#endif // DENG_CLIENT_SAVEGAMESELECTIONWIDGET_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.