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-06-24 17:15:23 +00:00
|
|
|
},
|
|
|
|
[this]() -> std::unique_ptr<Screen> {
|
|
|
|
return CreateScreen3();
|
2022-02-20 14:40:49 +00:00
|
|
|
},
|
|
|
|
[this]() -> std::unique_ptr<Screen> {
|
|
|
|
return CreateScreen4();
|
|
|
|
},
|
|
|
|
},
|
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
|
|
|
|
2022-02-20 14:40:49 +00:00
|
|
|
return std::make_unique<Screens::List>(0, 4, app, settingsController, applications);
|
2021-04-04 02:08:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr<Screen> Settings::CreateScreen2() {
|
2022-02-20 14:40:49 +00:00
|
|
|
std::array<Screens::List::Applications, 4> applications {{
|
|
|
|
{Symbols::shoe, "Steps", Apps::SettingSteps},
|
|
|
|
{Symbols::clock, "Set date", Apps::SettingSetDate},
|
|
|
|
{Symbols::clock, "Set time", Apps::SettingSetTime},
|
|
|
|
{Symbols::batteryHalf, "Battery", Apps::BatteryInfo}}};
|
2021-04-04 02:08:51 +00:00
|
|
|
|
2022-02-20 14:40:49 +00:00
|
|
|
return std::make_unique<Screens::List>(1, 4, 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-11-07 10:50:33 +00:00
|
|
|
{Symbols::clock, "Chimes", Apps::SettingChimes},
|
2022-01-06 13:21:05 +00:00
|
|
|
{Symbols::tachometer, "Shake Calib.", Apps::SettingShakeThreshold},
|
2021-07-09 15:49:35 +00:00
|
|
|
{Symbols::check, "Firmware", Apps::FirmwareValidation},
|
2022-02-22 16:37:28 +00:00
|
|
|
{Symbols::airplane, "Airplane mode", Apps::SettingAirplaneMode}
|
2022-02-20 14:40:49 +00:00
|
|
|
}};
|
|
|
|
|
|
|
|
return std::make_unique<Screens::List>(2, 4, app, settingsController, applications);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr<Screen> Settings::CreateScreen4() {
|
|
|
|
|
|
|
|
std::array<Screens::List::Applications, 4> applications {{
|
|
|
|
{Symbols::list, "About", Apps::SysInfo},
|
|
|
|
{Symbols::none, "None", Apps::None},
|
|
|
|
{Symbols::none, "None", Apps::None},
|
|
|
|
{Symbols::none, "None", Apps::None}
|
2021-06-24 17:15:23 +00:00
|
|
|
}};
|
|
|
|
|
2022-02-20 14:40:49 +00:00
|
|
|
return std::make_unique<Screens::List>(3, 4, app, settingsController, applications);
|
2021-04-04 02:08:51 +00:00
|
|
|
}
|