[client,sdl] show a logo on connection dialog
* Show a icon to indicate the type of message * Show the FreeRDP logo below the icon
This commit is contained in:
parent
23f8fd2fee
commit
c269086765
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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<SdlWidget> _list;
|
||||
std::vector<widget_cfg_t> _list;
|
||||
SdlButtonList _buttons;
|
||||
};
|
||||
|
||||
|
@ -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(
|
||||
|
Before Width: | Height: | Size: 518 B After Width: | Height: | Size: 518 B |
Before Width: | Height: | Size: 380 B After Width: | Height: | Size: 380 B |
Before Width: | Height: | Size: 295 B After Width: | Height: | Size: 295 B |
Loading…
Reference in New Issue
Block a user