diff options
-rw-r--r-- | gui/ThemeEngine.cpp | 1 | ||||
-rw-r--r-- | gui/ThemeEngine.h | 1 | ||||
-rw-r--r-- | gui/storagewizarddialog.cpp | 55 | ||||
-rw-r--r-- | gui/storagewizarddialog.h | 1 | ||||
-rw-r--r-- | gui/themes/scummclassic.zip | bin | 124903 -> 129092 bytes | |||
-rw-r--r-- | gui/themes/scummclassic/classic_layout.stx | 19 | ||||
-rw-r--r-- | gui/themes/scummclassic/classic_layout_lowres.stx | 4 | ||||
-rw-r--r-- | gui/themes/scummmodern.zip | bin | 1500676 -> 1545339 bytes | |||
-rw-r--r-- | gui/themes/scummmodern/dropbox.bmp | bin | 0 -> 40074 bytes | |||
-rw-r--r-- | gui/themes/scummmodern/scummmodern_gfx.stx | 1 | ||||
-rw-r--r-- | gui/themes/scummmodern/scummmodern_layout.stx | 19 | ||||
-rw-r--r-- | gui/themes/scummmodern/scummmodern_layout_lowres.stx | 4 |
12 files changed, 91 insertions, 14 deletions
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index ac209d60a2..e400e695db 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -61,6 +61,7 @@ const char *const ThemeEngine::kImageStopSmallButton = "stopbtn_small.bmp"; const char *const ThemeEngine::kImageEditSmallButton = "editbtn_small.bmp"; const char *const ThemeEngine::kImageSwitchModeSmallButton = "switchbtn_small.bmp"; const char *const ThemeEngine::kImageFastReplaySmallButton = "fastreplay_small.bmp"; +const char *const ThemeEngine::kImageDropboxLogo = "dropbox.bmp"; struct TextDrawData { const Graphics::Font *_fontPtr; diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h index 91f82b1122..eb9b7daefa 100644 --- a/gui/ThemeEngine.h +++ b/gui/ThemeEngine.h @@ -250,6 +250,7 @@ public: static const char *const kImageEditSmallButton; ///< Edit recording metadata in recorder onscreen dialog (for 320xY) static const char *const kImageSwitchModeSmallButton; ///< Switch mode button in recorder onscreen dialog (for 320xY) static const char *const kImageFastReplaySmallButton; ///< Fast playback mode button in recorder onscreen dialog (for 320xY) + static const char *const kImageDropboxLogo; ///< Dropbox logo used in the StorageWizardDialog /** * Graphics mode enumeration. diff --git a/gui/storagewizarddialog.cpp b/gui/storagewizarddialog.cpp index 9e522fb2de..e04ca0255e 100644 --- a/gui/storagewizarddialog.cpp +++ b/gui/storagewizarddialog.cpp @@ -20,6 +20,13 @@ * */ +#ifdef USE_SDL2 +#define FORBIDDEN_SYMBOL_ALLOW_ALL + +#include <SDL2/SDL.h> +#include <SDL2/SDL_clipboard.h> +#endif + #include "gui/storagewizarddialog.h" #include "gui/gui-manager.h" #include "gui/message.h" @@ -37,7 +44,8 @@ namespace GUI { enum { kConnectCmd = 'Cnnt', kCodeBoxCmd = 'CdBx', - kOpenUrlCmd = 'OpUr' + kOpenUrlCmd = 'OpUr', + kPasteCodeCmd = 'PsCd' }; StorageWizardDialog::StorageWizardDialog(uint32 storageId): @@ -62,6 +70,7 @@ StorageWizardDialog::StorageWizardDialog(uint32 storageId): // Buttons new ButtonWidget(this, "GlobalOptions_Cloud_ConnectionWizard.CancelButton", _("Cancel"), 0, kCloseCmd); new ButtonWidget(this, "GlobalOptions_Cloud_ConnectionWizard.OpenUrlButton", _("Open URL"), 0, kOpenUrlCmd); + _pasteCodeWidget = new ButtonWidget(this, "GlobalOptions_Cloud_ConnectionWizard.PasteCodeButton", _("Paste"), _("Pastes clipboard contents into fields"), kPasteCodeCmd); _connectWidget = new ButtonWidget(this, "GlobalOptions_Cloud_ConnectionWizard.ConnectButton", _("Connect"), 0, kConnectCmd); if (Cloud::CloudManager::couldUseLocalServer()) { @@ -72,7 +81,20 @@ StorageWizardDialog::StorageWizardDialog(uint32 storageId): _codeWidget[i]->setVisible(false); _messageWidget->setVisible(false); _connectWidget->setVisible(false); + _pasteCodeWidget->setVisible(false); } + +#ifndef USE_SDL2 + _pasteCodeWidget->setVisible(false); +#endif + +#ifndef DISABLE_FANCY_THEMES + if (g_gui.theme()->supportsImages() && g_system->getOverlayWidth() > 320) { // picture only in high-res + GraphicsWidget *gfx = new GraphicsWidget(this, "GlobalOptions_Cloud_ConnectionWizard.Picture"); + gfx->useThemeTransparency(true); + gfx->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageDropboxLogo)); + } +#endif } void StorageWizardDialog::open() { @@ -162,7 +184,7 @@ void StorageWizardDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3 //the last 3 chars must be an encoded crc16 if (code.size() > 3) { uint32 size = code.size(); - uint32 gotcrc = decodeHashchar(code[size-3]) | (decodeHashchar(code[size-2]) << 6) | (decodeHashchar(code[size-1]) << 12); + uint32 gotcrc = decodeHashchar(code[size - 3]) | (decodeHashchar(code[size - 2]) << 6) | (decodeHashchar(code[size - 1]) << 12); code.erase(size - 3); uint32 crc = crc16(code); ok = (crc == gotcrc); @@ -183,6 +205,35 @@ void StorageWizardDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3 } break; } + case kPasteCodeCmd: { +#ifdef USE_SDL2 + if (SDL_HasClipboardText() == SDL_TRUE) { + char *text = SDL_GetClipboardText(); + if (text != nullptr) { + Common::String message = text; + for (uint32 i = 0; i < CODE_FIELDS; ++i) { + if (message.empty()) break; + Common::String subcode = ""; + for (uint32 j = 0; j < message.size(); ++j) { + if (message[j] == ' ') { + message.erase(0, j+1); + break; + } + subcode += message[j]; + if (j+1 == message.size()) { + message = ""; + break; + } + } + _codeWidget[i]->setEditString(subcode); + } + handleCommand(sender, kCodeBoxCmd, data); + draw(); + } + } +#endif + break; + } case kConnectCmd: { Common::String code; for (uint32 i = 0; i < CODE_FIELDS; ++i) { diff --git a/gui/storagewizarddialog.h b/gui/storagewizarddialog.h index cc70f86278..b0d099957e 100644 --- a/gui/storagewizarddialog.h +++ b/gui/storagewizarddialog.h @@ -44,6 +44,7 @@ class StorageWizardDialog : public Dialog { uint32 _storageId; EditTextWidget *_codeWidget[CODE_FIELDS]; StaticTextWidget *_messageWidget; + ButtonWidget *_pasteCodeWidget; ButtonWidget *_connectWidget; bool _close; #ifdef USE_SDL_NET diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip Binary files differindex 4a36e7db99..42c6b10b73 100644 --- a/gui/themes/scummclassic.zip +++ b/gui/themes/scummclassic.zip diff --git a/gui/themes/scummclassic/classic_layout.stx b/gui/themes/scummclassic/classic_layout.stx index 2e37b00c91..3284f7d565 100644 --- a/gui/themes/scummclassic/classic_layout.stx +++ b/gui/themes/scummclassic/classic_layout.stx @@ -637,9 +637,18 @@ <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 = 'Picture' + width = '115' + height = '115' + /> + <widget name = 'OpenUrlButton' + type = 'Button' + /> + <widget name = 'PasteCodeButton' + type = 'Button' + /> + </layout> <layout type = 'vertical' padding = '0, 0, 0, 0' spacing = '6'> <widget name = 'Headline' height = 'Globals.Line.Height' @@ -704,9 +713,7 @@ <widget name = 'CancelButton' type = 'Button' /> - <widget name = 'OpenUrlButton' - type = 'Button' - /> + <space /> <widget name = 'ConnectButton' type = 'Button' /> diff --git a/gui/themes/scummclassic/classic_layout_lowres.stx b/gui/themes/scummclassic/classic_layout_lowres.stx index 06ce6f6003..7666aeb585 100644 --- a/gui/themes/scummclassic/classic_layout_lowres.stx +++ b/gui/themes/scummclassic/classic_layout_lowres.stx @@ -709,6 +709,7 @@ height = 'Globals.Line.Height' /> <space size = '4' /> + <widget name = 'Picture' width = '1' height = '1' /> </layout> <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' center = 'true'> <widget name = 'CancelButton' @@ -717,6 +718,9 @@ <widget name = 'OpenUrlButton' type = 'Button' /> + <widget name = 'PasteCodeButton' + type = 'Button' + /> <widget name = 'ConnectButton' type = 'Button' /> diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip Binary files differindex fcf35d97e2..b433aaae7a 100644 --- a/gui/themes/scummmodern.zip +++ b/gui/themes/scummmodern.zip diff --git a/gui/themes/scummmodern/dropbox.bmp b/gui/themes/scummmodern/dropbox.bmp Binary files differnew file mode 100644 index 0000000000..bfb9e90792 --- /dev/null +++ b/gui/themes/scummmodern/dropbox.bmp diff --git a/gui/themes/scummmodern/scummmodern_gfx.stx b/gui/themes/scummmodern/scummmodern_gfx.stx index 31b194d174..d7b35b10b9 100644 --- a/gui/themes/scummmodern/scummmodern_gfx.stx +++ b/gui/themes/scummmodern/scummmodern_gfx.stx @@ -119,6 +119,7 @@ <bitmap filename = 'editbtn_small.bmp'/> <bitmap filename = 'switchbtn_small.bmp'/> <bitmap filename = 'fastreplay_small.bmp'/> + <bitmap filename = 'dropbox.bmp'/> </bitmaps> <fonts> diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx index 49876be18b..a242229dff 100644 --- a/gui/themes/scummmodern/scummmodern_layout.stx +++ b/gui/themes/scummmodern/scummmodern_layout.stx @@ -651,9 +651,18 @@ <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 = 'Picture' + width = '115' + height = '115' + /> + <widget name = 'OpenUrlButton' + type = 'Button' + /> + <widget name = 'PasteCodeButton' + type = 'Button' + /> + </layout> <layout type = 'vertical' padding = '0, 0, 0, 0' spacing = '6'> <widget name = 'Headline' height = 'Globals.Line.Height' @@ -718,9 +727,7 @@ <widget name = 'CancelButton' type = 'Button' /> - <widget name = 'OpenUrlButton' - type = 'Button' - /> + <space /> <widget name = 'ConnectButton' type = 'Button' /> diff --git a/gui/themes/scummmodern/scummmodern_layout_lowres.stx b/gui/themes/scummmodern/scummmodern_layout_lowres.stx index e10ce4a6c2..26f7fab465 100644 --- a/gui/themes/scummmodern/scummmodern_layout_lowres.stx +++ b/gui/themes/scummmodern/scummmodern_layout_lowres.stx @@ -707,6 +707,7 @@ height = 'Globals.Line.Height' /> <space size = '4' /> + <widget name = 'Picture' width = '1' height = '1' /> </layout> <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' center = 'true'> <widget name = 'CancelButton' @@ -715,6 +716,9 @@ <widget name = 'OpenUrlButton' type = 'Button' /> + <widget name = 'PasteCodeButton' + type = 'Button' + /> <widget name = 'ConnectButton' type = 'Button' /> |