2021-02-06 17:24:47 +00:00
|
|
|
#include "hide_tabs_page.hpp"
|
2021-09-11 14:48:13 +01:00
|
|
|
|
2021-03-16 02:43:48 +00:00
|
|
|
#include <fstream>
|
2021-09-11 14:48:13 +01:00
|
|
|
#include <json.hpp>
|
|
|
|
|
2021-02-10 16:28:47 +00:00
|
|
|
#include "constants.hpp"
|
2021-03-16 14:56:46 +00:00
|
|
|
#include "fs.hpp"
|
2021-07-21 14:38:43 +01:00
|
|
|
#include "utils.hpp"
|
2021-03-16 02:43:48 +00:00
|
|
|
|
2021-02-06 17:24:47 +00:00
|
|
|
namespace i18n = brls::i18n;
|
|
|
|
using namespace i18n::literals;
|
2022-10-31 18:59:48 +00:00
|
|
|
using json = nlohmann::ordered_json;
|
2021-02-06 17:24:47 +00:00
|
|
|
|
2021-09-11 14:48:13 +01:00
|
|
|
HideTabsPage::HideTabsPage() : AppletFrame(true, true)
|
|
|
|
{
|
2021-03-10 20:54:17 +00:00
|
|
|
this->setTitle("menus/hide/title"_i18n);
|
2021-02-06 17:24:47 +00:00
|
|
|
list = new brls::List();
|
|
|
|
label = new brls::Label(
|
|
|
|
brls::LabelStyle::DESCRIPTION,
|
2021-03-10 20:54:17 +00:00
|
|
|
"menus/hide/desc"_i18n,
|
2021-09-11 14:48:13 +01:00
|
|
|
true);
|
2021-02-06 17:24:47 +00:00
|
|
|
list->addView(label);
|
|
|
|
|
2021-03-16 14:56:46 +00:00
|
|
|
json hideStatus = fs::parseJsonFile(HIDE_TABS_JSON);
|
2021-02-06 17:24:47 +00:00
|
|
|
|
2021-07-21 14:38:43 +01:00
|
|
|
about = new brls::ToggleListItem("menus/main/about"_i18n, util::getBoolValue(hideStatus, "about"));
|
2021-02-06 17:24:47 +00:00
|
|
|
list->addView(about);
|
|
|
|
|
2021-07-21 14:38:43 +01:00
|
|
|
ams = new brls::ToggleListItem("menus/main/update_ams"_i18n, util::getBoolValue(hideStatus, "atmosphere"));
|
2021-02-06 17:24:47 +00:00
|
|
|
list->addView(ams);
|
|
|
|
|
2021-07-21 14:38:43 +01:00
|
|
|
cfws = new brls::ToggleListItem("menus/main/update_bootloaders"_i18n, util::getBoolValue(hideStatus, "cfw"));
|
2021-02-06 17:24:47 +00:00
|
|
|
list->addView(cfws);
|
|
|
|
|
2021-07-21 14:38:43 +01:00
|
|
|
fws = new brls::ToggleListItem("menus/main/download_firmware"_i18n, util::getBoolValue(hideStatus, "firmwares"));
|
2021-02-06 17:24:47 +00:00
|
|
|
list->addView(fws);
|
|
|
|
|
2021-07-21 14:38:43 +01:00
|
|
|
cheats = new brls::ToggleListItem("menus/main/download_cheats"_i18n, util::getBoolValue(hideStatus, "cheats"));
|
2021-02-06 17:24:47 +00:00
|
|
|
list->addView(cheats);
|
2022-09-08 00:28:31 +01:00
|
|
|
|
|
|
|
custom = new brls::ToggleListItem("menus/main/custom_downloads"_i18n, util::getBoolValue(hideStatus, "custom"));
|
|
|
|
list->addView(custom);
|
2021-02-06 17:24:47 +00:00
|
|
|
|
2022-09-08 00:28:31 +01:00
|
|
|
outdatedTitles = new brls::ToggleListItem("menus/tools/outdated_titles"_i18n, util::getBoolValue(hideStatus, "outdatedtitles"));
|
2022-05-16 14:39:50 +01:00
|
|
|
list->addView(outdatedTitles);
|
|
|
|
|
2021-09-28 14:03:32 +01:00
|
|
|
jccolor = new brls::ToggleListItem("menus/tools/joy_cons"_i18n, util::getBoolValue(hideStatus, "jccolor"));
|
|
|
|
list->addView(jccolor);
|
|
|
|
|
|
|
|
pccolor = new brls::ToggleListItem("menus/tools/pro_cons"_i18n, util::getBoolValue(hideStatus, "pccolor"));
|
|
|
|
list->addView(pccolor);
|
|
|
|
|
|
|
|
downloadpayload = new brls::ToggleListItem("menus/tools/dl_payloads"_i18n, util::getBoolValue(hideStatus, "downloadpayload"));
|
|
|
|
list->addView(downloadpayload);
|
|
|
|
|
|
|
|
rebootpayload = new brls::ToggleListItem("menus/tools/inject_payloads"_i18n, util::getBoolValue(hideStatus, "rebootpayload"));
|
|
|
|
list->addView(rebootpayload);
|
|
|
|
|
|
|
|
netsettings = new brls::ToggleListItem("menus/tools/internet_settings"_i18n, util::getBoolValue(hideStatus, "netsettings"));
|
|
|
|
list->addView(netsettings);
|
|
|
|
|
|
|
|
browser = new brls::ToggleListItem("menus/tools/browser"_i18n, util::getBoolValue(hideStatus, "browser"));
|
|
|
|
list->addView(browser);
|
|
|
|
|
|
|
|
move = new brls::ToggleListItem("menus/tools/batch_copy"_i18n, util::getBoolValue(hideStatus, "move"));
|
|
|
|
list->addView(move);
|
|
|
|
|
|
|
|
cleanup = new brls::ToggleListItem("menus/tools/clean_up"_i18n, util::getBoolValue(hideStatus, "cleanup"));
|
|
|
|
list->addView(cleanup);
|
|
|
|
|
|
|
|
language = new brls::ToggleListItem("menus/tools/language"_i18n, util::getBoolValue(hideStatus, "language"));
|
|
|
|
list->addView(language);
|
|
|
|
|
2021-09-11 14:48:13 +01:00
|
|
|
list->registerAction("menus/cheats/exclude_titles_save"_i18n, brls::Key::B, [this] {
|
2021-02-06 17:24:47 +00:00
|
|
|
json updatedStatus = json::object();
|
|
|
|
updatedStatus["about"] = about->getToggleState();
|
2022-09-08 00:28:31 +01:00
|
|
|
updatedStatus["atmosphere"] = ams->getToggleState();
|
2021-02-06 17:24:47 +00:00
|
|
|
updatedStatus["cfw"] = cfws->getToggleState();
|
|
|
|
updatedStatus["firmwares"] = fws->getToggleState();
|
|
|
|
updatedStatus["cheats"] = cheats->getToggleState();
|
2022-09-08 00:28:31 +01:00
|
|
|
updatedStatus["custom"] = custom->getToggleState();
|
|
|
|
updatedStatus["outdatedtitles"] = outdatedTitles->getToggleState();
|
2021-09-28 14:03:32 +01:00
|
|
|
updatedStatus["jccolor"] = jccolor->getToggleState();
|
|
|
|
updatedStatus["pccolor"] = pccolor->getToggleState();
|
|
|
|
updatedStatus["downloadpayload"] = downloadpayload->getToggleState();
|
|
|
|
updatedStatus["rebootpayload"] = rebootpayload->getToggleState();
|
|
|
|
updatedStatus["netsettings"] = netsettings->getToggleState();
|
|
|
|
updatedStatus["browser"] = browser->getToggleState();
|
|
|
|
updatedStatus["move"] = move->getToggleState();
|
|
|
|
updatedStatus["cleanup"] = cleanup->getToggleState();
|
|
|
|
updatedStatus["language"] = language->getToggleState();
|
|
|
|
|
2021-03-16 14:56:46 +00:00
|
|
|
fs::writeJsonToFile(updatedStatus, HIDE_TABS_JSON);
|
2021-02-06 17:24:47 +00:00
|
|
|
brls::Application::popView();
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
this->setContentView(list);
|
2021-09-28 14:03:32 +01:00
|
|
|
}
|