2020-12-28 18:28:58 +00:00
|
|
|
#include "PC_page.hpp"
|
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 "worker_page.hpp"
|
|
|
|
#include "constants.hpp"
|
2020-12-28 18:28:58 +00:00
|
|
|
|
|
|
|
namespace i18n = brls::i18n;
|
|
|
|
using namespace i18n::literals;
|
|
|
|
PCPage::PCPage() : AppletFrame(true, true)
|
|
|
|
{
|
2021-03-10 20:54:17 +00:00
|
|
|
this->setTitle("menus/pro_con/title"_i18n);
|
2020-12-28 18:28:58 +00:00
|
|
|
list = new brls::List();
|
2021-03-01 18:19:17 +00:00
|
|
|
std::string labelText = "menus/pro_con/desc"_i18n;
|
2020-12-28 18:28:58 +00: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-12-28 18:28:58 +00:00
|
|
|
backup->getClickEvent()->subscribe([&](brls::View* view) {
|
|
|
|
brls::StagedAppletFrame* stagedFrame = new brls::StagedAppletFrame();
|
2021-03-10 20:54:17 +00:00
|
|
|
stagedFrame->setTitle("menus/pro_con/label"_i18n);
|
2020-12-28 18:28:58 +00:00
|
|
|
stagedFrame->addStage(
|
2021-03-10 20:54:17 +00:00
|
|
|
new WorkerPage(stagedFrame, "menus/pro_con/backing_up"_i18n,
|
2021-03-16 02:04:21 +00:00
|
|
|
[](){PC::backupPCColor(PC_COLOR_PATH);})
|
2020-12-28 18:28:58 +00:00
|
|
|
);
|
|
|
|
stagedFrame->addStage(
|
2021-03-10 20:54:17 +00:00
|
|
|
new ConfirmPage(stagedFrame, "menus/common/all_done"_i18n, true)
|
2020-12-28 18:28:58 +00:00
|
|
|
);
|
|
|
|
brls::Application::pushView(stagedFrame);
|
|
|
|
});
|
|
|
|
list->addView(backup);
|
|
|
|
|
|
|
|
list->addView(new brls::ListItemGroupSpacing(true));
|
|
|
|
|
2021-03-16 02:04:21 +00:00
|
|
|
auto profiles = PC::getProfiles(PC_COLOR_PATH);
|
2021-03-16 14:56:46 +00:00
|
|
|
for (int i = profiles.size() - 1; i >= 0; i--){
|
|
|
|
std::vector<int> value = profiles[i].second;
|
|
|
|
listItem = new brls::ListItem(profiles[i].first);
|
2021-03-11 01:27:37 +00:00
|
|
|
listItem->getClickEvent()->subscribe([&, value](brls::View* view) {
|
2020-12-28 18:28:58 +00:00
|
|
|
brls::StagedAppletFrame* stagedFrame = new brls::StagedAppletFrame();
|
2021-03-10 20:54:17 +00:00
|
|
|
stagedFrame->setTitle("menus/pro_con/label"_i18n);
|
2020-12-28 18:28:58 +00:00
|
|
|
stagedFrame->addStage(
|
2021-03-11 01:27:37 +00:00
|
|
|
new WorkerPage(stagedFrame, "menus/pro_con/changing"_i18n,
|
2021-03-16 02:04:21 +00:00
|
|
|
[value](){PC::changePCColor(value);})
|
2020-12-28 18:28:58 +00:00
|
|
|
);
|
|
|
|
stagedFrame->addStage(
|
2021-03-10 20:54:17 +00:00
|
|
|
new ConfirmPage(stagedFrame, "menus/pro_con/all_done"_i18n, true)
|
2020-12-28 18:28:58 +00:00
|
|
|
);
|
|
|
|
brls::Application::pushView(stagedFrame);
|
|
|
|
});
|
2021-03-11 01:27:37 +00:00
|
|
|
list->addView(listItem);
|
2020-12-28 18:28:58 +00:00
|
|
|
}
|
|
|
|
this->setContentView(list);
|
|
|
|
}
|