2021-02-06 17:24:47 +00:00
|
|
|
#include "hide_tabs_page.hpp"
|
2021-03-16 02:43:48 +00:00
|
|
|
#include <json.hpp>
|
|
|
|
#include <fstream>
|
2021-02-10 16:28:47 +00:00
|
|
|
#include "constants.hpp"
|
2021-03-16 14:56:46 +00:00
|
|
|
#include "fs.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;
|
|
|
|
using json = nlohmann::json;
|
|
|
|
|
|
|
|
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-02-06 17:24:47 +00:00
|
|
|
true
|
|
|
|
);
|
|
|
|
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
|
|
|
|
|
|
|
bool status = false;
|
|
|
|
if(hideStatus.find("about") != hideStatus.end()) {
|
|
|
|
status = hideStatus["about"];
|
|
|
|
}
|
2021-03-01 18:19:17 +00:00
|
|
|
about = new brls::ToggleListItem("menus/main/about"_i18n, status);
|
2021-02-06 17:24:47 +00:00
|
|
|
list->addView(about);
|
|
|
|
|
|
|
|
status = false;
|
|
|
|
if(hideStatus.find("atmosphere") != hideStatus.end()) {
|
|
|
|
status = hideStatus["atmosphere"];
|
|
|
|
}
|
2021-03-01 18:19:17 +00:00
|
|
|
ams = new brls::ToggleListItem("menus/main/update_ams"_i18n, status);
|
2021-02-06 17:24:47 +00:00
|
|
|
list->addView(ams);
|
|
|
|
|
|
|
|
status = false;
|
|
|
|
if(hideStatus.find("cfw") != hideStatus.end()) {
|
|
|
|
status = hideStatus["cfw"];
|
|
|
|
}
|
2021-03-01 18:19:17 +00:00
|
|
|
cfws = new brls::ToggleListItem("menus/main/update_cfw"_i18n, status);
|
2021-02-06 17:24:47 +00:00
|
|
|
list->addView(cfws);
|
|
|
|
|
|
|
|
status = false;
|
|
|
|
if(hideStatus.find("sigpatches") != hideStatus.end()) {
|
|
|
|
status = hideStatus["sigpatches"];
|
|
|
|
}
|
2021-03-01 18:19:17 +00:00
|
|
|
sigpatches = new brls::ToggleListItem("menus/main/update_sigpatches"_i18n, status);
|
2021-02-06 17:24:47 +00:00
|
|
|
list->addView(sigpatches);
|
|
|
|
|
|
|
|
status = false;
|
|
|
|
if(hideStatus.find("firmwares") != hideStatus.end()) {
|
|
|
|
status = hideStatus["firmwares"];
|
|
|
|
}
|
2021-03-01 18:19:17 +00:00
|
|
|
fws = new brls::ToggleListItem("menus/main/download_firmware"_i18n, status);
|
2021-02-06 17:24:47 +00:00
|
|
|
list->addView(fws);
|
|
|
|
|
|
|
|
status = false;
|
|
|
|
if(hideStatus.find("cheats") != hideStatus.end()) {
|
|
|
|
status = hideStatus["cheats"];
|
|
|
|
}
|
2021-03-01 18:19:17 +00:00
|
|
|
cheats = new brls::ToggleListItem("menus/main/download_cheats"_i18n, status);
|
2021-02-06 17:24:47 +00:00
|
|
|
list->addView(cheats);
|
|
|
|
|
2021-03-10 20:54:17 +00: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();
|
|
|
|
updatedStatus["atmosphere"] = ams->getToggleState();
|
|
|
|
updatedStatus["cfw"] = cfws->getToggleState();
|
|
|
|
updatedStatus["sigpatches"] = sigpatches->getToggleState();
|
|
|
|
updatedStatus["firmwares"] = fws->getToggleState();
|
|
|
|
updatedStatus["cheats"] = cheats->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);
|
|
|
|
}
|