mirror of
https://github.com/stenzek/duckstation.git
synced 2026-02-04 05:04:33 +00:00
Host: Add ReportStatusMessage()
This commit is contained in:
@@ -37,6 +37,9 @@ std::optional<std::time_t> GetResourceFileTimestamp(std::string_view filename, b
|
||||
/// Displays an asynchronous error on the UI thread, i.e. doesn't block the caller.
|
||||
void ReportErrorAsync(std::string_view title, std::string_view message);
|
||||
|
||||
/// Displays a message in either the on-screen display or status bar, depending on host capabilities.
|
||||
void ReportStatusMessage(std::string_view message);
|
||||
|
||||
/// Displays an asynchronous confirmation on the UI thread, but does not block the caller.
|
||||
/// The callback may be executed on a different thread. Use RunOnCoreThread() in the callback to ensure safety.
|
||||
using ConfirmMessageAsyncCallback = std::function<void(bool)>;
|
||||
|
||||
@@ -1329,6 +1329,11 @@ void Host::ReportErrorAsync(std::string_view title, std::string_view message)
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, TinyString(title).c_str(), SmallString(message).c_str(), nullptr);
|
||||
}
|
||||
|
||||
void Host::ReportStatusMessage(std::string_view message)
|
||||
{
|
||||
Host::AddOSDMessage(OSDMessageType::Info, std::string(message));
|
||||
}
|
||||
|
||||
void Host::RequestResizeHostDisplay(s32 width, s32 height)
|
||||
{
|
||||
using namespace MiniHost;
|
||||
|
||||
@@ -2081,6 +2081,14 @@ void Host::ReportErrorAsync(std::string_view title, std::string_view message)
|
||||
message.empty() ? QString() : QString::fromUtf8(message.data(), message.size()));
|
||||
}
|
||||
|
||||
void Host::ReportStatusMessage(std::string_view message)
|
||||
{
|
||||
if (message.empty())
|
||||
return;
|
||||
|
||||
emit g_core_thread->statusMessage(QtUtils::StringViewToQString(message));
|
||||
}
|
||||
|
||||
void Host::ConfirmMessageAsync(std::string_view title, std::string_view message, ConfirmMessageAsyncCallback callback,
|
||||
std::string_view yes_text, std::string_view no_text)
|
||||
{
|
||||
|
||||
@@ -166,6 +166,11 @@ void Host::ReportErrorAsync(std::string_view title, std::string_view message)
|
||||
ERROR_LOG("ReportErrorAsync: {}", message);
|
||||
}
|
||||
|
||||
void Host::ReportStatusMessage(std::string_view message)
|
||||
{
|
||||
INFO_LOG("ReportStatusMessage: {}", message);
|
||||
}
|
||||
|
||||
void Host::ConfirmMessageAsync(std::string_view title, std::string_view message, ConfirmMessageAsyncCallback callback,
|
||||
std::string_view yes_text, std::string_view no_text)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user