ImGuiManager: Use default icons when unspecified

This commit is contained in:
Stenzek
2026-01-05 16:31:28 +10:00
parent 6c09ba4944
commit 64d70753fc
2 changed files with 13 additions and 0 deletions

View File

@@ -8,6 +8,7 @@
#define ICON_EMOJI_WARNING "\xe2\x9a\xa0"
#define ICON_EMOJI_CHECKMARK_BUTTON "\xe2\x9c\x85"
#define ICON_EMOJI_CROSS_MARK_BUTTON "\xe2\x9d\x8c"
#define ICON_EMOJI_OPTICAL_DISK "\xf0\x9f\x92\xbf"
#define ICON_EMOJI_FLOPPY_DISK "\xf0\x9f\x92\xbe"
#define ICON_EMOJI_INFORMATION "\xe2\x84\xb9"
@@ -44,3 +45,5 @@
#define ICON_EMOJI_INDEX_DIVIDERS "\xf0\x9f\x97\x82"
#define ICON_EMOJI_CLIPBOARD "\xf0\x9f\x93\x8b"
#define ICON_EMOJI_NOTEBOOK "\xf0\x9f\x93\x99"
#define ICON_EMOJI_GEAR "\xe2\x9a\x99"
#define ICON_EMOJI_NO_ENTRY_SIGN "\xe2\x9b\x94"

View File

@@ -26,6 +26,7 @@
#include "common/thirdparty/usb_key_code_data.h"
#include "common/timer.h"
#include "IconsEmoji.h"
#include "IconsFontAwesome.h"
#include "fmt/format.h"
#include "imgui.h"
@@ -847,6 +848,15 @@ void ImGuiManager::AddOSDMessage(OSDMessageType type, std::string key, std::stri
else
INFO_LOG("OSD: {}{}{}", title.empty() ? "" : "\n", title, message);
static constexpr const std::array<const char*, static_cast<size_t>(OSDMessageType::MaxCount)> default_icons = {
ICON_EMOJI_NO_ENTRY_SIGN, // Error
ICON_EMOJI_WARNING, // Warning
ICON_EMOJI_INFORMATION, // Info
ICON_EMOJI_INFORMATION, // Quick
};
if (icon.empty())
icon = default_icons[static_cast<size_t>(type)];
std::unique_lock lock(s_state.osd_messages_lock);
s_state.osd_posted_messages.push_back(PostedOSDMessage{
.key = std::move(key),