mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 12:39:56 +00:00
GUI: Replace Cloud tab's StorageBrowser with PopUp
This commit is contained in:
parent
9b15ec9989
commit
e1e48968b4
@ -18,7 +18,6 @@ MODULE_OBJS := \
|
|||||||
predictivedialog.o \
|
predictivedialog.o \
|
||||||
saveload.o \
|
saveload.o \
|
||||||
saveload-dialog.o \
|
saveload-dialog.o \
|
||||||
storagebrowser.o \
|
|
||||||
themebrowser.o \
|
themebrowser.o \
|
||||||
ThemeEngine.o \
|
ThemeEngine.o \
|
||||||
ThemeEval.o \
|
ThemeEval.o \
|
||||||
|
@ -45,7 +45,6 @@
|
|||||||
|
|
||||||
#ifdef USE_CLOUD
|
#ifdef USE_CLOUD
|
||||||
#include "backends/cloud/cloudmanager.h"
|
#include "backends/cloud/cloudmanager.h"
|
||||||
#include "gui/storagebrowser.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
@ -1273,16 +1272,20 @@ GlobalOptionsDialog::GlobalOptionsDialog()
|
|||||||
|
|
||||||
_selectedStorageIndex = CloudMan.getStorageIndex();
|
_selectedStorageIndex = CloudMan.getStorageIndex();
|
||||||
|
|
||||||
new ButtonWidget(tab, "GlobalOptions_Cloud.StorageButton", _("Storage:"), 0, kChooseStorageCmd);
|
_storagePopUpDesc = new StaticTextWidget(tab, "GlobalOptions_Cloud.StoragePopupDesc", _("Storage:"), _("Active cloud storage"));
|
||||||
_curStorage = new StaticTextWidget(tab, "GlobalOptions_Cloud.CurStorage", CloudMan.listStorages()[_selectedStorageIndex]);
|
_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"));
|
_storageUsernameDesc = new StaticTextWidget(tab, "GlobalOptions_Cloud.StorageUsernameDesc", _("Username:"), _("Username used by this storage"));
|
||||||
_storageUsername = new StaticTextWidget(tab, "GlobalOptions_Cloud.StorageUsernameLabel", "<none>");
|
_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");
|
_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>");
|
_storageLastSync = new StaticTextWidget(tab, "GlobalOptions_Cloud.StorageLastSyncLabel", "<never>");
|
||||||
|
|
||||||
setupCloudTab();
|
setupCloudTab();
|
||||||
@ -1567,15 +1570,10 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef USE_CLOUD
|
#ifdef USE_CLOUD
|
||||||
case kChooseStorageCmd:
|
case kPopUpItemSelectedCmd:
|
||||||
{
|
{
|
||||||
StorageBrowser storageBrowser;
|
setupCloudTab();
|
||||||
if (storageBrowser.runModal() > 0) {
|
draw();
|
||||||
// User made his choice...
|
|
||||||
_selectedStorageIndex = storageBrowser.getSelected();
|
|
||||||
setupCloudTab();
|
|
||||||
draw();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1637,8 +1635,7 @@ void GlobalOptionsDialog::reflowLayout() {
|
|||||||
|
|
||||||
#ifdef USE_CLOUD
|
#ifdef USE_CLOUD
|
||||||
void GlobalOptionsDialog::setupCloudTab() {
|
void GlobalOptionsDialog::setupCloudTab() {
|
||||||
if (_curStorage)
|
_selectedStorageIndex = _storagePopUp->getSelectedTag();
|
||||||
_curStorage->setLabel(CloudMan.listStorages()[_selectedStorageIndex]);
|
|
||||||
|
|
||||||
bool shown = (_selectedStorageIndex != Cloud::kStorageNoneId);
|
bool shown = (_selectedStorageIndex != Cloud::kStorageNoneId);
|
||||||
if (_storageUsernameDesc) _storageUsernameDesc->setVisible(shown);
|
if (_storageUsernameDesc) _storageUsernameDesc->setVisible(shown);
|
||||||
|
@ -247,7 +247,8 @@ protected:
|
|||||||
// Cloud controls
|
// Cloud controls
|
||||||
//
|
//
|
||||||
uint32 _selectedStorageIndex;
|
uint32 _selectedStorageIndex;
|
||||||
StaticTextWidget *_curStorage;
|
StaticTextWidget *_storagePopUpDesc;
|
||||||
|
PopUpWidget *_storagePopUp;
|
||||||
StaticTextWidget *_storageUsernameDesc;
|
StaticTextWidget *_storageUsernameDesc;
|
||||||
StaticTextWidget *_storageUsername;
|
StaticTextWidget *_storageUsername;
|
||||||
StaticTextWidget *_storageUsedSpaceDesc;
|
StaticTextWidget *_storageUsedSpaceDesc;
|
||||||
|
@ -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
|
|
@ -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
|
|
@ -541,11 +541,11 @@
|
|||||||
<dialog name = 'GlobalOptions_Cloud' overlays = 'Dialog.GlobalOptions.TabWidget'>
|
<dialog name = 'GlobalOptions_Cloud' overlays = 'Dialog.GlobalOptions.TabWidget'>
|
||||||
<layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'>
|
<layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'>
|
||||||
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'>
|
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'>
|
||||||
<widget name = 'StorageButton'
|
<widget name = 'StoragePopupDesc'
|
||||||
type = 'Button'
|
type = 'OptionsLabel'
|
||||||
/>
|
/>
|
||||||
<widget name = 'CurStorage'
|
<widget name = 'StoragePopup'
|
||||||
height = 'Globals.Line.Height'
|
type = 'PopUp'
|
||||||
/>
|
/>
|
||||||
</layout>
|
</layout>
|
||||||
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'>
|
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'>
|
||||||
|
@ -529,11 +529,43 @@
|
|||||||
|
|
||||||
<dialog name = 'GlobalOptions_Cloud' overlays = 'Dialog.GlobalOptions.TabWidget'>
|
<dialog name = 'GlobalOptions_Cloud' overlays = 'Dialog.GlobalOptions.TabWidget'>
|
||||||
<layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'>
|
<layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'>
|
||||||
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'>
|
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' center = 'true'>
|
||||||
<widget name = 'StorageButton'
|
<widget name = 'StoragePopupDesc'
|
||||||
type = 'Button'
|
width = '80'
|
||||||
|
height = 'Globals.Line.Height'
|
||||||
|
textalign = 'right'
|
||||||
/>
|
/>
|
||||||
<widget name = 'CurStorage'
|
<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 = 'StorageLastSyncLabel'
|
||||||
height = 'Globals.Line.Height'
|
height = 'Globals.Line.Height'
|
||||||
/>
|
/>
|
||||||
</layout>
|
</layout>
|
||||||
|
Loading…
Reference in New Issue
Block a user