mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-17 22:25:37 +00:00
NoGUI: Add ConfirmMessage() to platform
This commit is contained in:
parent
d2d2e3ae6e
commit
c90e2f19fc
|
@ -293,7 +293,6 @@ void Host::ReportErrorAsync(const std::string_view& title, const std::string_vie
|
|||
|
||||
bool Host::ConfirmMessage(const std::string_view& title, const std::string_view& message)
|
||||
{
|
||||
// TODO: Post to window
|
||||
if (!title.empty() && !message.empty())
|
||||
{
|
||||
Log_ErrorPrintf("ConfirmMessage: %.*s: %.*s", static_cast<int>(title.size()), title.data(),
|
||||
|
@ -304,7 +303,7 @@ bool Host::ConfirmMessage(const std::string_view& title, const std::string_view&
|
|||
Log_ErrorPrintf("ConfirmMessage: %.*s", static_cast<int>(message.size()), message.data());
|
||||
}
|
||||
|
||||
return true;
|
||||
return g_nogui_window->ConfirmMessage(title, message);
|
||||
}
|
||||
|
||||
void Host::ReportDebuggerMessage(const std::string_view& message)
|
||||
|
|
|
@ -16,6 +16,7 @@ public:
|
|||
virtual ~NoGUIPlatform() = default;
|
||||
|
||||
virtual void ReportError(const std::string_view& title, const std::string_view& message) = 0;
|
||||
virtual bool ConfirmMessage(const std::string_view& title, const std::string_view& message) = 0;
|
||||
|
||||
virtual void SetDefaultConfig(SettingsInterface& si) = 0;
|
||||
|
||||
|
|
|
@ -43,9 +43,13 @@ bool VTYNoGUIPlatform::Initialize()
|
|||
|
||||
void VTYNoGUIPlatform::ReportError(const std::string_view& title, const std::string_view& message)
|
||||
{
|
||||
const std::string title_copy(title);
|
||||
const std::string message_copy(message);
|
||||
Log_ErrorPrintf("%s: %s", title_copy.c_str(), message_copy.c_str());
|
||||
// not implemented
|
||||
}
|
||||
|
||||
bool VTYNoGUIPlatform::ConfirmMessage(const std::string_view& title, const std::string_view& message)
|
||||
{
|
||||
// not implemented
|
||||
return true;
|
||||
}
|
||||
|
||||
void VTYNoGUIPlatform::SetDefaultConfig(SettingsInterface& si)
|
||||
|
|
|
@ -16,6 +16,7 @@ public:
|
|||
bool Initialize();
|
||||
|
||||
void ReportError(const std::string_view& title, const std::string_view& message) override;
|
||||
bool ConfirmMessage(const std::string_view& title, const std::string_view& message) override;
|
||||
|
||||
void SetDefaultConfig(SettingsInterface& si) override;
|
||||
|
||||
|
|
|
@ -78,9 +78,13 @@ bool WaylandNoGUIPlatform::Initialize()
|
|||
|
||||
void WaylandNoGUIPlatform::ReportError(const std::string_view& title, const std::string_view& message)
|
||||
{
|
||||
const std::string title_copy(title);
|
||||
const std::string message_copy(message);
|
||||
Log_ErrorPrintf("%s: %s", title_copy.c_str(), message_copy.c_str());
|
||||
// not implemented
|
||||
}
|
||||
|
||||
bool WaylandNoGUIPlatform::ConfirmMessage(const std::string_view& title, const std::string_view& message)
|
||||
{
|
||||
// not implemented
|
||||
return true;
|
||||
}
|
||||
|
||||
void WaylandNoGUIPlatform::SetDefaultConfig(SettingsInterface& si) {}
|
||||
|
|
|
@ -21,6 +21,7 @@ public:
|
|||
bool Initialize();
|
||||
|
||||
void ReportError(const std::string_view& title, const std::string_view& message) override;
|
||||
bool ConfirmMessage(const std::string_view& title, const std::string_view& message) override;
|
||||
|
||||
void SetDefaultConfig(SettingsInterface& si) override;
|
||||
|
||||
|
|
|
@ -79,6 +79,14 @@ void Win32NoGUIPlatform::ReportError(const std::string_view& title, const std::s
|
|||
MessageBoxW(m_hwnd, message_copy.c_str(), title_copy.c_str(), MB_ICONERROR | MB_OK);
|
||||
}
|
||||
|
||||
bool Win32NoGUIPlatform::ConfirmMessage(const std::string_view& title, const std::string_view& message)
|
||||
{
|
||||
const std::wstring title_copy(StringUtil::UTF8StringToWideString(title));
|
||||
const std::wstring message_copy(StringUtil::UTF8StringToWideString(message));
|
||||
|
||||
return (MessageBoxW(m_hwnd, message_copy.c_str(), title_copy.c_str(), MB_ICONQUESTION | MB_YESNO) == IDYES);
|
||||
}
|
||||
|
||||
void Win32NoGUIPlatform::SetDefaultConfig(SettingsInterface& si)
|
||||
{
|
||||
// noop
|
||||
|
|
|
@ -15,6 +15,7 @@ public:
|
|||
bool Initialize();
|
||||
|
||||
void ReportError(const std::string_view& title, const std::string_view& message) override;
|
||||
bool ConfirmMessage(const std::string_view& title, const std::string_view& message) override;
|
||||
|
||||
void SetDefaultConfig(SettingsInterface& si) override;
|
||||
|
||||
|
|
|
@ -36,9 +36,13 @@ bool X11NoGUIPlatform::Initialize()
|
|||
|
||||
void X11NoGUIPlatform::ReportError(const std::string_view& title, const std::string_view& message)
|
||||
{
|
||||
const std::string title_copy(title);
|
||||
const std::string message_copy(message);
|
||||
Log_ErrorPrintf("%s: %s", title_copy.c_str(), message_copy.c_str());
|
||||
// not implemented
|
||||
}
|
||||
|
||||
bool X11NoGUIPlatform::ConfirmMessage(const std::string_view& title, const std::string_view& message)
|
||||
{
|
||||
// not implemented
|
||||
return true;
|
||||
}
|
||||
|
||||
void X11NoGUIPlatform::SetDefaultConfig(SettingsInterface& si) {}
|
||||
|
|
|
@ -40,6 +40,7 @@ public:
|
|||
bool Initialize();
|
||||
|
||||
void ReportError(const std::string_view& title, const std::string_view& message) override;
|
||||
bool ConfirmMessage(const std::string_view& title, const std::string_view& message) override;
|
||||
|
||||
void SetDefaultConfig(SettingsInterface& si) override;
|
||||
|
||||
|
|
Loading…
Reference in a new issue