mui: rename misc to menus, change menu options order so that menus is at the top, improve some info boxes text.

This commit is contained in:
ITotalJustice
2025-09-14 14:16:50 +01:00
parent 9cdb77bafa
commit 0706683690
4 changed files with 56 additions and 53 deletions

View File

@@ -127,7 +127,7 @@ public:
static void DisplayThemeOptions(bool left_side = true); static void DisplayThemeOptions(bool left_side = true);
// todo: // todo:
static void DisplayNetworkOptions(bool left_side = true); static void DisplayNetworkOptions(bool left_side = true);
static void DisplayMiscOptions(bool left_side = true); static void DisplayMenuOptions(bool left_side = true);
static void DisplayAdvancedOptions(bool left_side = true); static void DisplayAdvancedOptions(bool left_side = true);
static void DisplayInstallOptions(bool left_side = true); static void DisplayInstallOptions(bool left_side = true);
static void DisplayDumpOptions(bool left_side = true); static void DisplayDumpOptions(bool left_side = true);

View File

@@ -42,7 +42,7 @@ struct MiscMenuEntry {
} }
}; };
auto GetMiscMenuEntries() -> std::span<const MiscMenuEntry>; auto GetMenuMenuEntries() -> std::span<const MiscMenuEntry>;
// this holds 2 menus and allows for switching between them // this holds 2 menus and allows for switching between them
struct MainMenu final : Widget { struct MainMenu final : Widget {

View File

@@ -1873,11 +1873,11 @@ void App::DisplayNetworkOptions(bool left_side) {
} }
void App::DisplayMiscOptions(bool left_side) { void App::DisplayMenuOptions(bool left_side) {
auto options = std::make_unique<ui::Sidebar>("Misc Options"_i18n, left_side ? ui::Sidebar::Side::LEFT : ui::Sidebar::Side::RIGHT); auto options = std::make_unique<ui::Sidebar>("Menus"_i18n, left_side ? ui::Sidebar::Side::LEFT : ui::Sidebar::Side::RIGHT);
ON_SCOPE_EXIT(App::Push(std::move(options))); ON_SCOPE_EXIT(App::Push(std::move(options)));
for (auto& e : ui::menu::main::GetMiscMenuEntries()) { for (auto& e : ui::menu::main::GetMenuMenuEntries()) {
if (e.name == g_app->m_left_menu.Get()) { if (e.name == g_app->m_left_menu.Get()) {
continue; continue;
} else if (e.name == g_app->m_right_menu.Get()) { } else if (e.name == g_app->m_right_menu.Get()) {
@@ -1935,7 +1935,7 @@ void App::DisplayAdvancedOptions(bool left_side) {
std::vector<std::string> menu_names; std::vector<std::string> menu_names;
ui::SidebarEntryArray::Items menu_items; ui::SidebarEntryArray::Items menu_items;
for (auto& e : ui::menu::main::GetMiscMenuEntries()) { for (auto& e : ui::menu::main::GetMenuMenuEntries()) {
if (!e.IsShortcut()) { if (!e.IsShortcut()) {
continue; continue;
} }

View File

@@ -50,58 +50,52 @@ auto MiscMenuFuncGenerator(u32 flags) {
const MiscMenuEntry MISC_MENU_ENTRIES[] = { const MiscMenuEntry MISC_MENU_ENTRIES[] = {
{ .name = "Appstore", .title = "Appstore", .func = MiscMenuFuncGenerator<ui::menu::appstore::Menu>, .flag = MiscMenuFlag_Shortcut, .info = { .name = "Appstore", .title = "Appstore", .func = MiscMenuFuncGenerator<ui::menu::appstore::Menu>, .flag = MiscMenuFlag_Shortcut, .info =
"Download and update apps.\n\n"\ "Download and update apps.\n\n"
"Internet connection required." }, "Internet connection required." },
{ .name = "Games", .title = "Games", .func = MiscMenuFuncGenerator<ui::menu::game::Menu>, .flag = MiscMenuFlag_Shortcut, .info = { .name = "Games", .title = "Games", .func = MiscMenuFuncGenerator<ui::menu::game::Menu>, .flag = MiscMenuFlag_Shortcut, .info =
"View all installed games. "\ "View all installed games. "
"In this menu you can launch, backup, create savedata and much more." }, "In this menu you can launch, backup, create savedata and much more." },
{ .name = "FileBrowser", .title = "FileBrowser", .func = MiscMenuFuncGenerator<ui::menu::filebrowser::Menu>, .flag = MiscMenuFlag_Shortcut, .info = { .name = "FileBrowser", .title = "FileBrowser", .func = MiscMenuFuncGenerator<ui::menu::filebrowser::Menu>, .flag = MiscMenuFlag_Shortcut, .info =
"Browse files on you SD Card. "\ "Browse files on you SD Card. "
"You can move, copy, delete, extract zip, create zip, upload and much more.\n\n"\ "You can move, copy, delete, extract zip, create zip, upload and much more.\n\n"
"A connected USB/HDD can be opened by mounting it in the advanced options." }, "A connected USB/HDD can be opened by mounting it in the advanced options." },
{ .name = "Saves", .title = "Saves", .func = MiscMenuFuncGenerator<ui::menu::save::Menu>, .flag = MiscMenuFlag_Shortcut, .info = { .name = "Saves", .title = "Saves", .func = MiscMenuFuncGenerator<ui::menu::save::Menu>, .flag = MiscMenuFlag_Shortcut, .info =
"View save data for each user. "\ "View save data for each user. "
"You can backup and restore saves.\n\n"\ "You can backup and restore saves.\n\n"
"Experimental support for backing up system saves is possible." }, "Experimental support for backing up system saves is possible." },
#if 0 #if 0
{ .name = "Themezer", .title = "Themezer", .func = MiscMenuFuncGenerator<ui::menu::themezer::Menu>, .flag = MiscMenuFlag_Shortcut, .info = { .name = "Themezer", .title = "Themezer", .func = MiscMenuFuncGenerator<ui::menu::themezer::Menu>, .flag = MiscMenuFlag_Shortcut, .info =
"Download themes from themezer.net. "\ "Download themes from themezer.net. "
"Themes are downloaded to /themes/sphaira\n"\ "Themes are downloaded to /themes/sphaira\n"
"To install the themes, NXThemesInstaller needs to be installed (can be downloaded via the AppStore)." }, "To install the themes, NXThemesInstaller needs to be installed (can be downloaded via the AppStore)." },
#endif #endif
{ .name = "GitHub", .title = "GitHub", .func = MiscMenuFuncGenerator<ui::menu::gh::Menu>, .flag = MiscMenuFlag_Shortcut, .info = { .name = "GitHub", .title = "GitHub", .func = MiscMenuFuncGenerator<ui::menu::gh::Menu>, .flag = MiscMenuFlag_Shortcut, .info =
"Download releases directly from GitHub. "\ "Download releases directly from GitHub. "
"Custom entries can be added to /config/sphaira/github" }, "Custom entries can be added to /config/sphaira/github" },
#ifdef ENABLE_FTPSRV #ifdef ENABLE_FTPSRV
{ .name = "FTP", .title = "FTP Install", .func = MiscMenuFuncGenerator<ui::menu::ftp::Menu>, .flag = MiscMenuFlag_Install, .info = { .name = "FTP", .title = "FTP Install", .func = MiscMenuFuncGenerator<ui::menu::ftp::Menu>, .flag = MiscMenuFlag_Install, .info =
"Install apps via FTP.\n\n"\ "Install apps via FTP." },
"NOTE: This feature does not always work, use at your own risk. "\
"If you encounter an issue, do not open an issue, it will not be fixed." },
#endif // ENABLE_FTPSRV #endif // ENABLE_FTPSRV
#ifdef ENABLE_LIBHAZE #ifdef ENABLE_LIBHAZE
{ .name = "MTP", .title = "MTP Install", .func = MiscMenuFuncGenerator<ui::menu::mtp::Menu>, .flag = MiscMenuFlag_Install, .info = { .name = "MTP", .title = "MTP Install", .func = MiscMenuFuncGenerator<ui::menu::mtp::Menu>, .flag = MiscMenuFlag_Install, .info =
"Install apps via MTP.\n\n"\ "Install apps via MTP." },
"NOTE: This feature does not always work, use at your own risk. "\
"If you encounter an issue, do not open an issue, it will not be fixed." },
#endif // ENABLE_LIBHAZE #endif // ENABLE_LIBHAZE
{ .name = "USB", .title = "USB Install", .func = MiscMenuFuncGenerator<ui::menu::usb::Menu>, .flag = MiscMenuFlag_Install, .info = { .name = "USB", .title = "USB Install", .func = MiscMenuFuncGenerator<ui::menu::usb::Menu>, .flag = MiscMenuFlag_Install, .info =
"Install apps via USB.\n\n"\ "Install apps via USB.\n\n"
"A USB client is required on PC, such as ns-usbloader and fluffy.\n\n"\ "A USB client is required on PC." },
"NOTE: This feature does not always work, use at your own risk. "\
"If you encounter an issue, do not open an issue, it will not be fixed." },
{ .name = "GameCard", .title = "GameCard", .func = MiscMenuFuncGenerator<ui::menu::gc::Menu>, .flag = MiscMenuFlag_Shortcut, .info = { .name = "GameCard", .title = "GameCard", .func = MiscMenuFuncGenerator<ui::menu::gc::Menu>, .flag = MiscMenuFlag_Shortcut, .info =
"View info on the inserted Game Card (GC). "\ "View info on the inserted Game Card (GC). "
"You can backup and install the inserted GC. "\ "You can backup and install the inserted GC. "
"To swap GC's, simply remove the old GC and insert the new one. "\ "To swap GC's, simply remove the old GC and insert the new one. "
"You do not need to exit the menu." }, "You do not need to exit the menu." },
{ .name = "IRS", .title = "IRS (Infrared Joycon Camera)", .func = MiscMenuFuncGenerator<ui::menu::irs::Menu>, .flag = MiscMenuFlag_Shortcut, .info = { .name = "IRS", .title = "IRS (Infrared Joycon Camera)", .func = MiscMenuFuncGenerator<ui::menu::irs::Menu>, .flag = MiscMenuFlag_Shortcut, .info =
@@ -172,7 +166,7 @@ auto InstallUpdate(ProgressBox* pbox, const std::string url, const std::string v
auto CreateLeftSideMenu(std::string& name_out) -> std::unique_ptr<MenuBase> { auto CreateLeftSideMenu(std::string& name_out) -> std::unique_ptr<MenuBase> {
const auto name = App::GetApp()->m_left_menu.Get(); const auto name = App::GetApp()->m_left_menu.Get();
for (auto& e : GetMiscMenuEntries()) { for (auto& e : GetMenuMenuEntries()) {
if (e.name == name) { if (e.name == name) {
name_out = name; name_out = name;
return e.func(MenuFlag_Tab); return e.func(MenuFlag_Tab);
@@ -197,7 +191,7 @@ auto CreateRightSideMenu(std::string_view left_name) -> std::unique_ptr<MenuBase
} }
} }
for (auto& e : GetMiscMenuEntries()) { for (auto& e : GetMenuMenuEntries()) {
if (e.name == name) { if (e.name == name) {
return e.func(MenuFlag_Tab); return e.func(MenuFlag_Tab);
} }
@@ -208,7 +202,7 @@ auto CreateRightSideMenu(std::string_view left_name) -> std::unique_ptr<MenuBase
} // namespace } // namespace
auto GetMiscMenuEntries() -> std::span<const MiscMenuEntry> { auto GetMenuMenuEntries() -> std::span<const MiscMenuEntry> {
return MISC_MENU_ENTRIES; return MISC_MENU_ENTRIES;
} }
@@ -280,7 +274,7 @@ MainMenu::MainMenu() {
this->SetActions( this->SetActions(
std::make_pair(Button::START, Action{App::Exit}), std::make_pair(Button::START, Action{App::Exit}),
std::make_pair(Button::SELECT, Action{App::DisplayMiscOptions}), std::make_pair(Button::SELECT, Action{App::DisplayMenuOptions}),
std::make_pair(Button::Y, Action{"Menu"_i18n, [this](){ std::make_pair(Button::Y, Action{"Menu"_i18n, [this](){
auto options = std::make_unique<Sidebar>("Menu Options"_i18n, "v" APP_VERSION_HASH, Sidebar::Side::LEFT); auto options = std::make_unique<Sidebar>("Menu Options"_i18n, "v" APP_VERSION_HASH, Sidebar::Side::LEFT);
ON_SCOPE_EXIT(App::Push(std::move(options))); ON_SCOPE_EXIT(App::Push(std::move(options)));
@@ -302,9 +296,18 @@ MainMenu::MainMenu() {
language_items.push_back("Vietnamese"_i18n); language_items.push_back("Vietnamese"_i18n);
language_items.push_back("Ukrainian"_i18n); language_items.push_back("Ukrainian"_i18n);
options->Add<SidebarEntryCallback>("Theme"_i18n, [](){ options->Add<SidebarEntryCallback>("Menus"_i18n, [](){
App::DisplayThemeOptions(); App::DisplayMenuOptions();
}, "Customise the look of Sphaira by changing the theme"_i18n); }, "Launch one of Sphaira's menus:\n"
"- Appstore\n"
"- Saves\n"
"- GitHub\n"
"- FTP Install\n"
"- MTP Install\n"
"- USB Install\n"
"- IRS (Infrared Joycon Camera)\n"
"- Web\n\n"
"You can change the left/right menu in the Advanced Options."_i18n);
options->Add<SidebarEntryCallback>("Network"_i18n, [this](){ options->Add<SidebarEntryCallback>("Network"_i18n, [this](){
auto options = std::make_unique<Sidebar>("Network Options"_i18n, Sidebar::Side::LEFT); auto options = std::make_unique<Sidebar>("Network Options"_i18n, Sidebar::Side::LEFT);
@@ -330,47 +333,47 @@ MainMenu::MainMenu() {
}); });
} }
options->Add<SidebarEntryBool>("Ftp"_i18n, App::GetFtpEnable(), [](bool& enable){ options->Add<SidebarEntryBool>("FTP"_i18n, App::GetFtpEnable(), [](bool& enable){
App::SetFtpEnable(enable); App::SetFtpEnable(enable);
}, "Enable FTP server to run in the background.\n\n"\ }, "Enable FTP server to run in the background.\n\n"
"The default port is 5000 with no user/pass set. "\ "The default port is 5000 with no user/pass set. "
"You can change this behaviour in /config/ftpsrv/config.ini"_i18n); "You can change this behaviour in /config/ftpsrv/config.ini"_i18n);
options->Add<SidebarEntryBool>("Mtp"_i18n, App::GetMtpEnable(), [](bool& enable){ options->Add<SidebarEntryBool>("MTP"_i18n, App::GetMtpEnable(), [](bool& enable){
App::SetMtpEnable(enable); App::SetMtpEnable(enable);
}, "Enable MTP server to run in the background."_i18n); }, "Enable MTP server to run in the background."_i18n);
options->Add<SidebarEntryBool>("Nxlink"_i18n, App::GetNxlinkEnable(), [](bool& enable){ options->Add<SidebarEntryBool>("NXlink"_i18n, App::GetNxlinkEnable(), [](bool& enable){
App::SetNxlinkEnable(enable); App::SetNxlinkEnable(enable);
}, "Enable NXlink server to run in the background. "\ }, "Enable NXlink server to run in the background. "
"NXlink is used to send .nro's from PC to the switch\n\n"\ "NXlink is used to send .nro's from PC to the switch\n\n"
"If you are not a developer, you can disable this option."_i18n); "If you are not a developer, you can disable this option."_i18n);
options->Add<SidebarEntryBool>("Hdd"_i18n, App::GetHddEnable(), [](bool& enable){ options->Add<SidebarEntryBool>("HDD"_i18n, App::GetHddEnable(), [](bool& enable){
App::SetHddEnable(enable); App::SetHddEnable(enable);
}, "Enable mounting of connected USB/HDD devices. "\ }, "Enable mounting of connected USB/HDD devices. "
"Connected devices can be used in the FileBrowser, as well as a backup location when dumping games and saves."_i18n); "Connected devices can be used in the FileBrowser, as well as a backup location when dumping games and saves."_i18n);
options->Add<SidebarEntryBool>("Hdd write protect"_i18n, App::GetWriteProtect(), [](bool& enable){ options->Add<SidebarEntryBool>("HDD write protect"_i18n, App::GetWriteProtect(), [](bool& enable){
App::SetWriteProtect(enable); App::SetWriteProtect(enable);
}, "Makes the connected HDD read-only."_i18n); }, "Makes the connected HDD read-only."_i18n);
}, "Toggle FTP, MTP, HDD and NXlink\n\n" \ }, "Toggle FTP, MTP, HDD and NXlink\n\n"
"If Sphaira has a update available, you can download it from this menu"_i18n); "If Sphaira has a update available, you can download it from this menu"_i18n);
options->Add<SidebarEntryCallback>("Theme"_i18n, [](){
App::DisplayThemeOptions();
}, "Customise the look of Sphaira by changing the theme"_i18n);
options->Add<SidebarEntryArray>("Language"_i18n, language_items, [](s64& index_out){ options->Add<SidebarEntryArray>("Language"_i18n, language_items, [](s64& index_out){
App::SetLanguage(index_out); App::SetLanguage(index_out);
}, (s64)App::GetLanguage(), }, (s64)App::GetLanguage(),
"Change the language.\n\n" "Change the language.\n\n"
"If your language isn't found, or translations are missing, please consider opening a PR at "\ "If your language isn't found, or translations are missing, please consider opening a PR at "
"github.com/ITotalJustice/sphaira"_i18n); "github.com/ITotalJustice/sphaira"_i18n);
options->Add<SidebarEntryCallback>("Misc"_i18n, [](){ options->Add<SidebarEntryCallback>("Advanced Options"_i18n, [](){
App::DisplayMiscOptions();
}, "View and launch one of Sphaira's menus"_i18n);
options->Add<SidebarEntryCallback>("Advanced"_i18n, [](){
App::DisplayAdvancedOptions(); App::DisplayAdvancedOptions();
}, "Change the advanced options. "\ }, "Change the advanced options. "
"Please view the info boxes to better understand each option."_i18n); "Please view the info boxes to better understand each option."_i18n);
}} }}
)); ));