finish theme code in options page

This commit is contained in:
mrdude2478 2023-10-04 08:42:30 +01:00
parent 7043124a0a
commit ee053e32d8

View File

@ -19,7 +19,6 @@ namespace inst::ui {
extern MainApplication* mainApp; extern MainApplication* mainApp;
s32 prev_touchcount = 0; s32 prev_touchcount = 0;
std::string flag = "romfs:/images/flags/en.png"; std::string flag = "romfs:/images/flags/en.png";
std::vector<std::string> languageStrings = { "Sys", "En", "Jpn", "Fr", "De", "It", "Ru", "Es", "Tw" }; std::vector<std::string> languageStrings = { "Sys", "En", "Jpn", "Fr", "De", "It", "Ru", "Es", "Tw" };
optionsPage::optionsPage() : Layout::Layout() { optionsPage::optionsPage() : Layout::Layout() {
@ -90,7 +89,13 @@ namespace inst::ui {
} }
void optionsPage::askToUpdate(std::vector<std::string> updateInfo) { void optionsPage::askToUpdate(std::vector<std::string> updateInfo) {
if (!mainApp->CreateShowDialog("options.update.title"_lang, "options.update.desc0"_lang + updateInfo[0] + "options.update.desc1"_lang, { "options.update.opt0"_lang, "common.cancel"_lang }, false, "romfs:/images/icons/update.png")) {
std::string update = "romfs:/images/icons/update.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.update"_theme)) {
update = inst::config::appDir + "icons_others.update"_theme;
}
if (!mainApp->CreateShowDialog("options.update.title"_lang, "options.update.desc0"_lang + updateInfo[0] + "options.update.desc1"_lang, { "options.update.opt0"_lang, "common.cancel"_lang }, false, update)) {
inst::ui::instPage::loadInstallScreen(); inst::ui::instPage::loadInstallScreen();
inst::ui::instPage::setTopInstInfoText("options.update.top_info"_lang + updateInfo[0]); inst::ui::instPage::setTopInstInfoText("options.update.top_info"_lang + updateInfo[0]);
inst::ui::instPage::setInstBarPerc(0); inst::ui::instPage::setInstBarPerc(0);
@ -102,10 +107,14 @@ namespace inst::ui {
inst::ui::instPage::setInstInfoText("options.update.bot_info2"_lang + updateInfo[0]); inst::ui::instPage::setInstInfoText("options.update.bot_info2"_lang + updateInfo[0]);
inst::zip::extractFile(downloadName, "sdmc:/"); inst::zip::extractFile(downloadName, "sdmc:/");
std::filesystem::remove(downloadName); std::filesystem::remove(downloadName);
mainApp->CreateShowDialog("options.update.complete"_lang, "options.update.end_desc"_lang, { "common.ok"_lang }, false, "romfs:/images/icons/update.png"); mainApp->CreateShowDialog("options.update.complete"_lang, "options.update.end_desc"_lang, { "common.ok"_lang }, false, update);
} }
catch (...) { catch (...) {
mainApp->CreateShowDialog("options.update.failed"_lang, "options.update.end_desc"_lang, { "common.ok"_lang }, false, "romfs:/images/icons/fail.png"); std::string fail = "romfs:/images/icons/fail.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.fail"_theme)) {
fail = inst::config::appDir + "icons_others.fail"_theme;
}
mainApp->CreateShowDialog("options.update.failed"_lang, "options.update.end_desc"_lang, { "common.ok"_lang }, false, fail);
} }
mainApp->FadeOut(); mainApp->FadeOut();
mainApp->Close(); mainApp->Close();
@ -114,25 +123,71 @@ namespace inst::ui {
} }
std::string optionsPage::getMenuOptionIcon(bool ourBool) { std::string optionsPage::getMenuOptionIcon(bool ourBool) {
if (ourBool) return "romfs:/images/icons/checked.png"; std::string checked = "romfs:/images/icons/checked.png";
else return "romfs:/images/icons/unchecked.png"; if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_settings.check_on"_theme)) {
checked = inst::config::appDir + "icons_settings.check_on"_theme;
}
std::string unchecked = "romfs:/images/icons/unchecked.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_settings.check_off"_theme)) {
unchecked = inst::config::appDir + "icons_settings.check_off"_theme;
}
if (ourBool) return checked;
else return unchecked;
} }
std::string optionsPage::getMenuLanguage(int ourLangCode) { std::string optionsPage::getMenuLanguage(int ourLangCode) {
std::string sys = "romfs:/images/flags/sys.png";
std::string en = "romfs:/images/flags/en.png";
std::string jpn = "romfs:/images/flags/jpn.png";
std::string fr = "romfs:/images/flags/fr.png";
std::string de = "romfs:/images/flags/de.png";
std::string it = "romfs:/images/flags/it.png";
std::string ru = "romfs:/images/flags/ru.png";
std::string es = "romfs:/images/flags/es.png";
std::string tw = "romfs:/images/flags/tw.png";
//
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_flags.sys"_theme)) {
sys = inst::config::appDir + "icons_flags.sys"_theme;
}
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_flags.en"_theme)) {
en = inst::config::appDir + "icons_flags.en"_theme;
}
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_flags.jpn"_theme)) {
jpn = inst::config::appDir + "icons_flags.jpn"_theme;
}
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_flags.fr"_theme)) {
fr = inst::config::appDir + "icons_flags.fr"_theme;
}
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_flags.de"_theme)) {
de = inst::config::appDir + "icons_flags.de"_theme;
}
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_flags.it"_theme)) {
it = inst::config::appDir + "icons_flags.it"_theme;
}
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_flags.ru"_theme)) {
ru = inst::config::appDir + "icons_flags.ru"_theme;
}
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_flags.es"_theme)) {
es = inst::config::appDir + "icons_flags.es"_theme;
}
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_flags.tw"_theme)) {
tw = inst::config::appDir + "icons_flags.tw"_theme;
}
//
if (ourLangCode >= 0) { if (ourLangCode >= 0) {
if (ourLangCode == 0) flag = "romfs:/images/flags/sys.png"; if (ourLangCode == 0) flag = sys;
else if (ourLangCode == 1) flag = "romfs:/images/flags/en.png"; else if (ourLangCode == 1) flag = en;
else if (ourLangCode == 2) flag = "romfs:/images/flags/jpn.png"; else if (ourLangCode == 2) flag = jpn;
else if (ourLangCode == 3) flag = "romfs:/images/flags/fr.png"; else if (ourLangCode == 3) flag = fr;
else if (ourLangCode == 4) flag = "romfs:/images/flags/de.png"; else if (ourLangCode == 4) flag = de;
else if (ourLangCode == 5) flag = "romfs:/images/flags/it.png"; else if (ourLangCode == 5) flag = it;
else if (ourLangCode == 6) flag = "romfs:/images/flags/ru.png"; else if (ourLangCode == 6) flag = ru;
else if (ourLangCode == 7) flag = "romfs:/images/flags/es.png"; else if (ourLangCode == 7) flag = es;
else if (ourLangCode == 8) flag = "romfs:/images/flags/tw.png"; else if (ourLangCode == 8) flag = tw;
return languageStrings[ourLangCode]; return languageStrings[ourLangCode];
} }
else { else {
flag = "romfs:/images/flags/en.png"; flag = en;
return languageStrings[0]; return languageStrings[0];
} }
} }
@ -142,7 +197,11 @@ namespace inst::ui {
} }
void thememessage() { void thememessage() {
int ourResult = inst::ui::mainApp->CreateShowDialog("theme.title"_lang, "theme.desc"_lang, { "common.no"_lang, "common.yes"_lang }, true, "romfs:/images/icons/theme.png"); std::string theme = "romfs:/images/icons/theme.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.theme"_theme)) {
theme = inst::config::appDir + "icons_others.theme"_theme;
}
int ourResult = inst::ui::mainApp->CreateShowDialog("theme.title"_lang, "theme.desc"_lang, { "common.no"_lang, "common.yes"_lang }, true, theme);
if (ourResult != 0) { if (ourResult != 0) {
if (!inst::config::useTheme) { if (!inst::config::useTheme) {
inst::config::useTheme = true; inst::config::useTheme = true;
@ -160,101 +219,153 @@ namespace inst::ui {
} }
void optionsPage::setMenuText() { void optionsPage::setMenuText() {
std::string text_colour = "colour.main_text"_theme;
this->menu->ClearItems(); this->menu->ClearItems();
auto ignoreFirmOption = pu::ui::elm::MenuItem::New("options.menu_items.ignore_firm"_lang); auto ignoreFirmOption = pu::ui::elm::MenuItem::New("options.menu_items.ignore_firm"_lang);
ignoreFirmOption->SetColor(COLOR("#FFFFFFFF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) ignoreFirmOption->SetColor(COLOR(text_colour));
else ignoreFirmOption->SetColor(COLOR("#FFFFFFFF"));
ignoreFirmOption->SetIcon(this->getMenuOptionIcon(inst::config::ignoreReqVers)); ignoreFirmOption->SetIcon(this->getMenuOptionIcon(inst::config::ignoreReqVers));
this->menu->AddItem(ignoreFirmOption); this->menu->AddItem(ignoreFirmOption);
auto validateOption = pu::ui::elm::MenuItem::New("options.menu_items.nca_verify"_lang); auto validateOption = pu::ui::elm::MenuItem::New("options.menu_items.nca_verify"_lang);
validateOption->SetColor(COLOR("#FFFFFFFF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) validateOption->SetColor(COLOR(text_colour));
else validateOption->SetColor(COLOR("#FFFFFFFF"));
validateOption->SetIcon(this->getMenuOptionIcon(inst::config::validateNCAs)); validateOption->SetIcon(this->getMenuOptionIcon(inst::config::validateNCAs));
this->menu->AddItem(validateOption); this->menu->AddItem(validateOption);
auto overclockOption = pu::ui::elm::MenuItem::New("options.menu_items.boost_mode"_lang); auto overclockOption = pu::ui::elm::MenuItem::New("options.menu_items.boost_mode"_lang);
overclockOption->SetColor(COLOR("#FFFFFFFF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) overclockOption->SetColor(COLOR(text_colour));
else overclockOption->SetColor(COLOR("#FFFFFFFF"));
overclockOption->SetIcon(this->getMenuOptionIcon(inst::config::overClock)); overclockOption->SetIcon(this->getMenuOptionIcon(inst::config::overClock));
this->menu->AddItem(overclockOption); this->menu->AddItem(overclockOption);
auto deletePromptOption = pu::ui::elm::MenuItem::New("options.menu_items.ask_delete"_lang); auto deletePromptOption = pu::ui::elm::MenuItem::New("options.menu_items.ask_delete"_lang);
deletePromptOption->SetColor(COLOR("#FFFFFFFF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) deletePromptOption->SetColor(COLOR(text_colour));
else deletePromptOption->SetColor(COLOR("#FFFFFFFF"));
deletePromptOption->SetIcon(this->getMenuOptionIcon(inst::config::deletePrompt)); deletePromptOption->SetIcon(this->getMenuOptionIcon(inst::config::deletePrompt));
this->menu->AddItem(deletePromptOption); this->menu->AddItem(deletePromptOption);
auto autoUpdateOption = pu::ui::elm::MenuItem::New("options.menu_items.auto_update"_lang); auto autoUpdateOption = pu::ui::elm::MenuItem::New("options.menu_items.auto_update"_lang);
autoUpdateOption->SetColor(COLOR("#FFFFFFFF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) autoUpdateOption->SetColor(COLOR(text_colour));
else autoUpdateOption->SetColor(COLOR("#FFFFFFFF"));
autoUpdateOption->SetIcon(this->getMenuOptionIcon(inst::config::autoUpdate)); autoUpdateOption->SetIcon(this->getMenuOptionIcon(inst::config::autoUpdate));
this->menu->AddItem(autoUpdateOption); this->menu->AddItem(autoUpdateOption);
auto useSoundOption = pu::ui::elm::MenuItem::New("options.menu_items.useSound"_lang); auto useSoundOption = pu::ui::elm::MenuItem::New("options.menu_items.useSound"_lang);
useSoundOption->SetColor(COLOR("#FFFFFFFF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) useSoundOption->SetColor(COLOR(text_colour));
else useSoundOption->SetColor(COLOR("#FFFFFFFF"));
useSoundOption->SetIcon(this->getMenuOptionIcon(inst::config::useSound)); useSoundOption->SetIcon(this->getMenuOptionIcon(inst::config::useSound));
this->menu->AddItem(useSoundOption); this->menu->AddItem(useSoundOption);
auto useMusicOption = pu::ui::elm::MenuItem::New("options.menu_items.useMusic"_lang); auto useMusicOption = pu::ui::elm::MenuItem::New("options.menu_items.useMusic"_lang);
useMusicOption->SetColor(COLOR("#FFFFFFFF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) useMusicOption->SetColor(COLOR(text_colour));
else useMusicOption->SetColor(COLOR("#FFFFFFFF"));
useMusicOption->SetIcon(this->getMenuOptionIcon(inst::config::useMusic)); useMusicOption->SetIcon(this->getMenuOptionIcon(inst::config::useMusic));
this->menu->AddItem(useMusicOption); this->menu->AddItem(useMusicOption);
auto fixticket = pu::ui::elm::MenuItem::New("options.menu_items.fixticket"_lang); auto fixticket = pu::ui::elm::MenuItem::New("options.menu_items.fixticket"_lang);
fixticket->SetColor(COLOR("#FFFFFFFF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) fixticket->SetColor(COLOR(text_colour));
else fixticket->SetColor(COLOR("#FFFFFFFF"));
fixticket->SetIcon(this->getMenuOptionIcon(inst::config::fixticket)); fixticket->SetIcon(this->getMenuOptionIcon(inst::config::fixticket));
this->menu->AddItem(fixticket); this->menu->AddItem(fixticket);
auto listoveride = pu::ui::elm::MenuItem::New("options.menu_items.listoveride"_lang); auto listoveride = pu::ui::elm::MenuItem::New("options.menu_items.listoveride"_lang);
listoveride->SetColor(COLOR("#FFFFFFFF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) listoveride->SetColor(COLOR(text_colour));
else listoveride->SetColor(COLOR("#FFFFFFFF"));
listoveride->SetIcon(this->getMenuOptionIcon(inst::config::listoveride)); listoveride->SetIcon(this->getMenuOptionIcon(inst::config::listoveride));
this->menu->AddItem(listoveride); this->menu->AddItem(listoveride);
auto httpkeyboard = pu::ui::elm::MenuItem::New("options.menu_items.usehttpkeyboard"_lang); auto httpkeyboard = pu::ui::elm::MenuItem::New("options.menu_items.usehttpkeyboard"_lang);
httpkeyboard->SetColor(COLOR("#FFFFFFFF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) httpkeyboard->SetColor(COLOR(text_colour));
else httpkeyboard->SetColor(COLOR("#FFFFFFFF"));
httpkeyboard->SetIcon(this->getMenuOptionIcon(inst::config::httpkeyboard)); httpkeyboard->SetIcon(this->getMenuOptionIcon(inst::config::httpkeyboard));
this->menu->AddItem(httpkeyboard); this->menu->AddItem(httpkeyboard);
auto useThemeOption = pu::ui::elm::MenuItem::New("theme.theme_option"_lang); auto useThemeOption = pu::ui::elm::MenuItem::New("theme.theme_option"_lang);
useThemeOption->SetColor(COLOR("#FFFFFFFF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) useThemeOption->SetColor(COLOR(text_colour));
else useThemeOption->SetColor(COLOR("#FFFFFFFF"));
useThemeOption->SetIcon(this->getMenuOptionIcon(inst::config::useTheme)); useThemeOption->SetIcon(this->getMenuOptionIcon(inst::config::useTheme));
this->menu->AddItem(useThemeOption); this->menu->AddItem(useThemeOption);
auto ThemeMenuOption = pu::ui::elm::MenuItem::New("theme.theme_menu"_lang); auto ThemeMenuOption = pu::ui::elm::MenuItem::New("theme.theme_menu"_lang);
ThemeMenuOption->SetColor(COLOR("#FFFFFFFF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) ThemeMenuOption->SetColor(COLOR(text_colour));
ThemeMenuOption->SetIcon("romfs:/images/icons/thememenu.png"); else ThemeMenuOption->SetColor(COLOR("#FFFFFFFF"));
std::string thememenu = "romfs:/images/icons/thememenu.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_settings.theme_dl"_theme)) {
thememenu = inst::config::appDir + "icons_settings.theme_dl"_theme;
}
ThemeMenuOption->SetIcon(thememenu);
this->menu->AddItem(ThemeMenuOption); this->menu->AddItem(ThemeMenuOption);
auto ThemeUrlOption = pu::ui::elm::MenuItem::New("theme.theme_url"_lang + inst::util::shortenString(inst::config::httplastUrl2, 42, false)); auto ThemeUrlOption = pu::ui::elm::MenuItem::New("theme.theme_url"_lang + inst::util::shortenString(inst::config::httplastUrl2, 42, false));
ThemeUrlOption->SetColor(COLOR("#FFFFFFFF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) ThemeUrlOption->SetColor(COLOR(text_colour));
ThemeUrlOption->SetIcon("romfs:/images/icons/themeurl.png"); else ThemeUrlOption->SetColor(COLOR("#FFFFFFFF"));
std::string themeurl = "romfs:/images/icons/themeurl.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_settings.theme_server"_theme)) {
themeurl = inst::config::appDir + "icons_settings.theme_server"_theme;
}
ThemeUrlOption->SetIcon(themeurl);
this->menu->AddItem(ThemeUrlOption); this->menu->AddItem(ThemeUrlOption);
auto SigPatch = pu::ui::elm::MenuItem::New("main.menu.sig"_lang); auto SigPatch = pu::ui::elm::MenuItem::New("main.menu.sig"_lang);
SigPatch->SetColor(COLOR("#FFFFFFFF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) SigPatch->SetColor(COLOR(text_colour));
SigPatch->SetIcon("romfs:/images/icons/plaster.png"); else SigPatch->SetColor(COLOR("#FFFFFFFF"));
std::string sigs = "romfs:/images/icons/plaster.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_settings.patches"_theme)) {
sigs = inst::config::appDir + "icons_settings.patches"_theme;
}
SigPatch->SetIcon(sigs);
this->menu->AddItem(SigPatch); this->menu->AddItem(SigPatch);
auto sigPatchesUrlOption = pu::ui::elm::MenuItem::New("options.menu_items.sig_url"_lang + inst::util::shortenString(inst::config::sigPatchesUrl, 42, false)); auto sigPatchesUrlOption = pu::ui::elm::MenuItem::New("options.menu_items.sig_url"_lang + inst::util::shortenString(inst::config::sigPatchesUrl, 42, false));
sigPatchesUrlOption->SetColor(COLOR("#FFFFFFFF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) sigPatchesUrlOption->SetColor(COLOR(text_colour));
sigPatchesUrlOption->SetIcon("romfs:/images/icons/keyboard.png"); else sigPatchesUrlOption->SetColor(COLOR("#FFFFFFFF"));
std::string sigsurl = "romfs:/images/icons/keyboard.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_settings.patches_server"_theme)) {
sigsurl = inst::config::appDir + "icons_settings.patches_server"_theme;
}
sigPatchesUrlOption->SetIcon(sigsurl);
this->menu->AddItem(sigPatchesUrlOption); this->menu->AddItem(sigPatchesUrlOption);
auto httpServerUrlOption = pu::ui::elm::MenuItem::New("options.menu_items.http_url"_lang + inst::util::shortenString(inst::config::httpIndexUrl, 42, false)); auto httpServerUrlOption = pu::ui::elm::MenuItem::New("options.menu_items.http_url"_lang + inst::util::shortenString(inst::config::httpIndexUrl, 42, false));
httpServerUrlOption->SetColor(COLOR("#FFFFFFFF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) httpServerUrlOption->SetColor(COLOR(text_colour));
httpServerUrlOption->SetIcon("romfs:/images/icons/url.png"); else httpServerUrlOption->SetColor(COLOR("#FFFFFFFF"));
std::string neturl = "romfs:/images/icons/url.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_settings.net_source"_theme)) {
neturl = inst::config::appDir + "icons_settings.net_source"_theme;
}
httpServerUrlOption->SetIcon(neturl);
this->menu->AddItem(httpServerUrlOption); this->menu->AddItem(httpServerUrlOption);
auto languageOption = pu::ui::elm::MenuItem::New("options.menu_items.language"_lang + this->getMenuLanguage(inst::config::languageSetting)); auto languageOption = pu::ui::elm::MenuItem::New("options.menu_items.language"_lang + this->getMenuLanguage(inst::config::languageSetting));
languageOption->SetColor(COLOR("#FFFFFFFF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) languageOption->SetColor(COLOR(text_colour));
languageOption->SetIcon("romfs:/images/icons/speak.png"); else languageOption->SetColor(COLOR("#FFFFFFFF"));
std::string lang = "romfs:/images/icons/speak.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_settings.language"_theme)) {
lang = inst::config::appDir + "icons_settings.language"_theme;
}
languageOption->SetIcon(lang);
this->menu->AddItem(languageOption); this->menu->AddItem(languageOption);
auto updateOption = pu::ui::elm::MenuItem::New("options.menu_items.check_update"_lang); auto updateOption = pu::ui::elm::MenuItem::New("options.menu_items.check_update"_lang);
updateOption->SetColor(COLOR("#FFFFFFFF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) updateOption->SetColor(COLOR(text_colour));
updateOption->SetIcon("romfs:/images/icons/update2.png"); else updateOption->SetColor(COLOR("#FFFFFFFF"));
std::string upd = "romfs:/images/icons/update2.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_settings.update"_theme)) {
upd = inst::config::appDir + "icons_settings.update"_theme;
}
updateOption->SetIcon(upd);
this->menu->AddItem(updateOption); this->menu->AddItem(updateOption);
auto creditsOption = pu::ui::elm::MenuItem::New("options.menu_items.credits"_lang); auto creditsOption = pu::ui::elm::MenuItem::New("options.menu_items.credits"_lang);
creditsOption->SetColor(COLOR("#FFFFFFFF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) creditsOption->SetColor(COLOR(text_colour));
creditsOption->SetIcon("romfs:/images/icons/credits2.png"); else creditsOption->SetColor(COLOR("#FFFFFFFF"));
std::string credit = "romfs:/images/icons/credits2.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_settings.credits"_theme)) {
credit = inst::config::appDir + "icons_settings.credits"_theme;
}
creditsOption->SetIcon(credit);
this->menu->AddItem(creditsOption); this->menu->AddItem(creditsOption);
} }
@ -308,7 +419,11 @@ namespace inst::ui {
break; break;
case 1: case 1:
if (inst::config::validateNCAs) { if (inst::config::validateNCAs) {
if (inst::ui::mainApp->CreateShowDialog("options.nca_warn.title"_lang, "options.nca_warn.desc"_lang, { "common.cancel"_lang, "options.nca_warn.opt1"_lang }, false, "romfs:/images/icons/information.png") == 1) inst::config::validateNCAs = false; std::string info = "romfs:/images/icons/information.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.information"_theme)) {
info = inst::config::appDir + "icons_others.information"_theme;
}
if (inst::ui::mainApp->CreateShowDialog("options.nca_warn.title"_lang, "options.nca_warn.desc"_lang, { "common.cancel"_lang, "options.nca_warn.opt1"_lang }, false, info) == 1) inst::config::validateNCAs = false;
} }
else inst::config::validateNCAs = true; else inst::config::validateNCAs = true;
inst::config::setConfig(); inst::config::setConfig();
@ -396,7 +511,11 @@ namespace inst::ui {
break; break;
case 11: case 11:
if (inst::util::getIPAddress() == "1.0.0.127") { if (inst::util::getIPAddress() == "1.0.0.127") {
inst::ui::mainApp->CreateShowDialog("main.net.title"_lang, "main.net.desc"_lang, { "common.ok"_lang }, true, "romfs:/images/icons/information.png"); std::string info = "romfs:/images/icons/information.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.information"_theme)) {
info = inst::config::appDir + "icons_others.information"_theme;
}
inst::ui::mainApp->CreateShowDialog("main.net.title"_lang, "main.net.desc"_lang, { "common.ok"_lang }, true, info);
break; break;
} }
mainApp->ThemeinstPage->startNetwork(); mainApp->ThemeinstPage->startNetwork();
@ -473,18 +592,31 @@ namespace inst::ui {
break; break;
case 17: case 17:
if (inst::util::getIPAddress() == "1.0.0.127") { if (inst::util::getIPAddress() == "1.0.0.127") {
inst::ui::mainApp->CreateShowDialog("main.net.title"_lang, "main.net.desc"_lang, { "common.ok"_lang }, true, "romfs:/images/icons/update.png"); std::string update = "romfs:/images/icons/update.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.update"_theme)) {
update = inst::config::appDir + "icons_others.update"_theme;
}
inst::ui::mainApp->CreateShowDialog("main.net.title"_lang, "main.net.desc"_lang, { "common.ok"_lang }, true, update);
break; break;
} }
downloadUrl = inst::util::checkForAppUpdate(); downloadUrl = inst::util::checkForAppUpdate();
if (!downloadUrl.size()) { if (!downloadUrl.size()) {
mainApp->CreateShowDialog("options.update.title_check_fail"_lang, "options.update.desc_check_fail"_lang, { "common.ok"_lang }, false, "romfs:/images/icons/fail.png"); std::string fail = "romfs:/images/icons/fail.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.fail"_theme)) {
fail = inst::config::appDir + "icons_others.fail"_theme;
}
mainApp->CreateShowDialog("options.update.title_check_fail"_lang, "options.update.desc_check_fail"_lang, { "common.ok"_lang }, false, fail);
break; break;
} }
this->askToUpdate(downloadUrl); this->askToUpdate(downloadUrl);
break; break;
case 18: case 18:
inst::ui::mainApp->CreateShowDialog("options.credits.title"_lang, "options.credits.desc"_lang, { "common.close"_lang }, true, "romfs:/images/icons/credits.png"); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.credits"_theme)) {
inst::ui::mainApp->CreateShowDialog("options.credits.title"_lang, "options.credits.desc"_lang, { "common.close"_lang }, true, inst::config::appDir + "icons_others.credits"_theme);
}
else {
inst::ui::mainApp->CreateShowDialog("options.credits.title"_lang, "options.credits.desc"_lang, { "common.close"_lang }, true, "romfs:/images/icons/credits.png");
}
break; break;
default: default:
break; break;