diff options
author | Alexander Tkachev | 2016-06-09 17:00:05 +0600 |
---|---|---|
committer | Alexander Tkachev | 2016-08-24 16:07:55 +0600 |
commit | beb168a3a5bac602a9bf1455e7fe93dda0b13a1c (patch) | |
tree | d43f40afe80f97fbf35241ee992855f3817058e4 /gui | |
parent | e1e48968b4e5b7d55594adf038657bf6a8d7bc43 (diff) | |
download | scummvm-rg350-beb168a3a5bac602a9bf1455e7fe93dda0b13a1c.tar.gz scummvm-rg350-beb168a3a5bac602a9bf1455e7fe93dda0b13a1c.tar.bz2 scummvm-rg350-beb168a3a5bac602a9bf1455e7fe93dda0b13a1c.zip |
GUI: Add Cloud tab StorageWizardDialog
This is a dialog which guides user through Storage connection procedure.
Diffstat (limited to 'gui')
-rw-r--r-- | gui/module.mk | 1 | ||||
-rw-r--r-- | gui/options.cpp | 14 | ||||
-rw-r--r-- | gui/options.h | 1 | ||||
-rw-r--r-- | gui/storagewizarddialog.cpp | 73 | ||||
-rw-r--r-- | gui/storagewizarddialog.h | 43 | ||||
-rw-r--r-- | gui/themes/scummmodern/scummmodern_layout.stx | 43 | ||||
-rw-r--r-- | gui/themes/scummmodern/scummmodern_layout_lowres.stx | 38 |
7 files changed, 212 insertions, 1 deletions
diff --git a/gui/module.mk b/gui/module.mk index 2ffea5a2b5..ef005311cd 100644 --- a/gui/module.mk +++ b/gui/module.mk @@ -18,6 +18,7 @@ MODULE_OBJS := \ predictivedialog.o \ saveload.o \ saveload-dialog.o \ + storagewizarddialog.o \ themebrowser.o \ ThemeEngine.o \ ThemeEval.o \ diff --git a/gui/options.cpp b/gui/options.cpp index ec17a7ac09..ac3cc0cc3a 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -45,6 +45,7 @@ #ifdef USE_CLOUD #include "backends/cloud/cloudmanager.h" +#include "gui/storagewizarddialog.h" #endif namespace GUI { @@ -90,7 +91,7 @@ enum { #ifdef USE_CLOUD enum { - kChooseStorageCmd = 'chst' + kConfigureStorageCmd = 'cfst' }; #endif @@ -1288,6 +1289,8 @@ GlobalOptionsDialog::GlobalOptionsDialog() _storageLastSyncDesc = new StaticTextWidget(tab, "GlobalOptions_Cloud.StorageLastSyncDesc", _("Last sync time:"), _("When this storage did saves sync last time")); _storageLastSync = new StaticTextWidget(tab, "GlobalOptions_Cloud.StorageLastSyncLabel", "<never>"); + _storageConnectButton = new ButtonWidget(tab, "GlobalOptions_Cloud.ConnectButton", _("Connect"), _("Open wizard dialog to connect your cloud storage account"), kConfigureStorageCmd); + setupCloudTab(); #endif @@ -1576,6 +1579,14 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3 draw(); break; } + case kConfigureStorageCmd: + { + StorageWizardDialog dialog(_selectedStorageIndex); + dialog.runModal(); + setupCloudTab(); + draw(); + break; + } #endif #ifdef GUI_ENABLE_KEYSDIALOG case kChooseKeyMappingCmd: @@ -1661,6 +1672,7 @@ void GlobalOptionsDialog::setupCloudTab() { _storageLastSync->setLabel(sync); _storageLastSync->setVisible(shown); } + if (_storageConnectButton) _storageConnectButton->setVisible(shown); } #endif diff --git a/gui/options.h b/gui/options.h index 89670fdd64..4addf717b8 100644 --- a/gui/options.h +++ b/gui/options.h @@ -255,6 +255,7 @@ protected: StaticTextWidget *_storageUsedSpace; StaticTextWidget *_storageLastSyncDesc; StaticTextWidget *_storageLastSync; + ButtonWidget *_storageConnectButton; void setupCloudTab(); #endif diff --git a/gui/storagewizarddialog.cpp b/gui/storagewizarddialog.cpp new file mode 100644 index 0000000000..996365da03 --- /dev/null +++ b/gui/storagewizarddialog.cpp @@ -0,0 +1,73 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gui/storagewizarddialog.h" +#include "gui/widgets/list.h" +#include "gui/widget.h" +#include "gui/gui-manager.h" + +#include "common/translation.h" +#include "backends/cloud/cloudmanager.h" + +namespace GUI { + +enum { + kConnectCmd = 'Cnnt' +}; + +StorageWizardDialog::StorageWizardDialog(uint32 storageId): Dialog("GlobalOptions_Cloud_ConnectionWizard"), _storageId(storageId) { + _backgroundType = GUI::ThemeEngine::kDialogBackgroundPlain; + + Common::String headline = Common::String::format(_("%s Storage Connection Wizard"), CloudMan.listStorages()[_storageId].c_str()); + new StaticTextWidget(this, "GlobalOptions_Cloud_ConnectionWizard.Headline", headline); + + new StaticTextWidget(this, "GlobalOptions_Cloud_ConnectionWizard.NavigateLine", _s("Navigate to the following URL:")); + + Common::String url = "https://www.scummvm.org/cloud-"; + switch (storageId) { + case Cloud::kStorageDropboxId: url += "dropbox"; break; + case Cloud::kStorageOneDriveId: url += "onedrive"; break; + case Cloud::kStorageGoogleDriveId: url += "googledrive"; break; + } + + new StaticTextWidget(this, "GlobalOptions_Cloud_ConnectionWizard.URLLine", url); + + new StaticTextWidget(this, "GlobalOptions_Cloud_ConnectionWizard.ReturnLine1", _s("Press 'Continue' when you obtain")); + new StaticTextWidget(this, "GlobalOptions_Cloud_ConnectionWizard.ReturnLine2", _s("the code from the storage.")); + + // Buttons + new ButtonWidget(this, "GlobalOptions_Cloud_ConnectionWizard.CancelButton", _("Cancel"), 0, kCloseCmd); + new ButtonWidget(this, "GlobalOptions_Cloud_ConnectionWizard.ConnectButton", _("Connect"), 0, kConnectCmd); +} + +void StorageWizardDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { + switch (cmd) { + case kConnectCmd: + setResult(1); + close(); + break; + default: + Dialog::handleCommand(sender, cmd, data); + } +} + +} // End of namespace GUI diff --git a/gui/storagewizarddialog.h b/gui/storagewizarddialog.h new file mode 100644 index 0000000000..ec5329b8af --- /dev/null +++ b/gui/storagewizarddialog.h @@ -0,0 +1,43 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GUI_STORAGEWIZARDDIALOG_H +#define GUI_STORAGEWIZARDDIALOG_H + +#include "gui/dialog.h" +#include "common/str.h" + +namespace GUI { + +class CommandSender; + +class StorageWizardDialog : public Dialog { + uint32 _storageId; +public: + StorageWizardDialog(uint32 storageId); + + void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); +}; + +} // End of namespace GUI + +#endif diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx index a4b4ccda8b..8406fc9b28 100644 --- a/gui/themes/scummmodern/scummmodern_layout.stx +++ b/gui/themes/scummmodern/scummmodern_layout.stx @@ -572,6 +572,49 @@ height = 'Globals.Line.Height' /> </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'ConnectButton' + type = 'Button' + /> + </layout> + </layout> + </dialog> + + <dialog name = 'GlobalOptions_Cloud_ConnectionWizard' overlays = 'Dialog.GlobalOptions'> + <layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'Picture' + type = 'OptionsLabel' + /> + <layout type = 'vertical' padding = '0, 0, 0, 0' spacing = '6'> + <widget name = 'Headline' + height = 'Globals.Line.Height' + /> + <space size = '4' /> + <widget name = 'NavigateLine' + height = 'Globals.Line.Height' + /> + <widget name = 'URLLine' + height = 'Globals.Line.Height' + /> + <space size = '4' /> + <widget name = 'ReturnLine1' + height = 'Globals.Line.Height' + /> + <widget name = 'ReturnLine2' + height = 'Globals.Line.Height' + /> + <space size = '6' /> + </layout> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'CancelButton' + type = 'Button' + /> + <widget name = 'ConnectButton' + type = 'Button' + /> + </layout> </layout> </dialog> diff --git a/gui/themes/scummmodern/scummmodern_layout_lowres.stx b/gui/themes/scummmodern/scummmodern_layout_lowres.stx index 4a4479c564..13d854c9ac 100644 --- a/gui/themes/scummmodern/scummmodern_layout_lowres.stx +++ b/gui/themes/scummmodern/scummmodern_layout_lowres.stx @@ -569,6 +569,44 @@ height = 'Globals.Line.Height' /> </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' center = 'true'> + <widget name = 'ConnectButton' + type = 'Button' + /> + </layout> + </layout> + </dialog> + + <dialog name = 'GlobalOptions_Cloud_ConnectionWizard' overlays = 'Dialog.GlobalOptions'> + <layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'> + <layout type = 'vertical' padding = '0, 0, 0, 0' spacing = '4'> + <widget name = 'Headline' + height = 'Globals.Line.Height' + /> + <space size = '2' /> + <widget name = 'NavigateLine' + height = 'Globals.Line.Height' + /> + <widget name = 'URLLine' + height = 'Globals.Line.Height' + /> + <space size = '2' /> + <widget name = 'ReturnLine1' + height = 'Globals.Line.Height' + /> + <widget name = 'ReturnLine2' + height = 'Globals.Line.Height' + /> + <space size = '4' /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' center = 'true'> + <widget name = 'CancelButton' + type = 'Button' + /> + <widget name = 'ConnectButton' + type = 'Button' + /> + </layout> </layout> </dialog> |