2020-09-20 01:21:28 +01:00
|
|
|
#include "JC_page.hpp"
|
2021-02-10 16:28:47 +00:00
|
|
|
#include "JC_color_swapper.hpp"
|
|
|
|
#include "confirm_page.hpp"
|
|
|
|
#include "worker_page.hpp"
|
|
|
|
#include "constants.hpp"
|
2020-10-05 23:53:12 +01:00
|
|
|
|
|
|
|
namespace i18n = brls::i18n;
|
|
|
|
using namespace i18n::literals;
|
2020-09-20 01:21:28 +01:00
|
|
|
JCPage::JCPage() : AppletFrame(true, true)
|
|
|
|
{
|
2021-03-10 20:54:17 +00:00
|
|
|
this->setTitle("menus/joy_con/title"_i18n);
|
2020-09-20 01:21:28 +01:00
|
|
|
list = new brls::List();
|
2021-03-10 20:54:17 +00:00
|
|
|
std::string labelText = "menus/joy_con/desc_1"_i18n + std::string(COLOR_PROFILES_PATH) + "menus/joy_con/desc_2"_i18n +
|
|
|
|
"menus/joy_con/desc_3"_i18n;
|
2020-09-20 01:21:28 +01:00
|
|
|
label = new brls::Label(brls::LabelStyle::DESCRIPTION, labelText, true);
|
|
|
|
list->addView(label);
|
|
|
|
|
2021-03-10 20:54:17 +00:00
|
|
|
backup = new brls::ListItem("menus/joy_con/backup"_i18n);
|
2020-09-20 01:21:28 +01:00
|
|
|
backup->getClickEvent()->subscribe([&](brls::View* view) {
|
|
|
|
brls::StagedAppletFrame* stagedFrame = new brls::StagedAppletFrame();
|
2021-03-10 20:54:17 +00:00
|
|
|
stagedFrame->setTitle("menus/joy_con/label"_i18n);
|
2020-09-20 01:21:28 +01:00
|
|
|
stagedFrame->addStage(
|
2021-03-10 20:54:17 +00:00
|
|
|
new WorkerPage(stagedFrame, "menus/joy_con/backing_up"_i18n,
|
2020-09-20 01:21:28 +01:00
|
|
|
[](){backupJCColor(COLOR_PROFILES_PATH);})
|
|
|
|
);
|
|
|
|
stagedFrame->addStage(
|
2021-03-10 20:54:17 +00:00
|
|
|
new ConfirmPage(stagedFrame, "menus/common/all_done"_i18n, 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();
|
|
|
|
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];
|
2021-03-11 01:27:37 +00:00
|
|
|
listItem = new brls::ListItem(names[i]);
|
|
|
|
listItem->getClickEvent()->subscribe([&, value](brls::View* view) {
|
2020-09-20 01:21:28 +01:00
|
|
|
brls::StagedAppletFrame* stagedFrame = new brls::StagedAppletFrame();
|
2021-03-11 01:27:37 +00:00
|
|
|
stagedFrame->setTitle("menus/joy_con/label"_i18n);
|
2020-09-20 01:21:28 +01:00
|
|
|
stagedFrame->addStage(
|
2021-03-11 01:27:37 +00:00
|
|
|
new WorkerPage(stagedFrame, "menus/joy_con/changing"_i18n,
|
2020-09-20 01:21:28 +01:00
|
|
|
[value](){changeJCColor(value);})
|
|
|
|
);
|
|
|
|
stagedFrame->addStage(
|
2021-03-10 20:54:17 +00:00
|
|
|
new ConfirmPage(stagedFrame, "menus/joy_con/all_done"_i18n, true)
|
2020-09-20 01:21:28 +01:00
|
|
|
);
|
|
|
|
brls::Application::pushView(stagedFrame);
|
|
|
|
});
|
2021-03-11 01:27:37 +00:00
|
|
|
list->addView(listItem);
|
2020-09-20 01:21:28 +01:00
|
|
|
}
|
|
|
|
this->setContentView(list);
|
|
|
|
}
|