diff --git a/client/SDL/dialogs/res/CMakeLists.txt b/client/SDL/dialogs/res/CMakeLists.txt index 98e3c3fb3..cb94d08de 100644 --- a/client/SDL/dialogs/res/CMakeLists.txt +++ b/client/SDL/dialogs/res/CMakeLists.txt @@ -5,14 +5,14 @@ add_executable(freerdp-res2bin set(SRCS sdl_resource_manager.cpp - sdl_resource_manager.hpp + sdl_resource_manager.hpp ) set(RES_SVG_FILES ${CMAKE_SOURCE_DIR}/resources/FreeRDP_Icon.svg - ${CMAKE_SOURCE_DIR}/resources/error_FILL0_wght400_GRAD0_opsz24.svg - ${CMAKE_SOURCE_DIR}/resources/feedback_FILL0_wght400_GRAD0_opsz24.svg - ${CMAKE_SOURCE_DIR}/resources/warning_FILL0_wght400_GRAD0_opsz24.svg + ${CMAKE_SOURCE_DIR}/resources/icon_info.svg + ${CMAKE_SOURCE_DIR}/resources/icon_warning.svg + ${CMAKE_SOURCE_DIR}/resources/icon_error.svg ) set(RES_FONT_FILES diff --git a/client/SDL/dialogs/sdl_connection_dialog.cpp b/client/SDL/dialogs/sdl_connection_dialog.cpp index 0a2a2db2a..f2644249f 100644 --- a/client/SDL/dialogs/sdl_connection_dialog.cpp +++ b/client/SDL/dialogs/sdl_connection_dialog.cpp @@ -26,8 +26,12 @@ static const SDL_Color backgroundcolor = { 0x38, 0x36, 0x35, 0xff }; static const SDL_Color textcolor = { 0xd1, 0xcf, 0xcd, 0xff }; +static const SDL_Color infocolor = { 0x43, 0xe0, 0x0f, 0x60 }; +static const SDL_Color warncolor = { 0xcd, 0xca, 0x35, 0x60 }; +static const SDL_Color errorcolor = { 0xf7, 0x22, 0x30, 0x60 }; static const Uint32 vpadding = 5; +static const Uint32 hpadding = 5; SDLConnectionDialog::SDLConnectionDialog(rdpContext* context) : _context(context), _window(nullptr), _renderer(nullptr) @@ -136,7 +140,7 @@ bool SDLConnectionDialog::setModal() if (sdl->windows.empty()) return true; - auto parent = sdl->windows.front().window; + auto parent = sdl->windows.front().window(); SDL_SetWindowModalFor(_window, parent); SDL_RaiseWindow(_window); } @@ -166,7 +170,7 @@ bool SDLConnectionDialog::update(SDL_Renderer* renderer) for (auto& btn : _list) { - if (!btn.update_text(renderer, _msg, textcolor)) + if (!btn.widget.update_text(renderer, _msg, btn.fgcolor, btn.bgcolor)) return false; } @@ -337,32 +341,49 @@ bool SDLConnectionDialog::createWindow() } std::string res_name; + SDL_Color res_bgcolor; switch (_type_active) { case MSG_INFO: - res_name = "feedback_FILL0_wght400_GRAD0_opsz24.svg"; + res_name = "icon_info.svg"; + res_bgcolor = infocolor; break; case MSG_WARN: - res_name = "warning_FILL0_wght400_GRAD0_opsz24.svg"; + res_name = "icon_warning.svg"; + res_bgcolor = warncolor; break; case MSG_ERROR: - res_name = "error_FILL0_wght400_GRAD0_opsz24.svg"; + res_name = "icon_error.svg"; + res_bgcolor = errorcolor; break; case MSG_DISCARD: default: - res_name = "FreeRDP_Icon.svg"; + res_name = ""; + res_bgcolor = backgroundcolor; break; } - SdlWidget icon = { _renderer, - { 0, vpadding, widget_width / 4, - total_height - 3 * vpadding - widget_height }, - SDLResourceManager::get(SDLResourceManager::typeImages(), res_name) }; + int height = (total_height - 3 * vpadding) / 2; + SDL_Rect iconRect{ hpadding, vpadding, widget_width / 4 - 2 * hpadding, height }; + widget_cfg_t icon{ textcolor, + res_bgcolor, + { _renderer, iconRect, + SDLResourceManager::get(SDLResourceManager::typeImages(), res_name) } }; _list.emplace_back(std::move(icon)); + + iconRect.y += height; + + widget_cfg_t logo{ textcolor, + backgroundcolor, + { _renderer, iconRect, + SDLResourceManager::get(SDLResourceManager::typeImages(), + "FreeRDP_Icon.svg") } }; + _list.emplace_back(std::move(logo)); + SDL_Rect rect = { widget_width / 4, vpadding, widget_width * 3 / 4, total_height - 3 * vpadding - widget_height }; - auto w = SdlWidget(_renderer, rect, false); - w.set_wrap(true, widget_width); + widget_cfg_t w{ textcolor, backgroundcolor, { _renderer, rect, false } }; + w.widget.set_wrap(true, widget_width); _list.emplace_back(std::move(w)); rect.y += widget_height + vpadding; diff --git a/client/SDL/dialogs/sdl_connection_dialog.hpp b/client/SDL/dialogs/sdl_connection_dialog.hpp index 5223a8ed1..8620a68f9 100644 --- a/client/SDL/dialogs/sdl_connection_dialog.hpp +++ b/client/SDL/dialogs/sdl_connection_dialog.hpp @@ -86,6 +86,14 @@ class SDLConnectionDialog private: static Uint32 timeout(Uint32 intervalMS, void* _this); + private: + struct widget_cfg_t + { + SDL_Color fgcolor; + SDL_Color bgcolor; + SdlWidget widget; + }; + private: rdpContext* _context; SDL_Window* _window; @@ -97,7 +105,7 @@ class SDLConnectionDialog MsgType _type_active = MSG_NONE; SDL_TimerID _timer = -1; bool _running = false; - std::vector _list; + std::vector _list; SdlButtonList _buttons; }; diff --git a/client/SDL/dialogs/sdl_dialogs.cpp b/client/SDL/dialogs/sdl_dialogs.cpp index e2f98e1a7..80a1cddc4 100644 --- a/client/SDL/dialogs/sdl_dialogs.cpp +++ b/client/SDL/dialogs/sdl_dialogs.cpp @@ -236,11 +236,6 @@ SSIZE_T sdl_retry_dialog(freerdp* instance, const char* what, size_t current, vo auto settings = instance->context->settings; const BOOL enabled = freerdp_settings_get_bool(settings, FreeRDP_AutoReconnectionEnabled); - SDL_Window* window = nullptr; - if (!sdl->windows.empty()) - { - window = sdl->windows.begin()->window; - } if (!enabled) { sdl->connection_dialog->showError( diff --git a/resources/error_FILL0_wght400_GRAD0_opsz24.svg b/resources/icon_error.svg similarity index 100% rename from resources/error_FILL0_wght400_GRAD0_opsz24.svg rename to resources/icon_error.svg diff --git a/resources/feedback_FILL0_wght400_GRAD0_opsz24.svg b/resources/icon_info.svg similarity index 100% rename from resources/feedback_FILL0_wght400_GRAD0_opsz24.svg rename to resources/icon_info.svg diff --git a/resources/warning_FILL0_wght400_GRAD0_opsz24.svg b/resources/icon_warning.svg similarity index 100% rename from resources/warning_FILL0_wght400_GRAD0_opsz24.svg rename to resources/icon_warning.svg