diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index ac209d60a2e..e400e695dbf 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 91f82b1122f..eb9b7daefa5 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 9e522fb2de4..e04ca0255ea 100644 --- a/gui/storagewizarddialog.cpp +++ b/gui/storagewizarddialog.cpp @@ -20,6 +20,13 @@ * */ +#ifdef USE_SDL2 +#define FORBIDDEN_SYMBOL_ALLOW_ALL + +#include +#include +#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 cc70f862783..b0d099957ea 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 index 4a36e7db99f..42c6b10b73d 100644 Binary files a/gui/themes/scummclassic.zip and b/gui/themes/scummclassic.zip differ diff --git a/gui/themes/scummclassic/classic_layout.stx b/gui/themes/scummclassic/classic_layout.stx index 2e37b00c91d..3284f7d5654 100644 --- a/gui/themes/scummclassic/classic_layout.stx +++ b/gui/themes/scummclassic/classic_layout.stx @@ -637,9 +637,18 @@ - + + + + + - + diff --git a/gui/themes/scummclassic/classic_layout_lowres.stx b/gui/themes/scummclassic/classic_layout_lowres.stx index 06ce6f6003a..7666aeb585c 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' /> + + diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip index fcf35d97e21..b433aaae7a0 100644 Binary files a/gui/themes/scummmodern.zip and b/gui/themes/scummmodern.zip differ diff --git a/gui/themes/scummmodern/dropbox.bmp b/gui/themes/scummmodern/dropbox.bmp new file mode 100644 index 00000000000..bfb9e90792e Binary files /dev/null and b/gui/themes/scummmodern/dropbox.bmp differ diff --git a/gui/themes/scummmodern/scummmodern_gfx.stx b/gui/themes/scummmodern/scummmodern_gfx.stx index 31b194d1741..d7b35b10b9e 100644 --- a/gui/themes/scummmodern/scummmodern_gfx.stx +++ b/gui/themes/scummmodern/scummmodern_gfx.stx @@ -119,6 +119,7 @@ + diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx index 49876be18b7..a242229dff8 100644 --- a/gui/themes/scummmodern/scummmodern_layout.stx +++ b/gui/themes/scummmodern/scummmodern_layout.stx @@ -651,9 +651,18 @@ - + + + + + - + diff --git a/gui/themes/scummmodern/scummmodern_layout_lowres.stx b/gui/themes/scummmodern/scummmodern_layout_lowres.stx index e10ce4a6c2b..26f7fab4652 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' /> + +