aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorAlexander Tkachev2016-06-09 15:55:53 +0600
committerAlexander Tkachev2016-08-24 16:07:55 +0600
commite1e48968b4e5b7d55594adf038657bf6a8d7bc43 (patch)
tree6cd6824c243c29575bbaab8843b77b2315921f94 /gui
parent9b15ec9989fc67a0537b1e70732d3dba48797165 (diff)
downloadscummvm-rg350-e1e48968b4e5b7d55594adf038657bf6a8d7bc43.tar.gz
scummvm-rg350-e1e48968b4e5b7d55594adf038657bf6a8d7bc43.tar.bz2
scummvm-rg350-e1e48968b4e5b7d55594adf038657bf6a8d7bc43.zip
GUI: Replace Cloud tab's StorageBrowser with PopUp
Diffstat (limited to 'gui')
-rw-r--r--gui/module.mk1
-rw-r--r--gui/options.cpp27
-rw-r--r--gui/options.h3
-rw-r--r--gui/storagebrowser.cpp96
-rw-r--r--gui/storagebrowser.h51
-rw-r--r--gui/themes/scummmodern/scummmodern_layout.stx8
-rw-r--r--gui/themes/scummmodern/scummmodern_layout_lowres.stx40
7 files changed, 54 insertions, 172 deletions
diff --git a/gui/module.mk b/gui/module.mk
index ece360b3cc..2ffea5a2b5 100644
--- a/gui/module.mk
+++ b/gui/module.mk
@@ -18,7 +18,6 @@ MODULE_OBJS := \
predictivedialog.o \
saveload.o \
saveload-dialog.o \
- storagebrowser.o \
themebrowser.o \
ThemeEngine.o \
ThemeEval.o \
diff --git a/gui/options.cpp b/gui/options.cpp
index 2febf84f9f..ec17a7ac09 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -45,7 +45,6 @@
#ifdef USE_CLOUD
#include "backends/cloud/cloudmanager.h"
-#include "gui/storagebrowser.h"
#endif
namespace GUI {
@@ -1273,16 +1272,20 @@ GlobalOptionsDialog::GlobalOptionsDialog()
_selectedStorageIndex = CloudMan.getStorageIndex();
- new ButtonWidget(tab, "GlobalOptions_Cloud.StorageButton", _("Storage:"), 0, kChooseStorageCmd);
- _curStorage = new StaticTextWidget(tab, "GlobalOptions_Cloud.CurStorage", CloudMan.listStorages()[_selectedStorageIndex]);
+ _storagePopUpDesc = new StaticTextWidget(tab, "GlobalOptions_Cloud.StoragePopupDesc", _("Storage:"), _("Active cloud storage"));
+ _storagePopUp = new PopUpWidget(tab, "GlobalOptions_Cloud.StoragePopup");
+ Common::StringArray list = CloudMan.listStorages();
+ for (uint32 i = 0; i < list.size(); ++i)
+ _storagePopUp->appendEntry(list[i], i);
+ _storagePopUp->setSelected(_selectedStorageIndex);
_storageUsernameDesc = new StaticTextWidget(tab, "GlobalOptions_Cloud.StorageUsernameDesc", _("Username:"), _("Username used by this storage"));
_storageUsername = new StaticTextWidget(tab, "GlobalOptions_Cloud.StorageUsernameLabel", "<none>");
- _storageUsedSpaceDesc = new StaticTextWidget(tab, "GlobalOptions_Cloud.StorageUsedSpaceDesc", _("Used space:"), _("Space used by ScummVM on this storage"));
+ _storageUsedSpaceDesc = new StaticTextWidget(tab, "GlobalOptions_Cloud.StorageUsedSpaceDesc", _("Used space:"), _("Space used by ScummVM's saves on this storage"));
_storageUsedSpace = new StaticTextWidget(tab, "GlobalOptions_Cloud.StorageUsedSpaceLabel", "0 bytes");
- _storageLastSyncDesc = new StaticTextWidget(tab, "GlobalOptions_Cloud.StorageLastSyncDesc", _("Last sync time:"), _("When this storage did last saves sync"));
+ _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>");
setupCloudTab();
@@ -1567,15 +1570,10 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
break;
}
#ifdef USE_CLOUD
- case kChooseStorageCmd:
+ case kPopUpItemSelectedCmd:
{
- StorageBrowser storageBrowser;
- if (storageBrowser.runModal() > 0) {
- // User made his choice...
- _selectedStorageIndex = storageBrowser.getSelected();
- setupCloudTab();
- draw();
- }
+ setupCloudTab();
+ draw();
break;
}
#endif
@@ -1637,8 +1635,7 @@ void GlobalOptionsDialog::reflowLayout() {
#ifdef USE_CLOUD
void GlobalOptionsDialog::setupCloudTab() {
- if (_curStorage)
- _curStorage->setLabel(CloudMan.listStorages()[_selectedStorageIndex]);
+ _selectedStorageIndex = _storagePopUp->getSelectedTag();
bool shown = (_selectedStorageIndex != Cloud::kStorageNoneId);
if (_storageUsernameDesc) _storageUsernameDesc->setVisible(shown);
diff --git a/gui/options.h b/gui/options.h
index 16ea424b6f..89670fdd64 100644
--- a/gui/options.h
+++ b/gui/options.h
@@ -247,7 +247,8 @@ protected:
// Cloud controls
//
uint32 _selectedStorageIndex;
- StaticTextWidget *_curStorage;
+ StaticTextWidget *_storagePopUpDesc;
+ PopUpWidget *_storagePopUp;
StaticTextWidget *_storageUsernameDesc;
StaticTextWidget *_storageUsername;
StaticTextWidget *_storageUsedSpaceDesc;
diff --git a/gui/storagebrowser.cpp b/gui/storagebrowser.cpp
deleted file mode 100644
index 30a0e9e23d..0000000000
--- a/gui/storagebrowser.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/* 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/storagebrowser.h"
-#include "gui/widgets/list.h"
-#include "gui/widget.h"
-#include "gui/gui-manager.h"
-
-#include "common/translation.h"
-#ifdef USE_CLOUD
-#include "backends/cloud/cloudmanager.h"
-#endif
-
-namespace GUI {
-
-enum {
- kChooseCmd = 'Chos'
-};
-
-StorageBrowser::StorageBrowser() : Dialog("Browser") {
- new StaticTextWidget(this, "Browser.Headline", _("Select a Storage"));
-
- // Add storages list
- _storagesList = new ListWidget(this, "Browser.List");
- _storagesList->setNumberingMode(kListNumberingOff);
- _storagesList->setEditable(false);
-
- _backgroundType = GUI::ThemeEngine::kDialogBackgroundPlain;
-
- // Buttons
- new ButtonWidget(this, "Browser.Cancel", _("Cancel"), 0, kCloseCmd);
- new ButtonWidget(this, "Browser.Choose", _("Choose"), 0, kChooseCmd);
-}
-
-void StorageBrowser::open() {
- // Always refresh storages list
- updateListing();
-
- // Call super implementation
- Dialog::open();
-}
-
-void StorageBrowser::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
- switch (cmd) {
- case kChooseCmd:
- case kListItemActivatedCmd:
- case kListItemDoubleClickedCmd: {
- int selection = _storagesList->getSelected();
- if (selection < 0)
- break;
- _selectionIndex = selection;
- setResult(1);
- close();
- break;
- }
- default:
- Dialog::handleCommand(sender, cmd, data);
- }
-}
-
-void StorageBrowser::updateListing() {
- Common::StringArray list;
- uint32 currentStorageIndex = 0;
-#ifdef USE_CLOUD
- list = CloudMan.listStorages();
- currentStorageIndex = CloudMan.getStorageIndex();
-#endif
-
- _storagesList->setList(list);
- _storagesList->scrollTo(0);
- _storagesList->setSelected(currentStorageIndex);
-
- // Finally, redraw
- draw();
-}
-
-} // End of namespace GUI
diff --git a/gui/storagebrowser.h b/gui/storagebrowser.h
deleted file mode 100644
index b18c30f8c8..0000000000
--- a/gui/storagebrowser.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* 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_STORAGEBROWSER_H
-#define GUI_STORAGEBROWSER_H
-
-#include "gui/dialog.h"
-#include "common/str.h"
-
-namespace GUI {
-
-class CommandSender;
-class ListWidget;
-
-class StorageBrowser : public Dialog {
-public:
- StorageBrowser();
-
- void open();
- void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
-
- uint32 getSelected() const { return _selectionIndex; }
-private:
- ListWidget *_storagesList;
- uint32 _selectionIndex;
-
- void updateListing();
-};
-
-} // End of namespace GUI
-
-#endif
diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx
index 093eeba522..a4b4ccda8b 100644
--- a/gui/themes/scummmodern/scummmodern_layout.stx
+++ b/gui/themes/scummmodern/scummmodern_layout.stx
@@ -541,11 +541,11 @@
<dialog name = 'GlobalOptions_Cloud' overlays = 'Dialog.GlobalOptions.TabWidget'>
<layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'>
- <widget name = 'StorageButton'
- type = 'Button'
+ <widget name = 'StoragePopupDesc'
+ type = 'OptionsLabel'
/>
- <widget name = 'CurStorage'
- height = 'Globals.Line.Height'
+ <widget name = 'StoragePopup'
+ type = 'PopUp'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'>
diff --git a/gui/themes/scummmodern/scummmodern_layout_lowres.stx b/gui/themes/scummmodern/scummmodern_layout_lowres.stx
index 105c121a2b..4a4479c564 100644
--- a/gui/themes/scummmodern/scummmodern_layout_lowres.stx
+++ b/gui/themes/scummmodern/scummmodern_layout_lowres.stx
@@ -529,11 +529,43 @@
<dialog name = 'GlobalOptions_Cloud' overlays = 'Dialog.GlobalOptions.TabWidget'>
<layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'>
- <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'>
- <widget name = 'StorageButton'
- type = 'Button'
+ <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' center = 'true'>
+ <widget name = 'StoragePopupDesc'
+ width = '80'
+ height = 'Globals.Line.Height'
+ textalign = 'right'
+ />
+ <widget name = 'StoragePopup'
+ type = 'PopUp'
+ />
+ </layout>
+ <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' center = 'true'>
+ <widget name = 'StorageUsernameDesc'
+ width = '80'
+ height = 'Globals.Line.Height'
+ textalign = 'right'
+ />
+ <widget name = 'StorageUsernameLabel'
+ height = 'Globals.Line.Height'
+ />
+ </layout>
+ <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' center = 'true'>
+ <widget name = 'StorageUsedSpaceDesc'
+ width = '80'
+ height = 'Globals.Line.Height'
+ textalign = 'right'
+ />
+ <widget name = 'StorageUsedSpaceLabel'
+ height = 'Globals.Line.Height'
+ />
+ </layout>
+ <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' center = 'true'>
+ <widget name = 'StorageLastSyncDesc'
+ width = '80'
+ height = 'Globals.Line.Height'
+ textalign = 'right'
/>
- <widget name = 'CurStorage'
+ <widget name = 'StorageLastSyncLabel'
height = 'Globals.Line.Height'
/>
</layout>