2020-09-20 01:21:28 +01:00
|
|
|
#include "JC_page.hpp"
|
2020-10-05 01:59:46 +01:00
|
|
|
#include "lang.hpp"
|
|
|
|
using namespace lang::literals;
|
2020-09-20 01:21:28 +01:00
|
|
|
JCPage::JCPage() : AppletFrame(true, true)
|
|
|
|
{
|
2020-10-05 01:59:46 +01:00
|
|
|
this->setTitle("joy_con"_lang);
|
2020-09-20 01:21:28 +01:00
|
|
|
list = new brls::List();
|
2020-10-05 01:59:46 +01:00
|
|
|
std::string labelText = "jc_you_can_1"_lang + std::string(COLOR_PROFILES_PATH) + "jc_you_can_goto"\
|
|
|
|
"jc_you_can_2"_lang;
|
2020-09-20 01:21:28 +01:00
|
|
|
label = new brls::Label(brls::LabelStyle::DESCRIPTION, labelText, true);
|
|
|
|
list->addView(label);
|
|
|
|
|
2020-10-05 01:59:46 +01:00
|
|
|
backup = new brls::ListItem("jc_backup"_lang);
|
2020-09-20 01:21:28 +01:00
|
|
|
backup->getClickEvent()->subscribe([&](brls::View* view) {
|
|
|
|
brls::StagedAppletFrame* stagedFrame = new brls::StagedAppletFrame();
|
2020-10-05 01:59:46 +01:00
|
|
|
stagedFrame->setTitle("jc_color"_lang);
|
2020-09-20 01:21:28 +01:00
|
|
|
stagedFrame->addStage(
|
2020-10-05 01:59:46 +01:00
|
|
|
new WorkerPage(stagedFrame, "jc_backing"_lang,
|
2020-09-20 01:21:28 +01:00
|
|
|
[](){backupJCColor(COLOR_PROFILES_PATH);})
|
|
|
|
);
|
|
|
|
stagedFrame->addStage(
|
2020-10-05 01:59:46 +01:00
|
|
|
new ConfirmPage(stagedFrame, "jc_all_done"_lang, true)
|
2020-09-20 01:21:28 +01:00
|
|
|
);
|
|
|
|
brls::Application::pushView(stagedFrame);
|
|
|
|
});
|
|
|
|
list->addView(backup);
|
|
|
|
|
|
|
|
list->addView(new brls::ListItemGroupSpacing(true));
|
|
|
|
|
|
|
|
auto profiles = getProfiles(COLOR_PROFILES_PATH);
|
|
|
|
std::vector<std::string> names = std::get<0>(profiles);
|
|
|
|
int nbProfiles = names.size();
|
|
|
|
items.reserve(nbProfiles);
|
|
|
|
for (int i = nbProfiles - 1; i >= 0; i--){
|
|
|
|
std::string name = std::get<0>(profiles)[i];
|
|
|
|
std::vector<int> value = std::get<1>(profiles)[i];
|
|
|
|
items[i] = new brls::ListItem(names[i]);
|
|
|
|
items[i]->getClickEvent()->subscribe([&, value](brls::View* view) {
|
|
|
|
brls::StagedAppletFrame* stagedFrame = new brls::StagedAppletFrame();
|
2020-10-05 01:59:46 +01:00
|
|
|
stagedFrame->setTitle("jc_concolor"_lang);
|
2020-09-20 01:21:28 +01:00
|
|
|
stagedFrame->addStage(
|
2020-10-05 01:59:46 +01:00
|
|
|
new WorkerPage(stagedFrame, "jc_changing"_lang,
|
2020-09-20 01:21:28 +01:00
|
|
|
[value](){changeJCColor(value);})
|
|
|
|
);
|
|
|
|
stagedFrame->addStage(
|
2020-10-05 01:59:46 +01:00
|
|
|
new ConfirmPage(stagedFrame, "jc_all_"_lang, true)
|
2020-09-20 01:21:28 +01:00
|
|
|
);
|
|
|
|
brls::Application::pushView(stagedFrame);
|
|
|
|
});
|
|
|
|
list->addView(items[i]);
|
|
|
|
}
|
|
|
|
this->setContentView(list);
|
|
|
|
}
|