SuperTuxKart
Loading...
Searching...
No Matches
addons_loading.hpp
1// SuperTuxKart - a fun racing game with go-kart
2// Copyright (C) 2010-2015 Lucas Baudin
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_ADDONS_LOADING_HPP
20#define HEADER_ADDONS_LOADING_HPP
21
22#include "addons/addon.hpp"
23#include "addons/addons_manager.hpp"
24#include "guiengine/widgets.hpp"
25#include "guiengine/modaldialog.hpp"
26#include "utils/cpp2011.hpp"
27#include "utils/synchronised.hpp"
28
29namespace Online { class HTTPRequest; }
30
35{
36private:
38 GUIEngine::IconButtonWidget *m_back_button;
39 GUIEngine::IconButtonWidget *m_install_button;
40
42
44#ifndef SERVER_ONLY
46#endif
47 void startDownload();
48 void stopDownload();
49 void doInstall();
50 void doUninstall();
51
54
55 std::shared_ptr<bool> m_icon_downloaded;
58 std::shared_ptr<Online::HTTPRequest> m_download_request;
59
60public:
61 AddonsLoading(const std::string &addon_name);
62
64
65 virtual GUIEngine::EventPropagation processEvent(const std::string& event_source) OVERRIDE;
66 virtual void beforeAddingWidgets() OVERRIDE;
67 virtual void init() OVERRIDE;
68
73 void onUpdate(float delta) OVERRIDE;
74 void voteClicked();
75 void tryInstall();
76 virtual bool onEscapePressed() OVERRIDE;
77
78}; // AddonsLoading
79
80#endif
Definition: addon.hpp:40
Definition: addons_loading.hpp:35
void onUpdate(float delta) OVERRIDE
This function is called by the GUI, all the frame (or somthing like that).
Definition: addons_loading.cpp:286
virtual void init() OVERRIDE
Optional callback invoked after widgets have been add()ed.
Definition: addons_loading.cpp:189
virtual GUIEngine::EventPropagation processEvent(const std::string &event_source) OVERRIDE
Returns whether to block event propagation (usually, you will want to block events you processed)
Definition: addons_loading.cpp:229
std::shared_ptr< Online::HTTPRequest > m_download_request
A pointer to the download request, which gives access to the progress of a download.
Definition: addons_loading.hpp:58
void doInstall()
Called when the asynchronous download of the addon finished.
Definition: addons_loading.cpp:364
Addon m_addon
The addon to load.
Definition: addons_loading.hpp:45
void startDownload()
This function is called when the user click on 'Install', 'Uninstall', or 'Update'.
Definition: addons_loading.cpp:333
virtual void beforeAddingWidgets() OVERRIDE
Optional callback invoked very early, before widgets have been added (contrast with init(),...
Definition: addons_loading.cpp:101
void stopDownload()
This function is called when the user click on 'Back', 'Cancel' or press escape.
Definition: addons_loading.cpp:349
~AddonsLoading()
Destructor.
Definition: addons_loading.cpp:86
bool m_icon_shown
True if the icon is being displayed.
Definition: addons_loading.hpp:53
virtual bool onEscapePressed() OVERRIDE
Override to change what happens on escape pressed.
Definition: addons_loading.cpp:199
A button widget with an icon and optionnaly a label beneath.
Definition: icon_button_widget.hpp:44
Abstract base class representing a modal dialog.
Definition: modaldialog.hpp:56
A progress bar widget.
Definition: progress_bar_widget.hpp:36