FreeRDP
Loading...
Searching...
No Matches
SdlConnectionDialogWrapper Class Reference

Public Types

enum  MsgType {
  MSG_NONE , MSG_INFO , MSG_WARN , MSG_ERROR ,
  MSG_DISCARD
}
 

Public Member Functions

 SdlConnectionDialogWrapper (wLog *log)
 
 SdlConnectionDialogWrapper (const SdlConnectionDialogWrapper &other)=delete
 
 SdlConnectionDialogWrapper (SdlConnectionDialogWrapper &&other)=delete
 
SdlConnectionDialogWrapperoperator= (const SdlConnectionDialogWrapper &other)=delete
 
SdlConnectionDialogWrapperoperator= (SdlConnectionDialogWrapper &&other)=delete
 
void create (rdpContext *context)
 
void destroy ()
 
bool isRunning () const
 
bool isVisible () const
 
bool handleEvent (const SDL_Event &event)
 
void setTitle (WINPR_FORMAT_ARG const char *fmt,...)
 
void setTitle (const std::string &title)
 
void showInfo (WINPR_FORMAT_ARG const char *fmt,...)
 
void showInfo (const std::string &info)
 
void showWarn (WINPR_FORMAT_ARG const char *fmt,...)
 
void showWarn (const std::string &info)
 
void showError (WINPR_FORMAT_ARG const char *fmt,...)
 
void showError (const std::string &error)
 
void show (SdlConnectionDialogWrapper::MsgType type, const std::string &msg)
 
void show (bool visible=true)
 
void handleShow ()
 

Detailed Description

Definition at line 36 of file sdl_connection_dialog_wrapper.hpp.

Member Enumeration Documentation

◆ MsgType

enum SdlConnectionDialogWrapper::MsgType

Definition at line 39 of file sdl_connection_dialog_wrapper.hpp.

40 {
41 MSG_NONE,
42 MSG_INFO,
43 MSG_WARN,
44 MSG_ERROR,
45 MSG_DISCARD
46 };

Constructor & Destructor Documentation

◆ SdlConnectionDialogWrapper()

SdlConnectionDialogWrapper::SdlConnectionDialogWrapper ( wLog *  log)
explicit

FreeRDP: A Remote Desktop Protocol Implementation SDL Client helper dialogs

Copyright 2025 Armin Novak armin.nosp@m..nov.nosp@m.ak@th.nosp@m.inca.nosp@m.st.co.nosp@m.m Copyright 2025 Thincast Technologies GmbH

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition at line 31 of file sdl_connection_dialog_wrapper.cpp.

31 : _log(log)
32{
33}

Member Function Documentation

◆ create()

void SdlConnectionDialogWrapper::create ( rdpContext *  context)

Definition at line 37 of file sdl_connection_dialog_wrapper.cpp.

38{
39 const auto enabled =
40 freerdp_settings_get_bool(context->settings, FreeRDP_UseCommonStdioCallbacks);
41 _connection_dialog.reset();
42 if (!enabled)
43 _connection_dialog = std::make_unique<SDLConnectionDialog>(context);
44}
FREERDP_API BOOL freerdp_settings_get_bool(const rdpSettings *settings, FreeRDP_Settings_Keys_Bool id)
Returns a boolean settings value.

◆ destroy()

void SdlConnectionDialogWrapper::destroy ( )

Definition at line 46 of file sdl_connection_dialog_wrapper.cpp.

47{
48 _connection_dialog.reset();
49}

◆ handleEvent()

bool SdlConnectionDialogWrapper::handleEvent ( const SDL_Event &  event)

Definition at line 67 of file sdl_connection_dialog_wrapper.cpp.

68{
69 std::unique_lock lock(_mux);
70 if (!_connection_dialog)
71 return false;
72 return _connection_dialog->handle(event);
73}

◆ handleShow()

void SdlConnectionDialogWrapper::handleShow ( )

Definition at line 159 of file sdl_connection_dialog_wrapper.cpp.

160{
161 std::unique_lock lock(_mux);
162 while (!_queue.empty())
163 {
164 auto arg = _queue.front();
165 _queue.pop();
166
167 if (arg.hasTitle() && _connection_dialog)
168 {
169 _connection_dialog->setTitle(arg.title().c_str());
170 }
171
172 if (arg.hasType() && arg.hasMessage())
173 {
174 switch (arg.type())
175 {
176 case SdlConnectionDialogWrapper::MSG_INFO:
177 if (_connection_dialog)
178 _connection_dialog->showInfo(arg.message().c_str());
179 else
180 WLog_Print(_log, WLOG_INFO, "%s", arg.message().c_str());
181 break;
182 case SdlConnectionDialogWrapper::MSG_WARN:
183 if (_connection_dialog)
184 _connection_dialog->showWarn(arg.message().c_str());
185 else
186 WLog_Print(_log, WLOG_WARN, "%s", arg.message().c_str());
187 break;
188 case SdlConnectionDialogWrapper::MSG_ERROR:
189 if (_connection_dialog)
190 _connection_dialog->showError(arg.message().c_str());
191 else
192 WLog_Print(_log, WLOG_ERROR, "%s", arg.message().c_str());
193 break;
194 default:
195 break;
196 }
197 }
198
199 if (arg.hasVisibility() && _connection_dialog)
200 {
201 if (arg.visible())
202 _connection_dialog->show();
203 else
204 _connection_dialog->hide();
205 }
206 }
207}

◆ isRunning()

bool SdlConnectionDialogWrapper::isRunning ( ) const

Definition at line 51 of file sdl_connection_dialog_wrapper.cpp.

52{
53 std::unique_lock lock(_mux);
54 if (!_connection_dialog)
55 return false;
56 return _connection_dialog->running();
57}

◆ isVisible()

bool SdlConnectionDialogWrapper::isVisible ( ) const

Definition at line 59 of file sdl_connection_dialog_wrapper.cpp.

60{
61 std::unique_lock lock(_mux);
62 if (!_connection_dialog)
63 return false;
64 return _connection_dialog->visible();
65}

◆ setTitle()

void SdlConnectionDialogWrapper::setTitle ( const std::string &  title)

Definition at line 104 of file sdl_connection_dialog_wrapper.cpp.

105{
106 push(EventArg{ title });
107}

◆ show() [1/2]

void SdlConnectionDialogWrapper::show ( bool  visible = true)

Definition at line 154 of file sdl_connection_dialog_wrapper.cpp.

155{
156 push(EventArg{ visible });
157}

◆ show() [2/2]

void SdlConnectionDialogWrapper::show ( SdlConnectionDialogWrapper::MsgType  type,
const std::string &  msg 
)

Definition at line 148 of file sdl_connection_dialog_wrapper.cpp.

150{
151 push({ type, msg, true });
152}

◆ showError()

void SdlConnectionDialogWrapper::showError ( const std::string &  error)

Definition at line 143 of file sdl_connection_dialog_wrapper.cpp.

144{
145 show(MSG_ERROR, error);
146}

◆ showInfo()

void SdlConnectionDialogWrapper::showInfo ( const std::string &  info)

Definition at line 117 of file sdl_connection_dialog_wrapper.cpp.

118{
119 show(MSG_INFO, info);
120}

◆ showWarn()

void SdlConnectionDialogWrapper::showWarn ( const std::string &  info)

Definition at line 130 of file sdl_connection_dialog_wrapper.cpp.

131{
132 show(MSG_WARN, info);
133}

The documentation for this class was generated from the following files: