ref: 0ce98c7ac7ba66acaf504be9bb042796e12f2733
src/displayapp/screens/settings/Settings.cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
#include "Settings.h" #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; 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(); }}, Screens::ScreenListModes::UpDown} { } Settings::~Settings() { lv_obj_clean(lv_scr_act()); } bool Settings::Refresh() { if (running) running = screens.Refresh(); return running; } bool Settings::OnTouchEvent(Pinetime::Applications::TouchEvents event) { return screens.OnTouchEvent(event); } std::unique_ptr<Screen> Settings::CreateScreen1() { std::array<Screens::List::Applications, 4> applications {{ {Symbols::sun, "Display", Apps::SettingDisplay}, {Symbols::clock, "Wake Up", Apps::SettingWakeUp}, {Symbols::clock, "Time format", Apps::SettingTimeFormat}, {Symbols::clock, "Watch face", Apps::SettingWatchFace}, }}; return std::make_unique<Screens::List>(0, 2, app, settingsController, applications); } std::unique_ptr<Screen> Settings::CreateScreen2() { std::array<Screens::List::Applications, 4> applications {{ {Symbols::shoe, "Steps", Apps::SettingSteps}, {Symbols::batteryHalf, "Battery", Apps::BatteryInfo}, {Symbols::check, "Firmware", Apps::FirmwareValidation}, {Symbols::list, "About", Apps::SysInfo}, }}; return std::make_unique<Screens::List>(1, 2, app, settingsController, applications); } |