2020-09-20 01:21:28 +01:00
|
|
|
#include "JC_page.hpp"
|
2021-09-11 14:48:13 +01:00
|
|
|
|
2021-03-16 02:04:21 +00:00
|
|
|
#include "color_swapper.hpp"
|
2021-02-10 16:28:47 +00:00
|
|
|
#include "confirm_page.hpp"
|
|
|
|
#include "constants.hpp"
|
2021-09-11 14:48:13 +01:00
|
|
|
#include "worker_page.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-10-27 16:56:29 +01:00
|
|
|
label = new brls::Label(brls::LabelStyle::DESCRIPTION, fmt::format("menus/joy_con/description"_i18n, COLOR_PROFILES_PATH, COLOR_PICKER_URL), true);
|
2020-09-20 01:21:28 +01:00
|
|
|
list->addView(label);
|
|
|
|
|
2021-03-10 20:54:17 +00:00
|
|
|
backup = new brls::ListItem("menus/joy_con/backup"_i18n);
|
2021-10-01 18:22:52 +01:00
|
|
|
backup->getClickEvent()->subscribe([](brls::View* view) {
|
2020-09-20 01:21:28 +01:00
|
|
|
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-09-11 14:48:13 +01:00
|
|
|
new WorkerPage(stagedFrame, "menus/joy_con/backing_up"_i18n,
|
|
|
|
[]() { JC::backupJCColor(COLOR_PROFILES_PATH); }));
|
2020-09-20 01:21:28 +01:00
|
|
|
stagedFrame->addStage(
|
2021-09-11 14:48:13 +01: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));
|
|
|
|
|
2021-03-16 02:04:21 +00:00
|
|
|
auto profiles = JC::getProfiles(COLOR_PROFILES_PATH);
|
2021-09-11 14:48:13 +01:00
|
|
|
for (int i = profiles.size() - 1; i >= 0; i--) {
|
2021-03-16 14:56:46 +00:00
|
|
|
std::vector<int> value = profiles[i].second;
|
|
|
|
listItem = new brls::ListItem(profiles[i].first);
|
2021-10-03 18:54:09 +01:00
|
|
|
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-09-11 14:48:13 +01:00
|
|
|
new WorkerPage(stagedFrame, "menus/joy_con/changing"_i18n,
|
|
|
|
[value]() { JC::changeJCColor(value); }));
|
2020-09-20 01:21:28 +01:00
|
|
|
stagedFrame->addStage(
|
2021-09-11 14:48:13 +01: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);
|
|
|
|
}
|