[Scummvm-git-logs] scummvm master -> 5d0c8946365b49cd2fa33b8f0b36982c6a560555
sev-
noreply at scummvm.org
Thu Jul 27 07:13:03 UTC 2023
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
5d0c894636 CLOUD: Add a load button to fetch JSON from a file
Commit: 5d0c8946365b49cd2fa33b8f0b36982c6a560555
https://github.com/scummvm/scummvm/commit/5d0c8946365b49cd2fa33b8f0b36982c6a560555
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2023-07-27T09:12:59+02:00
Commit Message:
CLOUD: Add a load button to fetch JSON from a file
This can be used on handhelds where there is no browser.
The user does the login process on its desktop, saves the JSON in a file
and uploads it to its handheld through an unspecified mean and loads it
on ScummVM using this new button.
Changed paths:
gui/cloudconnectionwizard.cpp
gui/cloudconnectionwizard.h
gui/themes/common/highres_layout.stx
gui/themes/common/lowres_layout.stx
gui/themes/residualvm.zip
gui/themes/scummclassic.zip
gui/themes/scummmodern.zip
gui/themes/scummremastered.zip
diff --git a/gui/cloudconnectionwizard.cpp b/gui/cloudconnectionwizard.cpp
index 5618da2278a..8f7fab1b543 100644
--- a/gui/cloudconnectionwizard.cpp
+++ b/gui/cloudconnectionwizard.cpp
@@ -28,10 +28,12 @@
#endif // USE_SDL_NET
#include "common/formats/json.h"
+#include "common/file.h"
#include "common/memstream.h"
#include "common/tokenizer.h"
#include "common/translation.h"
+#include "gui/browser.h"
#include "gui/message.h"
#include "gui/gui-manager.h"
#include "gui/widget.h"
@@ -49,6 +51,7 @@ enum {
kCloudConnectionWizardOpenUrlStorageCmd = 'WOUb',
kCloudConnectionWizardReflowCmd = 'WRFb',
kCloudConnectionWizardPasteCodeCmd = 'WPCb',
+ kCloudConnectionWizardLoadCodeCmd = 'WLCd',
};
CloudConnectionWizard::CloudConnectionWizard() :
@@ -66,6 +69,7 @@ CloudConnectionWizard::CloudConnectionWizard() :
_label2 = nullptr;
_label3 = nullptr;
_button0 = nullptr;
+ _button1 = nullptr;
_container = nullptr;
_quickModeButton = nullptr;
@@ -355,6 +359,7 @@ void CloudConnectionWizard::showStepManualMode2() {
_label0 = new StaticTextWidget(_container, "ConnectionWizard_ManualModeStep2.Line1", _("Copy the JSON code from the browser here and press Next:"));
_codeBox = new EditTextWidget(_container, "ConnectionWizard_ManualModeStep2.CodeBox", Common::U32String(), Common::U32String(), 0, 0, ThemeEngine::kFontStyleConsole);
_button0 = new ButtonWidget(_container, "ConnectionWizard_ManualModeStep2.PasteButton", _("Paste"), _("Paste code from clipboard"), kCloudConnectionWizardPasteCodeCmd);
+ _button1 = new ButtonWidget(_container, "ConnectionWizard_ManualModeStep2.LoadButton", _("Load"), _("Load code from file"), kCloudConnectionWizardLoadCodeCmd);
_label1 = new StaticTextWidget(_container, "ConnectionWizard_ManualModeStep2.Line2", Common::U32String());
}
@@ -366,6 +371,7 @@ void CloudConnectionWizard::hideStepManualMode2() {
removeWidgetChecked(_label0);
removeWidgetChecked(_codeBox);
removeWidgetChecked(_button0);
+ removeWidgetChecked(_button1);
removeWidgetChecked(_label1);
}
@@ -620,6 +626,24 @@ void CloudConnectionWizard::handleCommand(CommandSender *sender, uint32 cmd, uin
}
break;
+ case kCloudConnectionWizardLoadCodeCmd: {
+ // I18N: JSON is a file format name
+ BrowserDialog browser(_("Select JSON file copied from scummvm.org site"), false);
+ if (browser.runModal() > 0) {
+ // User made his choice...
+ Common::File codeFile;
+ if (!codeFile.open(browser.getResult())) {
+ // I18N: JSON is a file format name
+ MessageDialog alert(_("Failed to load JSON file"));
+ alert.runModal();
+ break;
+ }
+ Common::String json = codeFile.readString();
+ _codeBox->setEditString(json);
+ }
+ break;
+ }
+
case kCloudConnectionWizardNextButtonCmd:
switch (_currentStep) {
case Step::QUICK_MODE_STEP_1:
diff --git a/gui/cloudconnectionwizard.h b/gui/cloudconnectionwizard.h
index e44b3705b08..b4a0e972f17 100644
--- a/gui/cloudconnectionwizard.h
+++ b/gui/cloudconnectionwizard.h
@@ -66,6 +66,7 @@ class CloudConnectionWizard : public Dialog {
StaticTextWidget *_label2;
StaticTextWidget *_label3;
ButtonWidget *_button0;
+ ButtonWidget *_button1;
// specific widgets
ScrollContainerWidget *_container;
diff --git a/gui/themes/common/highres_layout.stx b/gui/themes/common/highres_layout.stx
index c4adff403d8..38cc5ad0dfe 100644
--- a/gui/themes/common/highres_layout.stx
+++ b/gui/themes/common/highres_layout.stx
@@ -1416,6 +1416,10 @@
height = '24'
/>
<space size = '8' />
+ <widget name = 'LoadButton'
+ height = '24'
+ />
+ <space size = '8' />
<widget name = 'Line2'
height = 'Globals.Line.Height'
diff --git a/gui/themes/common/lowres_layout.stx b/gui/themes/common/lowres_layout.stx
index 6f3b7235761..73a703b4362 100644
--- a/gui/themes/common/lowres_layout.stx
+++ b/gui/themes/common/lowres_layout.stx
@@ -1278,6 +1278,10 @@
height = '16'
/>
<space size = '8' />
+ <widget name = 'LoadButton'
+ height = '16'
+ />
+ <space size = '8' />
<widget name = 'Line2'
height = 'Globals.Line.Height'
diff --git a/gui/themes/residualvm.zip b/gui/themes/residualvm.zip
index 9ada4ddfeb4..4337701aae4 100644
Binary files a/gui/themes/residualvm.zip and b/gui/themes/residualvm.zip differ
diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip
index 39a4ccedc93..80bd50bb92d 100644
Binary files a/gui/themes/scummclassic.zip and b/gui/themes/scummclassic.zip differ
diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip
index 7982a2629b5..98eabb6dec5 100644
Binary files a/gui/themes/scummmodern.zip and b/gui/themes/scummmodern.zip differ
diff --git a/gui/themes/scummremastered.zip b/gui/themes/scummremastered.zip
index fe6d413f4de..0cba1fbbd78 100644
Binary files a/gui/themes/scummremastered.zip and b/gui/themes/scummremastered.zip differ
More information about the Scummvm-git-logs
mailing list