2021-10-13 20:08:35 +00:00
|
|
|
#include "displayapp/screens/settings/Settings.h"
|
2021-04-04 02:08:51 +00:00
|
|
|
#include <lvgl/lvgl.h>
|
|
|
|
#include <array>
|
|
|
|
#include "displayapp/screens/List.h"
|
|
|
|
#include "displayapp/Apps.h"
|
|
|
|
#include "displayapp/DisplayApp.h"
|
|
|
|
#include "displayapp/screens/Symbols.h"
|
|
|
|
|
|
|
|
using namespace Pinetime::Applications::Screens;
|
|
|
|
|
2021-04-18 17:28:14 +00:00
|
|
|
Settings::Settings(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
|
|
|
|
: Screen(app),
|
|
|
|
settingsController {settingsController},
|
|
|
|
screens {app,
|
|
|
|
settingsController.GetSettingsMenu(),
|
|
|
|
{[this]() -> std::unique_ptr<Screen> {
|
|
|
|
return CreateScreen1();
|
|
|
|
},
|
|
|
|
[this]() -> std::unique_ptr<Screen> {
|
|
|
|
return CreateScreen2();
|
2021-10-18 21:29:41 +00:00
|
|
|
},
|
|
|
|
[this]() -> std::unique_ptr<Screen> {
|
|
|
|
return CreateScreen3();
|
2021-04-18 17:28:14 +00:00
|
|
|
}},
|
|
|
|
Screens::ScreenListModes::UpDown} {
|
|
|
|
}
|
2021-04-04 02:08:51 +00:00
|
|
|
|
|
|
|
Settings::~Settings() {
|
|
|
|
lv_obj_clean(lv_scr_act());
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
|
|
|
return screens.OnTouchEvent(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr<Screen> Settings::CreateScreen1() {
|
|
|
|
|
2021-04-18 17:28:14 +00:00
|
|
|
std::array<Screens::List::Applications, 4> applications {{
|
|
|
|
{Symbols::sun, "Display", Apps::SettingDisplay},
|
2021-07-13 13:30:24 +00:00
|
|
|
{Symbols::eye, "Wake Up", Apps::SettingWakeUp},
|
2021-04-18 17:28:14 +00:00
|
|
|
{Symbols::clock, "Time format", Apps::SettingTimeFormat},
|
2021-07-13 13:30:24 +00:00
|
|
|
{Symbols::home, "Watch face", Apps::SettingWatchFace},
|
2021-04-26 20:29:48 +00:00
|
|
|
}};
|
2021-04-04 02:08:51 +00:00
|
|
|
|
2021-10-18 21:29:41 +00:00
|
|
|
return std::make_unique<Screens::List>(0, 3, app, settingsController, applications);
|
2021-04-04 02:08:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr<Screen> Settings::CreateScreen2() {
|
|
|
|
|
2021-04-18 17:28:14 +00:00
|
|
|
std::array<Screens::List::Applications, 4> applications {{
|
2021-04-26 20:29:48 +00:00
|
|
|
{Symbols::shoe, "Steps", Apps::SettingSteps},
|
2021-07-09 15:49:35 +00:00
|
|
|
{Symbols::clock, "Set date", Apps::SettingSetDate},
|
2021-10-20 13:36:28 +00:00
|
|
|
{Symbols::clock, "Set time", Apps::SettingSetTime},
|
|
|
|
{Symbols::batteryHalf, "Battery", Apps::BatteryInfo}
|
2021-04-26 20:29:48 +00:00
|
|
|
}};
|
2021-04-04 02:08:51 +00:00
|
|
|
|
2021-07-24 12:25:27 +00:00
|
|
|
return std::make_unique<Screens::List>(1, 3, app, settingsController, applications);
|
2021-04-04 02:08:51 +00:00
|
|
|
}
|
2021-06-24 17:15:23 +00:00
|
|
|
|
|
|
|
std::unique_ptr<Screen> Settings::CreateScreen3() {
|
|
|
|
|
|
|
|
std::array<Screens::List::Applications, 4> applications {{
|
2021-04-18 17:28:14 +00:00
|
|
|
{Symbols::check, "Firmware", Apps::FirmwareValidation},
|
2021-09-02 20:20:25 +00:00
|
|
|
{Symbols::list, "About", Apps::SysInfo},
|
2021-06-24 17:15:23 +00:00
|
|
|
{Symbols::none, "None", Apps::None},
|
2021-10-18 21:14:39 +00:00
|
|
|
{Symbols::none, "None", Apps::None}
|
2021-06-24 17:15:23 +00:00
|
|
|
}};
|
2021-09-27 02:52:02 +00:00
|
|
|
if (settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::Shake)) {
|
|
|
|
applications[1] = {Symbols::list, "Shake Threshold", Apps::SettingShakeThreshold};
|
|
|
|
}
|
2021-10-18 21:29:41 +00:00
|
|
|
return std::make_unique<Screens::List>(2, 3, app, settingsController, applications);
|
2021-10-03 18:11:04 +00:00
|
|
|
}
|