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
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (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, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef GUI_DOWNLOADDIALOG_H
24 #define GUI_DOWNLOADDIALOG_H
25 
26 #include "gui/dialog.h"
27 #include "common/str.h"
28 
29 namespace GUI {
30 class LauncherDialog;
31 
32 class CommandSender;
33 class EditTextWidget;
34 class StaticTextWidget;
35 class ButtonWidget;
36 class SliderWidget;
37 class BrowserDialog;
38 class RemoteBrowserDialog;
39 
40 enum DownloadProgress {
41 	kDownloadProgressCmd = 'DLPR',
42 	kDownloadEndedCmd = 'DLEN'
43 };
44 
45 class DownloadDialog : public Dialog {
46 	LauncherDialog *_launcher;
47 	BrowserDialog *_browser;
48 	RemoteBrowserDialog *_remoteBrowser;
49 
50 	StaticTextWidget *_remoteDirectoryLabel;
51 	StaticTextWidget *_localDirectoryLabel;
52 	StaticTextWidget *_percentLabel;
53 	StaticTextWidget *_downloadSizeLabel;
54 	StaticTextWidget *_downloadSpeedLabel;
55 	SliderWidget *_progressBar;
56 	ButtonWidget *_cancelButton;
57 	ButtonWidget *_closeButton;
58 
59 	Common::String _localDirectory;
60 	bool _close;
61 
62 	Common::String getSizeLabelText();
63 	Common::String getSpeedLabelText();
64 
65 	void refreshWidgets();
66 	bool selectDirectories();
67 
68 public:
69 	DownloadDialog(uint32 storageId, LauncherDialog *launcher);
70 	virtual ~DownloadDialog();
71 
72 	virtual void open();
73 	virtual void close();
74 	virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
75 	virtual void handleTickle();
76 	virtual void reflowLayout();
77 };
78 
79 } // End of namespace GUI
80 
81 #endif
82