ScummVM API documentation
downloadpacksdialog.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef GUI_DOWNLOADPACKSDIALOG_H
23 #define GUI_DOWNLOADPACKSDIALOG_H
24 
25 #include "gui/dialog.h"
26 #include "common/str.h"
27 #include "common/ustr.h"
28 
29 namespace Networking {
30 class Session;
31 }
32 
33 namespace GUI {
34 class CommandSender;
35 class StaticTextWidget;
36 class ButtonWidget;
37 class SliderWidget;
38 
39 enum IconProcessState {
40  kDownloadStateNone,
41  kDownloadStateList,
42  kDownloadStateListDownloaded,
43  kDownloadStateListCalculated,
44  kDownloadStateDownloading,
45  kDownloadComplete
46 };
47 
48 class DownloadPacksDialog : public Dialog, public CommandSender {
49  StaticTextWidget *_statusText;
50  StaticTextWidget *_errorText;
51  StaticTextWidget *_percentLabel;
52  StaticTextWidget *_downloadSizeLabel;
53  StaticTextWidget *_downloadSpeedLabel;
54  SliderWidget *_progressBar;
55  ButtonWidget *_cancelButton;
56  ButtonWidget *_closeButton;
57  ButtonWidget *_clearCacheButton;
58 
59  Common::U32String _packname;
60  const char *_packsglob;
61 
62  Common::String _localDirectory;
63  bool _close;
64 
65  Common::U32String getSizeLabelText();
66  Common::U32String getSpeedLabelText();
67 
68  void refreshWidgets();
69 
70 public:
71  DownloadPacksDialog(Common::U32String packname, const char *listfname, const char *packsglob);
72  ~DownloadPacksDialog() override;
73 
74  void open() override;
75  void close() override;
76  void handleCommand(CommandSender *sender, uint32 cmd, uint32 data) override;
77  void handleTickle() override;
78  void reflowLayout() override;
79 
80  void setError(Common::U32String &msg);
81 
82 private:
83  void calculateList();
84  void clearCache();
85  void setState(IconProcessState state);
86 };
87 
88 } // End of namespace GUI
89 
90 #endif
Definition: str.h:59
Definition: scummvmcloud.h:31
Definition: widget.h:205
Definition: widget.h:405
Definition: system.h:46
Definition: ustr.h:57
Definition: dialog.h:49
Definition: downloadpacksdialog.h:48
Definition: widget.h:233
Definition: object.h:40