From 43543ddedc122a2f4b260f5e47ec92106dbb6368 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 13 Jul 2025 16:54:54 +1000 Subject: [PATCH] FullscreenUI: Improve icons in file selector --- dep/imgui/include/IconsEmoji.h | 6 +++++- src/core/fullscreen_ui.cpp | 4 ++-- src/core/system.cpp | 2 +- src/util/imgui_fullscreen.cpp | 16 ++++++++++------ 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/dep/imgui/include/IconsEmoji.h b/dep/imgui/include/IconsEmoji.h index 480bae42c..1e1e77973 100644 --- a/dep/imgui/include/IconsEmoji.h +++ b/dep/imgui/include/IconsEmoji.h @@ -23,7 +23,9 @@ #define ICON_EMOJI_MEDIUM_VOLUME_SPEAKER "\xf0\x9f\x94\x89" #define ICON_EMOJI_HIGH_VOLUME_SPEAKER "\xf0\x9f\x94\x8a" #define ICON_EMOJI_FILE_FOLDER "\xf0\x9f\x93\x81" -#define ICON_EMOJI_OPEN_THE_FOLDER "\xf0\x9f\x93\x82" +#define ICON_EMOJI_FILE_FOLDER_OPEN "\xf0\x9f\x93\x82" +#define ICON_EMOJI_PAGE_WITH_CURL "\xf0\x9f\x93\x83" +#define ICON_EMOJI_PAGE_FACING_UP "\xf0\x9f\x93\x84" #define ICON_EMOJI_MAGNIFIYING_GLASS_TILTED_LEFT "\xf0\x9f\x94\x8d" #define ICON_EMOJI_LOCKED "\xf0\x9f\x94\x92" #define ICON_EMOJI_UNLOCKED "\xf0\x9f\x94\x93" @@ -37,3 +39,5 @@ #define ICON_EMOJI_STAR "\xe2\xad\x90" #define ICON_EMOJI_RULER "\xf0\x9f\x93\x8f" #define ICON_EMOJI_CLOCK_FIVE_OCLOCK "\xf0\x9f\x95\x94" +#define ICON_EMOJI_DESKTOP_COMPUTER "\xf0\x9f\x96\xa5" +#define ICON_EMOJI_INDEX_DIVIDERS "\xf0\x9f\x97\x82" diff --git a/src/core/fullscreen_ui.cpp b/src/core/fullscreen_ui.cpp index 4557b9500..8209d6bc5 100644 --- a/src/core/fullscreen_ui.cpp +++ b/src/core/fullscreen_ui.cpp @@ -1546,7 +1546,7 @@ void FullscreenUI::DoStartFile() DoStartPath(path); }; - OpenFileSelector(FSUI_ICONVSTR(ICON_FA_COMPACT_DISC, "Select Disc Image"), false, std::move(callback), + OpenFileSelector(FSUI_ICONVSTR(ICON_EMOJI_OPTICAL_DISK, "Select Disc Image"), false, std::move(callback), GetDiscImageFilters()); } @@ -8305,7 +8305,7 @@ void FullscreenUI::DrawGameList(const ImVec2& heading_size) if (selected_entry->file_size >= 0) { ImGui::PushFont(UIStyle.Font, UIStyle.MediumFontSize, UIStyle.BoldFontWeight); - ImGuiFullscreen::TextUnformatted(FSUI_ICONSTR(ICON_EMOJI_OPEN_THE_FOLDER, FSUI_VSTR("Size: "))); + ImGuiFullscreen::TextUnformatted(FSUI_ICONSTR(ICON_EMOJI_FILE_FOLDER_OPEN, FSUI_VSTR("Size: "))); ImGui::PopFont(); ImGui::SameLine(); ImGui::PushStyleColor(ImGuiCol_Text, subtitle_text_color); diff --git a/src/core/system.cpp b/src/core/system.cpp index cbd20ee42..881c72880 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -2875,7 +2875,7 @@ bool System::LoadState(const char* path, Error* error, bool save_undo_state, boo INFO_LOG("Loading state from '{}'...", path); Host::AddIconOSDMessage( - "LoadState", ICON_EMOJI_OPEN_THE_FOLDER, + "LoadState", ICON_EMOJI_FILE_FOLDER_OPEN, fmt::format(TRANSLATE_FS("OSDMessage", "Loading state from '{}'..."), Path::GetFileName(path)), Host::OSD_QUICK_DURATION); diff --git a/src/util/imgui_fullscreen.cpp b/src/util/imgui_fullscreen.cpp index 1c3a32030..2e812ed7f 100644 --- a/src/util/imgui_fullscreen.cpp +++ b/src/util/imgui_fullscreen.cpp @@ -25,6 +25,7 @@ #include "fmt/core.h" #include "IconsFontAwesome6.h" +#include "IconsEmoji.h" #include "imgui_internal.h" #include "imgui_stdlib.h" @@ -168,6 +169,7 @@ private: bool m_is_directory = false; bool m_directory_changed = false; + bool m_first_item_is_parent_directory = false; }; class InputStringDialog : public PopupDialog @@ -2949,11 +2951,12 @@ ImGuiFullscreen::FileSelectorDialog::Item::Item(std::string display_name_, std:: void ImGuiFullscreen::FileSelectorDialog::PopulateItems() { m_items.clear(); + m_first_item_is_parent_directory = false; if (m_current_directory.empty()) { for (std::string& root_path : FileSystem::GetRootDirectoryList()) - m_items.emplace_back(fmt::format(ICON_FA_FOLDER " {}", root_path), std::move(root_path), false); + m_items.emplace_back(fmt::format(ICON_EMOJI_FILE_FOLDER " {}", root_path), std::move(root_path), false); } else { @@ -2968,7 +2971,8 @@ void ImGuiFullscreen::FileSelectorDialog::PopulateItems() if (sep_pos != std::string::npos) parent_path = Path::Canonicalize(m_current_directory.substr(0, sep_pos)); - m_items.emplace_back(ICON_FA_FOLDER_OPEN " ", std::move(parent_path), false); + m_items.emplace_back(ICON_EMOJI_FILE_FOLDER_OPEN " ", std::move(parent_path), false); + m_first_item_is_parent_directory = true; for (const FILESYSTEM_FIND_DATA& fd : results) { @@ -2976,7 +2980,7 @@ void ImGuiFullscreen::FileSelectorDialog::PopulateItems() if (fd.Attributes & FILESYSTEM_FILE_ATTRIBUTE_DIRECTORY) { - std::string title = fmt::format(ICON_FA_FOLDER " {}", fd.FileName); + std::string title = fmt::format(ICON_EMOJI_FILE_FOLDER " {}", fd.FileName); m_items.emplace_back(std::move(title), std::move(full_path), false); } else @@ -2988,7 +2992,7 @@ void ImGuiFullscreen::FileSelectorDialog::PopulateItems() continue; } - std::string title = fmt::format(ICON_FA_FILE " {}", fd.FileName); + std::string title = fmt::format(ICON_EMOJI_PAGE_FACING_UP " {}", fd.FileName); m_items.emplace_back(std::move(title), std::move(full_path), true); } } @@ -3037,7 +3041,7 @@ void ImGuiFullscreen::FileSelectorDialog::Draw() if (m_is_directory && !m_current_directory.empty()) { - if (MenuButtonWithoutSummary(ICON_FA_FOLDER_PLUS " ")) + if (MenuButtonWithoutSummary(ICON_EMOJI_FILE_FOLDER_OPEN " ")) directory_selected = true; } @@ -3078,7 +3082,7 @@ void ImGuiFullscreen::FileSelectorDialog::Draw() { if (ImGui::IsKeyPressed(ImGuiKey_Backspace, false) || ImGui::IsKeyPressed(ImGuiKey_NavGamepadMenu, false)) { - if (!m_items.empty() && m_items.front().display_name == ICON_FA_FOLDER_OPEN " ") + if (!m_items.empty() && m_first_item_is_parent_directory) SetDirectory(std::move(m_items.front().full_path)); } }