summaryrefslogtreecommitdiff
path: root/src/displayapp/screens/settings/Settings.cpp
diff options
context:
space:
mode:
authorJoaquim <joaquim.org@gmail.com>2021-04-04 02:08:51 (GMT)
committerJoaquim <joaquim.org@gmail.com>2021-04-04 02:08:51 (GMT)
commit1d3742e14f09316a1d795527713eb8f9742f0ffb (patch)
tree6bc6343538506b68256aa057121e063d22f8ed1a /src/displayapp/screens/settings/Settings.cpp
parent58a2d000c4d49d96121894d6dd6bb861d7564bea (diff)
Big UI and navigation Rewrite
new navigation add some color to the apps redesign menus new settings menu new quick settings code clean up size reduction by converting navigation images to font and more...
Diffstat (limited to 'src/displayapp/screens/settings/Settings.cpp')
-rw-r--r--src/displayapp/screens/settings/Settings.cpp69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/displayapp/screens/settings/Settings.cpp b/src/displayapp/screens/settings/Settings.cpp
new file mode 100644
index 0000000..b282591
--- /dev/null
+++ b/src/displayapp/screens/settings/Settings.cpp
@@ -0,0 +1,69 @@
+#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::unique_ptr<Screen>(new Screens::List(0, 2, app, settingsController, applications));
+}
+
+
+std::unique_ptr<Screen> Settings::CreateScreen2() {
+
+ std::array<Screens::List::Applications, 4> applications {
+ {
+ {Symbols::batteryHalf, "Battery", Apps::BatteryInfo},
+ {Symbols::check, "Firmware", Apps::FirmwareValidation},
+ {Symbols::list, "About", Apps::SysInfo},
+ {"", "", Apps::None},
+ }
+
+ };
+
+ return std::unique_ptr<Screen>(new Screens::List(1, 2, app, settingsController, applications));
+}