SuperTuxKart
Loading...
Searching...
No Matches
ghost_replay_selection.hpp
1//
2// SuperTuxKart - a fun racing game with go-kart
3// Copyright (C) 2016 SuperTuxKart-Team
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 3
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19#ifndef HEADER_GHOST_REPLAY_SELECTION_HPP
20#define HEADER_GHOST_REPLAY_SELECTION_HPP
21
22#include "guiengine/screen.hpp"
23#include "guiengine/widgets.hpp"
24#include "race/race_manager.hpp"
25#include "states_screens/dialogs/message_dialog.hpp"
26
27namespace GUIEngine { class Widget; }
28
34 public GUIEngine::ScreenSingleton<GhostReplaySelection>,
37
38{
40
41private:
44
45 GUIEngine::ListWidget* m_replay_list_widget;
46 GUIEngine::CheckBoxWidget* m_replay_difficulty_toggle_widget;
47 GUIEngine::CheckBoxWidget* m_replay_multiplayer_toggle_widget;
48 GUIEngine::CheckBoxWidget* m_replay_version_toggle_widget;
49 GUIEngine::CheckBoxWidget* m_best_times_toggle_widget;
50 GUIEngine::CheckBoxWidget* m_compare_toggle_widget;
51 GUIEngine::RibbonWidget* m_mode_tabs;
52 RaceManager::Difficulty m_cur_difficulty;
53 std::string m_file_to_be_deleted;
54 std::vector<unsigned int> m_best_times_index;
55 bool m_same_difficulty;
56 bool m_same_version;
57 bool m_multiplayer;
58 bool m_best_times;
59 bool m_is_comparing;
60 bool m_active_mode_is_linear;
62 // The index id of a replay file can change with sorting, etc.
63 // Using the UID guarantees exact matchess
64 uint64_t m_replay_to_compare_uid;
65
66 irr::gui::STKModifiedSpriteBank *m_icon_bank;
67
72
73 void defaultSort();
74
75public:
76 irr::gui::STKModifiedSpriteBank* getIconBank() { return m_icon_bank; }
77
78 int getUnknownKartIcon() { return m_icon_unknown_kart; }
79
80 void setCompareReplayUid(uint64_t uid) { m_replay_to_compare_uid = uid; }
81 void setCompare(bool compare) { m_is_comparing = compare; }
82
83 void refresh(bool forced_update = true, bool update_columns = false);
84
86 void loadList();
87
88 void onDeleteReplay(std::string& filename);
89
90 const RaceManager::MinorRaceModeType getActiveMode() { return m_active_mode; }
91
92 const bool isActiveModeLinear() { return m_active_mode_is_linear; }
93
95 virtual void loadedFromFile() OVERRIDE;
96
98 virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name,
99 const int playerID) OVERRIDE;
100
102 virtual void beforeAddingWidget() OVERRIDE;
103
104 virtual void onColumnClicked(int column_id, bool sort_desc, bool sort_default) OVERRIDE;
105
106 virtual void init() OVERRIDE;
107
108 virtual void tearDown() OVERRIDE;
109
110 virtual void unloaded() OVERRIDE;
111
112 virtual bool onEscapePressed() OVERRIDE;
113
115 virtual void onConfirm() OVERRIDE;
116
117}; // GhostReplaySelection
118
119#endif
A checkbox widget.
Definition: check_box_widget.hpp:34
Definition: list_widget.hpp:37
A vertical list widget with text entries.
Definition: list_widget.hpp:50
A static text/icons/tabs bar widget.
Definition: ribbon_widget.hpp:60
Declares a class to be a singleton.
Definition: screen.hpp:59
Represents a single GUI screen.
Definition: screen.hpp:97
GhostReplaySelection.
Definition: ghost_replay_selection.hpp:38
void loadList()
Load the addons into the main list.
Definition: ghost_replay_selection.cpp:192
int m_icon_unknown_kart
Icon for unknown karts.
Definition: ghost_replay_selection.hpp:69
GhostReplaySelection()
Constructor, which loads the stkgui file.
Definition: ghost_replay_selection.cpp:40
int m_icon_lock
Icon for locked replays.
Definition: ghost_replay_selection.hpp:71
virtual void onColumnClicked(int column_id, bool sort_desc, bool sort_default) OVERRIDE
Change the sort order if a column was clicked.
Definition: ghost_replay_selection.cpp:527
virtual void tearDown() OVERRIDE
Callback invoked before leaving this menu.
Definition: ghost_replay_selection.cpp:54
virtual void eventCallback(GUIEngine::Widget *widget, const std::string &name, const int playerID) OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: ghost_replay_selection.cpp:422
~GhostReplaySelection()
Destructor.
Definition: ghost_replay_selection.cpp:49
virtual bool onEscapePressed() OVERRIDE
Called when escape is pressed.
Definition: ghost_replay_selection.cpp:596
virtual void unloaded() OVERRIDE
Callback invoked when this screen is being unloaded.
Definition: ghost_replay_selection.cpp:60
void refresh(bool forced_update=true, bool update_columns=false)
Triggers a refresh of the replay file list.
Definition: ghost_replay_selection.cpp:70
void defaultSort()
Apply the default sorting to the replay list.
Definition: ghost_replay_selection.cpp:583
virtual void beforeAddingWidget() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: ghost_replay_selection.cpp:151
virtual void init() OVERRIDE
Callback invoked when entering this menu (after the widgets have been added).
Definition: ghost_replay_selection.cpp:172
virtual void onConfirm() OVERRIDE
Implement IConfirmDialogListener callback.
Definition: ghost_replay_selection.cpp:513
virtual void loadedFromFile() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: ghost_replay_selection.cpp:92
Listener interface to get notified of whether the user chose to confirm or cancel.
Definition: message_dialog.hpp:39
MinorRaceModeType
Minor variants to the major types of race.
Definition: race_manager.hpp:110
Difficulty
Game difficulty.
Definition: race_manager.hpp:230
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:33