aboutsummaryrefslogtreecommitdiff
path: root/gui/downloaddialog.cpp
diff options
context:
space:
mode:
authorAlexander Tkachev2016-07-04 11:52:40 +0600
committerAlexander Tkachev2016-08-24 16:07:55 +0600
commit72b82bd2aa66223f6c740e7bf6dce316b2145b15 (patch)
tree458e223ee8c8d2406e46634c23a973b47c93b7f7 /gui/downloaddialog.cpp
parent97c0bbd2388ac049970fc3c99ebdc072c75724f1 (diff)
downloadscummvm-rg350-72b82bd2aa66223f6c740e7bf6dce316b2145b15.tar.gz
scummvm-rg350-72b82bd2aa66223f6c740e7bf6dce316b2145b15.tar.bz2
scummvm-rg350-72b82bd2aa66223f6c740e7bf6dce316b2145b15.zip
GUI: Add RemoteBrowserDialog
WIP. Tested with Dropbox.
Diffstat (limited to 'gui/downloaddialog.cpp')
-rw-r--r--gui/downloaddialog.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/gui/downloaddialog.cpp b/gui/downloaddialog.cpp
index b449be5ca8..e94b19634b 100644
--- a/gui/downloaddialog.cpp
+++ b/gui/downloaddialog.cpp
@@ -27,6 +27,9 @@
#include "backends/cloud/cloudmanager.h"
#include "common/translation.h"
#include "widgets/edittext.h"
+#include "message.h"
+#include "browser.h"
+#include "remotebrowser.h"
namespace GUI {
@@ -38,6 +41,9 @@ DownloadDialog::DownloadDialog(uint32 storageId):
Dialog("GlobalOptions_Cloud_DownloadDialog"), _wasInProgress(true), _inProgress(false), _close(false) {
_backgroundType = GUI::ThemeEngine::kDialogBackgroundPlain;
+ _browser = new BrowserDialog(_("Select directory where to download game data"), true);
+ _remoteBrowser = new RemoteBrowserDialog(_("Select directory with game data"), true);
+
_messageText = new StaticTextWidget(this, "GlobalOptions_Cloud_DownloadDialog.DialogDesc", _("Press the button to download a directory"));
_mainButton = new ButtonWidget(this, "GlobalOptions_Cloud_DownloadDialog.MainButton", _("Start download"), 0, kDownloadDialogButtonCmd);
_closeButton = new ButtonWidget(this, "GlobalOptions_Cloud_DownloadDialog.CloseButton", _("OK"), 0, kCloseCmd);
@@ -47,6 +53,10 @@ DownloadDialog::DownloadDialog(uint32 storageId):
void DownloadDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
switch (cmd) {
case kDownloadDialogButtonCmd: {
+ if (!_inProgress) {
+ selectDirectories();
+ }
+
_inProgress = !_inProgress;
reflowLayout();
break;
@@ -56,6 +66,36 @@ void DownloadDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
}
}
+void DownloadDialog::selectDirectories() {
+ //first user should select remote directory to download
+ if (_remoteBrowser->runModal() <= 0) return;
+
+ /*
+ Common::FSNode dir(_browser->getResult());
+ Common::FSList files;
+ if (!dir.getChildren(files, Common::FSNode::kListAll)) {
+ MessageDialog alert(_("ScummVM couldn't open the specified directory!"));
+ alert.runModal();
+ return;
+ }
+ */
+
+ //now user should select local directory to download into
+ if (_browser->runModal() <= 0) return;
+
+ Common::FSNode dir(_browser->getResult());
+ Common::FSList files;
+ if (!dir.getChildren(files, Common::FSNode::kListAll)) {
+ MessageDialog alert(_("ScummVM couldn't open the specified directory!"));
+ alert.runModal();
+ return;
+ }
+
+ //TODO: require empty directory?
+
+ //TODO: initiate download
+}
+
void DownloadDialog::handleTickle() {
if (_close) {
setResult(1);