SuperTuxKart
Loading...
Searching...
No Matches
vote_dialog.hpp
1// SuperTuxKart - a fun racing game with go-kart
2// Copyright (C) 2013-2015 Glenn De Jonghe
3//
4// This program is free software; you can redistribute it and/or
5// modify it under the terms of the GNU General Public License
6// as published by the Free Software Foundation; either version 3
7// of the License, or (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program; if not, write to the Free Software
16// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18
19#ifndef HEADER_VOTE_DIALOG_HPP
20#define HEADER_VOTE_DIALOG_HPP
21
22
23#include "guiengine/modaldialog.hpp"
24#include "guiengine/widgets.hpp"
25
26#include <irrString.h>
27
28namespace Online
29{
30 class XMLRequest;
31}
37{
38private:
40 const std::string m_addon_id;
41
45
48 std::shared_ptr<Online::XMLRequest> m_fetch_vote_request;
49
51 std::shared_ptr<Online::XMLRequest> m_perform_vote_request;
52
55
58
61
64
65 void updateFetchVote();
66 void sendVote();
67public:
68 VoteDialog(const std::string & addon_id);
70 GUIEngine::EventPropagation processEvent(const std::string& eventSource);
71 virtual void onUpdate(float dt);
72 virtual bool onEscapePressed();
73}; // VoteDialog
74
75#endif
A button widget with an icon and optionnaly a label beneath.
Definition: icon_button_widget.hpp:44
A simple label widget.
Definition: label_widget.hpp:36
Abstract base class representing a modal dialog.
Definition: modaldialog.hpp:56
A rating bar widget.
Definition: rating_bar_widget.hpp:37
A static text/icons/tabs bar widget.
Definition: ribbon_widget.hpp:60
Dialog that allows a user to sign in.
Definition: vote_dialog.hpp:37
void updateFetchVote()
Updates a potentiall still outstanding fetch vote request.
Definition: vote_dialog.cpp:161
~VoteDialog()
Destructor, frees the various requests.
Definition: vote_dialog.cpp:73
std::shared_ptr< Online::XMLRequest > m_fetch_vote_request
The request to fetch the current vote, which is submitted immediately when this dialog is opened.
Definition: vote_dialog.hpp:48
void sendVote()
A request to the server, to perform a vote on an addon.
Definition: vote_dialog.cpp:91
bool m_self_destroy
True if the dialog should be removed (which needs to be done in the update call each frame).
Definition: vote_dialog.hpp:44
virtual void onUpdate(float dt)
Called every frame.
Definition: vote_dialog.cpp:216
GUIEngine::IconButtonWidget * m_cancel_widget
Pointer to the cancel button.
Definition: vote_dialog.hpp:63
const std::string m_addon_id
Stores the id of the addon being voted on.
Definition: vote_dialog.hpp:40
std::shared_ptr< Online::XMLRequest > m_perform_vote_request
The request to perform a vote.
Definition: vote_dialog.hpp:51
GUIEngine::EventPropagation processEvent(const std::string &eventSource)
Callback when a user event is triggered.
Definition: vote_dialog.cpp:133
virtual bool onEscapePressed()
When escape is pressed, trigger a self destroy.
Definition: vote_dialog.cpp:80
GUIEngine::RibbonWidget * m_options_widget
Pointer to the options widget, which contains the canel button.
Definition: vote_dialog.hpp:60
GUIEngine::RatingBarWidget * m_rating_widget
Pointer to the rating widget of this dialog.
Definition: vote_dialog.hpp:57
GUIEngine::LabelWidget * m_info_widget
Pointer to the info widget of this dialog.
Definition: vote_dialog.hpp:54