diff --git a/gui/module.mk b/gui/module.mk index ece360b3ccd..2ffea5a2b59 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 2febf84f9f8..ec17a7ac094 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", ""); - _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", ""); 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 16ea424b6f3..89670fdd649 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 30a0e9e23d1..00000000000 --- 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 b18c30f8c8c..00000000000 --- 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 093eeba5229..a4b4ccda8bb 100644 --- a/gui/themes/scummmodern/scummmodern_layout.stx +++ b/gui/themes/scummmodern/scummmodern_layout.stx @@ -541,11 +541,11 @@ - - diff --git a/gui/themes/scummmodern/scummmodern_layout_lowres.stx b/gui/themes/scummmodern/scummmodern_layout_lowres.stx index 105c121a2b5..4a4479c5640 100644 --- a/gui/themes/scummmodern/scummmodern_layout_lowres.stx +++ b/gui/themes/scummmodern/scummmodern_layout_lowres.stx @@ -529,11 +529,43 @@ - - + - + + + + + + + + + + + +