From 8c7499177c7d07a47a9684e391d1988b2129fdf2 Mon Sep 17 00:00:00 2001 From: "Daniel K. O. (dkosmari)" Date: Fri, 3 Jul 2026 15:39:26 -0300 Subject: [PATCH 1/2] Fix submodules state. From 023de53a6cd42147638e751c0a258aa9b641fffe Mon Sep 17 00:00:00 2001 From: "Daniel K. O. (dkosmari)" Date: Fri, 3 Jul 2026 16:42:19 -0300 Subject: [PATCH 2/2] Adjust button sizes, and some refactoring. --- src/screens/HomeScreen.cpp | 2 +- src/screens/SettingsPopup.cpp | 701 ++++++++++++++++++--------------- src/screens/SettingsPopup.h | 4 +- src/screens/SettingsScreen.cpp | 10 +- 4 files changed, 382 insertions(+), 335 deletions(-) diff --git a/src/screens/HomeScreen.cpp b/src/screens/HomeScreen.cpp index 484d5f8..bcf0b31 100644 --- a/src/screens/HomeScreen.cpp +++ b/src/screens/HomeScreen.cpp @@ -147,7 +147,7 @@ namespace HomeScreen { } if (queueStyleMiiUPrompt) { - SettingsPopup::show(SettingsPopup::OpenState::stylemiiu); + SettingsPopup::open(SettingsPopup::OpenState::stylemiiu); queueStyleMiiUPrompt = false; } diff --git a/src/screens/SettingsPopup.cpp b/src/screens/SettingsPopup.cpp index 1981b0d..9ecb70a 100644 --- a/src/screens/SettingsPopup.cpp +++ b/src/screens/SettingsPopup.cpp @@ -10,16 +10,18 @@ #include "SettingsPopup.h" #include "../utils.h" #include "../App.h" +#include "../IconsFontAwesome4.h" #include #include -#include -#include -#include -#include #include +#include +#include +#include #include +#include +#include #include #include @@ -237,7 +239,7 @@ namespace SettingsPopup { return crc; } - void show(OpenState openState) { + void open(OpenState openState) { menu_content_path = GetMenuContentPath(); full_all_message_paths.clear(); @@ -317,441 +319,486 @@ namespace SettingsPopup { } - void process_ui() { - using namespace ImGui::RAII; - if (state == State::hidden) - return; + // Common code to show a single centered close button. + void show_centered_close_button() { + const auto &style = ImGui::GetStyle(); + const std::string close_label = ICON_FA_TIMES " Close"; + const ImVec2 close_size = ImGui::CalcTextSize(close_label) + 2 * style.FramePadding; + const ImVec2 available = ImGui::GetContentRegionAvail(); + const float start_x = (available.x + close_size.x) / 2; + if (start_x > 0) + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + start_x); + if (ImGui::Button(close_label, close_size)) { + ImGui::CloseCurrentPopup(); + state = State::hidden; + } + } - if (popup_queued) { - ImGui::OpenPopup(popup_id); - popup_queued = false; + void show_stylemiiu_error() { + using namespace ImGui::RAII; + { + Font title_font{nullptr, 35}; + ImGui::Text("StyleMiiU Not Found!"); } - auto center = ImGui::GetMainViewport()->GetCenter(); - ImGui::SetNextWindowPos(center, ImGuiCond_Always, {0.5f, 0.5f}); + ImGui::Text("The StyleMiiU aroma plugin could not be found!\n" + "\n" + "For your installed themes to work in the Wii U Menu you will need to install\n" + "this plugin from either the Homebrew App Store or at:\n" + "\n" + "github.com/Themiify-hb/StyleMiiU-Plugin/releases/latest"); - PopupModal popup{popup_id, nullptr, - ImGuiWindowFlags_NoSavedSettings | - ImGuiWindowFlags_AlwaysAutoResize | - ImGuiWindowFlags_NoMove | - ImGuiWindowFlags_NoScrollbar | - ImGuiWindowFlags_NoScrollWithMouse | - ImGuiWindowFlags_NoCollapse | - ImGuiWindowFlags_NoTitleBar}; + const auto &style = ImGui::GetStyle(); - if (!popup) { - state = State::hidden; - return; + const std::string quit_label = ICON_FA_SIGN_OUT " Quit Themiify"; + ImVec2 quit_size = ImGui::CalcTextSize(quit_label) + 2 * style.FramePadding; + + ImVec2 available = ImGui::GetContentRegionAvail(); + float start_x = (available.x - quit_size.x) / 2;; + + if (start_x > 0) + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + start_x); + + if (ImGui::Button(quit_label, quit_size)) + App::quit(); + } + + void show_integrity_confirmation() { + using namespace ImGui::RAII; + + { + Font title_font{nullptr, 35}; + ImGui::Text("Check Menu Integrity Confirmation"); } + ImGui::Text("Would you like to check the integrity of your Wii U Menu's\n" + "files on your NAND to verify whether they have been modified?\n" + "\n" + "If your files have been modified, Themiify will always fail to install themes\n" + "until you either restore clean files to your NAND, or place clean files\n" + "in sd:/themiify/cache.\n" + "\n" + "Please check the Theme Café Docs for more info."); + const auto &style = ImGui::GetStyle(); - switch (state) { - case State::stylmiiu_error: { - { - Font title_font{nullptr, 35}; - ImGui::Text("StyleMiiU Not Found!"); - } + const std::string check_label = ICON_FA_SHIELD " Check Integrity"; + ImVec2 check_size = ImGui::CalcTextSize(check_label) + 2 * style.FramePadding; - ImGui::Text("The StyleMiiU aroma plugin could not be found!\n" - "\n" - "For your installed themes to work in the Wii U Menu you will need to install\n" - "this plugin from either the Homebrew App Store or at:\n" - "\n" - "github.com/Themiify-hb/StyleMiiU-Plugin/releases/latest"); + const std::string close_label = ICON_FA_TIMES " Close"; + ImVec2 close_size = ImGui::CalcTextSize(close_label) + 2 * style.FramePadding; - ImVec2 button_size{250, 0}; + ImVec2 button_size = {std::fmax(check_size.x, close_size.x), + std::fmax(check_size.y, close_size.y)}; - float start_x = - (ImGui::GetContentRegionAvail().x - button_size.x) * 0.5f; + ImVec2 available = ImGui::GetContentRegionAvail(); - if (start_x > 0.0f) - ImGui::SetCursorPosX(ImGui::GetCursorPosX() + start_x); + float total_width = 2 * button_size.x + style.ItemSpacing.x; - if (ImGui::Button("Close Themiify", button_size)) { - App::quit(); - } + float start_x = (available.x - total_width) / 2; - break; - } - case State::integrity_confirmation: { - { - Font title_font{nullptr, 35}; - ImGui::Text("Check Menu Integrity Confirmation"); - } + if (start_x > 0) + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + start_x); - ImGui::Text("Would you like to check the integrity of your Wii U Menu's\n" - "files on your NAND to verify whether they have been modified?\n" - "\n" - "If your files have been modified, Themiify will always fail to install themes\n" - "until you either restore clean files to your NAND, or place clean files\n" - "in sd:/themiify/cache.\n" - "\n" - "Please check the Theme Café Docs for more info."); + if (ImGui::Button(check_label, button_size)) { + modified_files.clear(); - ImVec2 button_size{250, 0}; + start_worker([] { + for (const auto& entry : integrity_files) { + auto full_path = menu_content_path / entry.relative_path; - float spacing = style.ItemSpacing.x; - float total_width = button_size.x * 2.0f + spacing; + if (!exists(full_path)) + continue; - float start_x = (ImGui::GetContentRegionAvail().x - total_width) * 0.5f; + uint32_t crc = CalculateCRC32(full_path); - if (start_x > 0.0f) - ImGui::SetCursorPosX(ImGui::GetCursorPosX() + start_x); + if (crc != entry.expected_crc) { + std::scoped_lock lock{worker_mutex}; + modified_files.push_back(entry.relative_path); + } + } - if (ImGui::Button("Check Integrity", button_size)) { - modified_files.clear(); + return true; + }); - start_worker([] { - for (const auto& entry : integrity_files) { - auto full_path = menu_content_path / entry.relative_path; + state = State::checking_integrity; + } - if (!exists(full_path)) - continue; + ImGui::SameLine(); - uint32_t crc = CalculateCRC32(full_path); + if (ImGui::Button(close_label, button_size)) { + ImGui::CloseCurrentPopup(); + state = State::hidden; + } - if (crc != entry.expected_crc) { - std::scoped_lock lock{worker_mutex}; - modified_files.push_back(entry.relative_path); - } - } + } - return true; - }); + void show_checking_integrity() { + using namespace ImGui::RAII; + { + Font title_font{nullptr, 35}; + ImGui::Text("Checking..."); + } - state = State::checking_integrity; - } + ImGui::Text("Please wait. Do not turn off your Wii U."); - ImGui::SameLine(); + if (worker_done) { + worker_thread = {}; + state = worker_success + ? State::integrity_checked + : State::cache_error; + } + } - if (ImGui::Button("Close", button_size)) { - ImGui::CloseCurrentPopup(); - state = State::hidden; - } + void show_integrity_checked() { + using namespace ImGui::RAII; + { + Font title_font{nullptr, 35}; + ImGui::Text("Integrity Checked"); + } - break; + if (modified_files.empty()) { + ImGui::Text("All your menu files are clean and ready for use with Themiify!"); + } + else { + ImGui::Text("The following files appear to be modified: "); + + ImGui::Indent(); + for (auto &file : modified_files) { + ImGui::Text(file.string()); } - case State::checking_integrity: { - { - Font title_font{nullptr, 35}; - ImGui::Text("Checking..."); - } + ImGui::Unindent(); - ImGui::Text("Please wait. Do not turn off your Wii U."); + ImGui::Text("Please consult the Theme Cafe docs for steps to restore your original files."); + } - if (worker_done) { - worker_thread = {}; - state = worker_success - ? State::integrity_checked - : State::cache_error; - } + show_centered_close_button(); + } - break; - } - case State::integrity_checked: { - { - Font title_font{nullptr, 35}; - ImGui::Text("Integrity Checked"); - } + void show_dump_confirmation() { + using namespace ImGui::RAII; - if (modified_files.empty()) { - ImGui::Text("All your menu files are clean and ready for use with Themiify!"); - } - else { - ImGui::Text("The following files appear to be modified: "); + { + Font title_font{nullptr, 35}; + ImGui::Text("Dump Menu Files Confirmation"); + } - ImGui::Indent(); - for (auto &file : modified_files) { - ImGui::Text("%s", file.c_str()); - } - ImGui::Unindent(); + ImGui::Text("Would you like to dump the most common Wii U Menu files\n" + "used in theme creation to your SD Card?\n" + "\n" + "The files dumped are: Men.pack, Men2.pack & cafe_barista_men.bfsar\n" + "\n" + "Note: By installing any theme via Themiify, this will be done automatically."); - ImGui::Text("Please consult the Theme Cafe docs for steps to restore your original files."); - } + ImGui::Checkbox("Dump AllMessage.szs for all languages.\n" + "Consult the Theme Café docs for more info on these files.", + &dump_allmessage); - ImVec2 button_size{180, 0}; + const auto &style = ImGui::GetStyle(); - float start_x = - (ImGui::GetContentRegionAvail().x - button_size.x) * 0.5f; + const std::string dump_label = ICON_FA_DOWNLOAD " Dump Files"; + ImVec2 dump_size = ImGui::CalcTextSize(dump_label) + 2 * style.FramePadding; - if (start_x > 0.0f) - ImGui::SetCursorPosX(ImGui::GetCursorPosX() + start_x); + const std::string close_label = ICON_FA_TIMES " Close"; + ImVec2 close_size = ImGui::CalcTextSize(close_label) + 2 * style.FramePadding; - if (ImGui::Button("Close", button_size)) { - ImGui::CloseCurrentPopup(); - state = State::hidden; - } + ImVec2 button_size = {std::fmax(dump_size.x, close_size.x), + std::fmax(dump_size.y, close_size.y)}; - break; - } - case State::dump_confirmation: { - { - Font title_font{nullptr, 35}; - ImGui::Text("Dump Menu Files Confirmation"); - } + float total_width = 2 * button_size.x + style.ItemSpacing.x; - ImGui::Text("Would you like to dump the most common Wii U Menu files\n" - "used in theme creation to your SD Card?\n" - "\n" - "The files dumped are: Men.pack, Men2.pack & cafe_barista_men.bfsar\n" - "\n" - "Note: By installing any theme via Themiify, this will be done automatically."); + ImVec2 available = ImGui::GetContentRegionAvail(); - ImGui::Checkbox("Dump AllMessage.szs for all languages.\n" - "Consult the Theme Café docs for more info on these files.", - &dump_allmessage); + float start_x = (available.x - total_width) / 2; - ImVec2 button_size{210, 0}; + if (start_x > 0) + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + start_x); - float spacing = style.ItemSpacing.x; - float total_width = button_size.x * 2.0f + spacing; + if (ImGui::Button(dump_label, button_size)) { + start_worker([] { + bool dump_success = true; - float start_x = (ImGui::GetContentRegionAvail().x - total_width) * 0.5f; + auto dump_one = [](const std::filesystem::path& src, + const std::filesystem::path& dst) { + std::ifstream file(src, std::ios::binary | std::ios::ate); + CreateParentDirectories(dst); + CreateCacheFile(file, dst); + return exists(dst) && file_size(dst) > 0; + }; - if (start_x > 0.0f) - ImGui::SetCursorPosX(ImGui::GetCursorPosX() + start_x); + dump_success &= dump_one( + menu_content_path / MEN_PATH, + THEMIIFY_ROOT / "cache" / MEN_PATH + ); - if (ImGui::Button("Dump Files", button_size)) { - start_worker([] { - bool dump_success = true; + dump_success &= dump_one( + menu_content_path / MEN2_PATH, + THEMIIFY_ROOT / "cache" / MEN2_PATH + ); - auto dump_one = [](const std::filesystem::path& src, - const std::filesystem::path& dst) { - std::ifstream file(src, std::ios::binary | std::ios::ate); - CreateParentDirectories(dst); - CreateCacheFile(file, dst); - return exists(dst) && file_size(dst) > 0; - }; + dump_success &= dump_one( + menu_content_path / CAFE_BARISTA_MEN_PATH, + THEMIIFY_ROOT / "cache" / CAFE_BARISTA_MEN_PATH + ); + if (dump_allmessage) { + for (size_t i = 0; i < full_all_message_paths.size(); ++i) { dump_success &= dump_one( - menu_content_path / MEN_PATH, - THEMIIFY_ROOT / "cache" / MEN_PATH + full_all_message_paths.at(i), + cache_all_message_paths.at(i) ); + } + } - dump_success &= dump_one( - menu_content_path / MEN2_PATH, - THEMIIFY_ROOT / "cache" / MEN2_PATH - ); + return dump_success; + }); - dump_success &= dump_one( - menu_content_path / CAFE_BARISTA_MEN_PATH, - THEMIIFY_ROOT / "cache" / CAFE_BARISTA_MEN_PATH - ); + state = State::dumping; + } - if (dump_allmessage) { - for (size_t i = 0; i < full_all_message_paths.size(); ++i) { - dump_success &= dump_one( - full_all_message_paths.at(i), - cache_all_message_paths.at(i) - ); - } - } + ImGui::SameLine(); - return dump_success; - }); + if (ImGui::Button(close_label, button_size)) { + ImGui::CloseCurrentPopup(); + state = State::hidden; + } + } - state = State::dumping; - } + void show_dumping() { + using namespace ImGui::RAII; + Font title_font{nullptr, 35}; + ImGui::Text("Dumping..."); - ImGui::SameLine(); + ImGui::Text("Please wait. Do not turn off your Wii U."); - if (ImGui::Button("Close", button_size)) { - ImGui::CloseCurrentPopup(); - state = State::hidden; - } + if (worker_done) { + worker_thread = {}; + state = worker_success + ? State::dump_completed + : State::dump_error; + } + } - break; - } - case State::dumping: { - Font title_font{nullptr, 35}; - ImGui::Text("Dumping..."); + void show_dump_completed() { + using namespace ImGui::RAII; + { + Font title_font{nullptr, 35}; + ImGui::Text("Dump Completed"); + } - ImGui::Text("Please wait. Do not turn off your Wii U."); + ImGui::Text("The dump has been sucessfully completed\n" + "\n" + "You can find your dumped files at:\n" + "sd:/themiify/cache"); - if (worker_done) { - worker_thread = {}; - state = worker_success - ? State::dump_completed - : State::dump_error; - } + show_centered_close_button(); + } - break; - } - case State::dump_completed: { - { - Font title_font{nullptr, 35}; - ImGui::Text("Dump Completed"); - } + void show_dump_error() { + using namespace ImGui::RAII; - ImGui::Text("The dump has been sucessfully completed\n" - "\n" - "You can find your dumped files at:\n" - "sd:/themiify/cache"); + { + Font title_font{nullptr, 35}; + ImGui::Text("Dump Error"); + } - ImVec2 button_size{180, 0}; + ImGui::Text("One or more files failed to dump correctly."); - float start_x = - (ImGui::GetContentRegionAvail().x - button_size.x) * 0.5f; + show_centered_close_button(); + } - if (start_x > 0) - ImGui::SetCursorPosX(ImGui::GetCursorPosX() + start_x); + void show_cache_confirmation() { + using namespace ImGui::RAII; - if (ImGui::Button("Close", button_size)) { - ImGui::CloseCurrentPopup(); - state = State::hidden; - } + { + Font title_font{nullptr, 35}; + ImGui::Text("Clear Cache Confirmation"); + } - break; - } - case State::dump_error: { - { - Font title_font{nullptr, 35}; - ImGui::Text("Dump Error"); - } + ImGui::Text("Would you like to delete your Themiify cache located at:\n" + "sd:/themiify/cache ?\n" + "\n" + "Doing so will delete all dumped Wii U Menu files"); + + ImGui::Checkbox("Delete theme thumbnails as well?", &delete_thumbnails); + + const auto &style = ImGui::GetStyle(); + + const std::string clear_label = ICON_FA_TRASH " Clear Cache"; + ImVec2 clear_size = ImGui::CalcTextSize(clear_label) + 2 * style.FramePadding; - ImGui::Text("One or more files failed to dump correctly."); + const std::string close_label = ICON_FA_TIMES " Close"; + ImVec2 close_size = ImGui::CalcTextSize(close_label) + 2 * style.FramePadding; - ImVec2 button_size{180, 0}; + ImVec2 button_size = {std::fmax(clear_size.x, close_size.x), + std::fmax(clear_size.y, close_size.y)}; - float start_x = - (ImGui::GetContentRegionAvail().x - button_size.x) * 0.5f; + float total_width = 2 * button_size.x + style.ItemSpacing.x; - if (start_x > 0.0f) - ImGui::SetCursorPosX(ImGui::GetCursorPosX() + start_x); + ImVec2 available = ImGui::GetContentRegionAvail(); - if (ImGui::Button("Close", button_size)) { - ImGui::CloseCurrentPopup(); - state = State::hidden; + float start_x = (available.x - total_width) / 2; + + if (start_x > 0) + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + start_x); + + if (ImGui::Button(clear_label, button_size)) { + start_worker([] { + if (delete_thumbnails) + DeletePath(THEMIIFY_THUMBNAILS); + + DeletePath(THEMIIFY_ROOT / "cache/Common"); + + for (const auto& path : all_message_szs_locations) { + DeletePath(THEMIIFY_ROOT / "cache" / path); } - break; - } - case State::cache_confirmation: { - { - Font title_font{nullptr, 35}; - ImGui::Text("Clear Cache Confirmation"); + if (delete_thumbnails && exists(THEMIIFY_THUMBNAILS)) + return false; + + if (exists(THEMIIFY_ROOT / "cache/Common")) + return false; + + for (const auto& path : all_message_szs_locations) { + if (exists(THEMIIFY_ROOT / "cache" / path)) + return false; } - ImGui::Text("Would you like to delete your Themiify cache located at:\n" - "sd:/themiify/cache ?\n" - "\n" - "Doing so will delete all dumped Wii U Menu files"); + return true; + }); - ImGui::Checkbox("Delete theme thumbnails as well?", &delete_thumbnails); + state = State::clearing_cache; + } - ImVec2 button_size{210, 0}; + ImGui::SameLine(); - float spacing = style.ItemSpacing.x; - float total_width = button_size.x * 2.0f + spacing; + if (ImGui::Button(close_label, button_size)) { + ImGui::CloseCurrentPopup(); + state = State::hidden; + } + } - float start_x = (ImGui::GetContentRegionAvail().x - total_width) * 0.5f; + void show_clearing_cache() { + using namespace ImGui::RAII; + { + Font title_font{nullptr, 35}; + ImGui::Text("Clearing Cache..."); + } - if (start_x > 0) - ImGui::SetCursorPosX(ImGui::GetCursorPosX() + start_x); + ImGui::Text("Please wait."); - if (ImGui::Button("Clear Cache", button_size)) { - start_worker([] { - if (delete_thumbnails) - DeletePath(THEMIIFY_THUMBNAILS); + if (worker_done) { + worker_thread = {}; + state = worker_success + ? State::cache_cleared + : State::cache_error; + } + } - DeletePath(THEMIIFY_ROOT / "cache/Common"); + void show_cache_cleared() { + using namespace ImGui::RAII; + { + Font title_font{nullptr, 35}; + ImGui::Text("Cache Cleared"); + } - for (const auto& path : all_message_szs_locations) { - DeletePath(THEMIIFY_ROOT / "cache" / path); - } + ImGui::Text("The Themiify cache has been succesfully cleared."); - if (delete_thumbnails && exists(THEMIIFY_THUMBNAILS)) - return false; + show_centered_close_button(); + } - if (exists(THEMIIFY_ROOT / "cache/Common")) - return false; + void show_cache_error() + { + using namespace ImGui::RAII; - for (const auto& path : all_message_szs_locations) { - if (exists(THEMIIFY_ROOT / "cache" / path)) - return false; - } + { + Font title_font{nullptr, 35}; + ImGui::Text("Error Clearing Cache"); + } - return true; - }); + ImGui::Text("One or more files could not be removed from the cache"); - state = State::clearing_cache; - } + show_centered_close_button(); + } - ImGui::SameLine(); + void process_ui() { + using namespace ImGui::RAII; + if (state == State::hidden) + return; - if (ImGui::Button("Close", button_size)) { - ImGui::CloseCurrentPopup(); - state = State::hidden; - } + if (popup_queued) { + ImGui::OpenPopup(popup_id); + popup_queued = false; + } - break; - } - case State::clearing_cache: { - { - Font title_font{nullptr, 35}; - ImGui::Text("Clearing Cache..."); - } + auto center = ImGui::GetMainViewport()->GetCenter(); + ImGui::SetNextWindowPos(center, ImGuiCond_Always, {0.5f, 0.5f}); - ImGui::Text("Please wait."); + PopupModal popup{popup_id, nullptr, + ImGuiWindowFlags_NoSavedSettings | + ImGuiWindowFlags_AlwaysAutoResize | + ImGuiWindowFlags_NoMove | + ImGuiWindowFlags_NoScrollbar | + ImGuiWindowFlags_NoScrollWithMouse | + ImGuiWindowFlags_NoCollapse | + ImGuiWindowFlags_NoTitleBar}; - if (worker_done) { - worker_thread = {}; - state = worker_success - ? State::cache_cleared - : State::cache_error; - } + if (!popup) { + state = State::hidden; + return; + } + switch (state) { + case State::stylmiiu_error: + show_stylemiiu_error(); break; - } - case State::cache_cleared: { - { - Font title_font{nullptr, 35}; - ImGui::Text("Cache Cleared"); - } - - ImGui::Text("The Themiify cache has been succesfully cleared."); - ImVec2 button_size{180, 0}; + case State::integrity_confirmation: + show_integrity_confirmation(); + break; - float start_x = - (ImGui::GetContentRegionAvail().x - button_size.x) * 0.5f; + case State::checking_integrity: + show_checking_integrity(); + break; - if (start_x > 0.0f) - ImGui::SetCursorPosX(ImGui::GetCursorPosX() + start_x); + case State::integrity_checked: + show_integrity_checked(); + break; - if (ImGui::Button("Close", button_size)) { - ImGui::CloseCurrentPopup(); - state = State::hidden; - } + case State::dump_confirmation: + show_dump_confirmation(); + break; + case State::dumping: + show_dumping(); break; - } - case State::cache_error: { - { - Font title_font{nullptr, 35}; - ImGui::Text("Error Clearing Cache"); - } - ImGui::Text("One or more files could not be removed from the cache"); + case State::dump_completed: + show_dump_completed(); + break; - ImVec2 button_size{180, 0}; + case State::dump_error: + show_dump_error(); + break; - float start_x = - (ImGui::GetContentRegionAvail().x - button_size.x) * 0.5f; + case State::cache_confirmation: + show_cache_confirmation(); + break; - if (start_x > 0.0f) - ImGui::SetCursorPosX(ImGui::GetCursorPosX() + start_x); + case State::clearing_cache: + show_clearing_cache(); + break; - if (ImGui::Button("Close", button_size)) { - ImGui::CloseCurrentPopup(); - state = State::hidden; - } + case State::cache_cleared: + show_cache_cleared(); + break; + case State::cache_error: + show_cache_error(); break; - } + default: - break; + ; } } } diff --git a/src/screens/SettingsPopup.h b/src/screens/SettingsPopup.h index 66f3412..113657a 100644 --- a/src/screens/SettingsPopup.h +++ b/src/screens/SettingsPopup.h @@ -1,6 +1,6 @@ /* * Themiify - A theme manager for the Nintendo Wii U - * Copyright (C) 2026 Fangal-Airbag + * Copyright (C) 2026 Fangal-Airbag * Copyright (C) 2026 AlphaCraft9658 * Copyright (C) 2026 Daniel K. O. * @@ -18,7 +18,7 @@ namespace SettingsPopup { cache, }; - void show(OpenState openState); + void open(OpenState openState); void process_ui(); } diff --git a/src/screens/SettingsScreen.cpp b/src/screens/SettingsScreen.cpp index a999559..5aaafc4 100644 --- a/src/screens/SettingsScreen.cpp +++ b/src/screens/SettingsScreen.cpp @@ -88,7 +88,7 @@ namespace SettingsScreen { if (!isFirstBoot) return; - SettingsPopup::show(SettingsPopup::OpenState::force_integrity); + SettingsPopup::open(SettingsPopup::OpenState::force_integrity); settings.is_first_boot = false; save_settings(); @@ -100,7 +100,7 @@ namespace SettingsScreen { if (!bootIntegrityCheckPending) return; - SettingsPopup::show(SettingsPopup::OpenState::force_integrity); + SettingsPopup::open(SettingsPopup::OpenState::force_integrity); bootIntegrityCheckPending = false; } @@ -155,7 +155,7 @@ namespace SettingsScreen { ImGui::Spacing(); if (ImGui::Button("Check integrity of Wii U Menu files")) { - SettingsPopup::show(SettingsPopup::OpenState::integrity); + SettingsPopup::open(SettingsPopup::OpenState::integrity); } ImGui::SameLine(); @@ -168,13 +168,13 @@ namespace SettingsScreen { ImGui::Spacing(); if (ImGui::Button("Dump Wii U Menu files")) { - SettingsPopup::show(SettingsPopup::OpenState::dump); + SettingsPopup::open(SettingsPopup::OpenState::dump); } ImGui::Spacing(); if (ImGui::Button("Clear Themiify cache")) { - SettingsPopup::show(SettingsPopup::OpenState::cache); + SettingsPopup::open(SettingsPopup::OpenState::cache); }