aboutsummaryrefslogtreecommitdiffstats
path: root/src/displayapp/screens/settings/SettingWatchFace.cpp
diff options
context:
space:
mode:
authorJean-François Milants <jf@codingfield.com>2022-10-02 21:05:15 +0200
committerJF <JF002@users.noreply.github.com>2022-10-11 21:16:33 +0200
commitcf8b422899f198ae713b5a2a35e2ea737521b053 (patch)
tree1caa9fe156d30935483b375a24dbbf3b8e1b87ec /src/displayapp/screens/settings/SettingWatchFace.cpp
parent6dd67eb5a2159089484c12dece8345642b4812f3 (diff)
Checkbox list now receives a function pointer to call when the setting has changed. This allow to remove the dependency between CheckBoxList (UI component) with SettingController.
Diffstat (limited to 'src/displayapp/screens/settings/SettingWatchFace.cpp')
-rw-r--r--src/displayapp/screens/settings/SettingWatchFace.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/displayapp/screens/settings/SettingWatchFace.cpp b/src/displayapp/screens/settings/SettingWatchFace.cpp
index 411cc898..ce1efaa2 100644
--- a/src/displayapp/screens/settings/SettingWatchFace.cpp
+++ b/src/displayapp/screens/settings/SettingWatchFace.cpp
@@ -3,8 +3,6 @@
#include "displayapp/DisplayApp.h"
#include "displayapp/screens/CheckboxList.h"
#include "displayapp/screens/Screen.h"
-#include "displayapp/screens/Styles.h"
-#include "displayapp/screens/Symbols.h"
#include "components/settings/Settings.h"
using namespace Pinetime::Applications::Screens;
@@ -16,7 +14,7 @@ SettingWatchFace::SettingWatchFace(Pinetime::Applications::DisplayApp* app, Pine
: Screen(app),
settingsController {settingsController},
screens {app,
- settingsController.GetWatchfacesMenu(),
+ 0,
{[this]() -> std::unique_ptr<Screen> {
return CreateScreen1();
},
@@ -28,7 +26,6 @@ SettingWatchFace::SettingWatchFace(Pinetime::Applications::DisplayApp* app, Pine
SettingWatchFace::~SettingWatchFace() {
lv_obj_clean(lv_scr_act());
- settingsController.SaveSettings();
}
bool SettingWatchFace::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
@@ -40,11 +37,13 @@ std::unique_ptr<Screen> SettingWatchFace::CreateScreen1() {
return std::make_unique<Screens::CheckboxList>(0,
2,
app,
- settingsController,
title,
symbol,
- &Controllers::Settings::SetClockFace,
- &Controllers::Settings::GetClockFace,
+ settingsController.GetClockFace(),
+ [&settings = settingsController](uint32_t clockFace) {
+ settings.SetClockFace(clockFace);
+ settings.SaveSettings();
+ },
watchfaces);
}
@@ -53,10 +52,12 @@ std::unique_ptr<Screen> SettingWatchFace::CreateScreen2() {
return std::make_unique<Screens::CheckboxList>(1,
2,
app,
- settingsController,
title,
symbol,
- &Controllers::Settings::SetClockFace,
- &Controllers::Settings::GetClockFace,
+ settingsController.GetClockFace(),
+ [&settings = settingsController](uint32_t clockFace) {
+ settings.SetClockFace(clockFace);
+ settings.SaveSettings();
+ },
watchfaces);
}