1
0
Fork 0
mirror of https://github.com/HamletDuFromage/aio-switch-updater.git synced 2024-11-14 14:06:53 +00:00
AIO-switch-updater/source/hide_tabs_page.cpp

57 lines
2 KiB
C++
Raw Normal View History

#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"
#include "utils.hpp"
2021-03-16 02:43:48 +00:00
namespace i18n = brls::i18n;
using namespace i18n::literals;
using json = nlohmann::json;
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);
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);
list->addView(label);
2021-03-16 14:56:46 +00:00
json hideStatus = fs::parseJsonFile(HIDE_TABS_JSON);
about = new brls::ToggleListItem("menus/main/about"_i18n, util::getBoolValue(hideStatus, "about"));
list->addView(about);
ams = new brls::ToggleListItem("menus/main/update_ams"_i18n, util::getBoolValue(hideStatus, "atmosphere"));
list->addView(ams);
cfws = new brls::ToggleListItem("menus/main/update_bootloaders"_i18n, util::getBoolValue(hideStatus, "cfw"));
list->addView(cfws);
sigpatches = new brls::ToggleListItem("menus/main/update_sigpatches"_i18n, util::getBoolValue(hideStatus, "sigpatches"));
list->addView(sigpatches);
fws = new brls::ToggleListItem("menus/main/download_firmware"_i18n, util::getBoolValue(hideStatus, "firmwares"));
list->addView(fws);
cheats = new brls::ToggleListItem("menus/main/download_cheats"_i18n, util::getBoolValue(hideStatus, "cheats"));
list->addView(cheats);
2021-09-11 14:48:13 +01:00
list->registerAction("menus/cheats/exclude_titles_save"_i18n, brls::Key::B, [this] {
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);
brls::Application::popView();
return true;
});
this->setContentView(list);
}