mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-12 12:09:15 +00:00
GUI: Add Cloud tab StorageWizardDialog
This is a dialog which guides user through Storage connection procedure.
This commit is contained in:
parent
e1e48968b4
commit
beb168a3a5
@ -18,6 +18,7 @@ MODULE_OBJS := \
|
||||
predictivedialog.o \
|
||||
saveload.o \
|
||||
saveload-dialog.o \
|
||||
storagewizarddialog.o \
|
||||
themebrowser.o \
|
||||
ThemeEngine.o \
|
||||
ThemeEval.o \
|
||||
|
@ -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
|
||||
|
||||
|
@ -255,6 +255,7 @@ protected:
|
||||
StaticTextWidget *_storageUsedSpace;
|
||||
StaticTextWidget *_storageLastSyncDesc;
|
||||
StaticTextWidget *_storageLastSync;
|
||||
ButtonWidget *_storageConnectButton;
|
||||
|
||||
void setupCloudTab();
|
||||
#endif
|
||||
|
73
gui/storagewizarddialog.cpp
Normal file
73
gui/storagewizarddialog.cpp
Normal file
@ -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
|
43
gui/storagewizarddialog.h
Normal file
43
gui/storagewizarddialog.h
Normal file
@ -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
|
@ -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>
|
||||
|
||||
|
@ -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>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user