aboutsummaryrefslogtreecommitdiffstats
path: root/src/displayapp/screens/settings
diff options
context:
space:
mode:
Diffstat (limited to 'src/displayapp/screens/settings')
-rw-r--r--src/displayapp/screens/settings/SettingBluetooth.cpp112
-rw-r--r--src/displayapp/screens/settings/SettingBluetooth.h9
-rw-r--r--src/displayapp/screens/settings/SettingChimes.cpp98
-rw-r--r--src/displayapp/screens/settings/SettingChimes.h17
-rw-r--r--src/displayapp/screens/settings/SettingSetDate.cpp16
-rw-r--r--src/displayapp/screens/settings/SettingSetDate.h7
-rw-r--r--src/displayapp/screens/settings/SettingSetDateTime.cpp54
-rw-r--r--src/displayapp/screens/settings/SettingSetDateTime.h32
-rw-r--r--src/displayapp/screens/settings/SettingSetTime.cpp14
-rw-r--r--src/displayapp/screens/settings/SettingSetTime.h6
-rw-r--r--src/displayapp/screens/settings/SettingShakeThreshold.cpp4
-rw-r--r--src/displayapp/screens/settings/SettingShakeThreshold.h1
-rw-r--r--src/displayapp/screens/settings/SettingTimeFormat.cpp106
-rw-r--r--src/displayapp/screens/settings/SettingTimeFormat.h7
-rw-r--r--src/displayapp/screens/settings/SettingWakeUp.cpp87
-rw-r--r--src/displayapp/screens/settings/SettingWakeUp.h23
-rw-r--r--src/displayapp/screens/settings/SettingWatchFace.cpp56
-rw-r--r--src/displayapp/screens/settings/SettingWatchFace.h25
-rw-r--r--src/displayapp/screens/settings/Settings.h17
19 files changed, 340 insertions, 351 deletions
diff --git a/src/displayapp/screens/settings/SettingBluetooth.cpp b/src/displayapp/screens/settings/SettingBluetooth.cpp
index c66be3e9..fd07be88 100644
--- a/src/displayapp/screens/settings/SettingBluetooth.cpp
+++ b/src/displayapp/screens/settings/SettingBluetooth.cpp
@@ -9,84 +9,52 @@
using namespace Pinetime::Applications::Screens;
namespace {
- void OnBluetoothDisabledEvent(lv_obj_t* obj, lv_event_t event) {
- auto* screen = static_cast<SettingBluetooth*>(obj->user_data);
- screen->OnBluetoothDisabled(obj, event);
- }
+ struct Option {
+ const char* name;
+ bool radioEnabled;
+ };
- void OnBluetoothEnabledEvent(lv_obj_t* obj, lv_event_t event) {
- auto* screen = static_cast<SettingBluetooth*>(obj->user_data);
- screen->OnBluetoothEnabled(obj, event);
- }
+ constexpr std::array<Option, 2> options = {{
+ {"Enabled", true},
+ {"Disabled", false},
+ }};
+
+ std::array<CheckboxList::Item, CheckboxList::MaxItems> CreateOptionArray() {
+ std::array<Pinetime::Applications::Screens::CheckboxList::Item, CheckboxList::MaxItems> optionArray;
+ for (size_t i = 0; i < CheckboxList::MaxItems; i++) {
+ if (i >= options.size()) {
+ optionArray[i].name = "";
+ optionArray[i].enabled = false;
+ } else {
+ optionArray[i].name = options[i].name;
+ optionArray[i].enabled = true;
+ }
+ }
+ return optionArray;
+ };
}
SettingBluetooth::SettingBluetooth(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
- : Screen(app), settingsController {settingsController} {
-
- lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr);
-
- lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
- lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10);
- lv_obj_set_style_local_pad_inner(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 5);
- lv_obj_set_style_local_border_width(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 0);
-
- lv_obj_set_pos(container1, 10, 60);
- lv_obj_set_width(container1, LV_HOR_RES - 20);
- lv_obj_set_height(container1, LV_VER_RES - 50);
- lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT);
-
- lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr);
- lv_label_set_text_static(title, "Bluetooth");
- lv_label_set_align(title, LV_LABEL_ALIGN_CENTER);
- lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 15, 15);
-
- lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr);
- lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
- lv_label_set_text_static(icon, Symbols::bluetooth);
- lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER);
- lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0);
-
- cbEnabled = lv_checkbox_create(container1, nullptr);
- lv_checkbox_set_text(cbEnabled, " Enabled");
- cbEnabled->user_data = this;
- lv_obj_set_event_cb(cbEnabled, OnBluetoothEnabledEvent);
- SetRadioButtonStyle(cbEnabled);
-
- cbDisabled = lv_checkbox_create(container1, nullptr);
- lv_checkbox_set_text(cbDisabled, " Disabled");
- cbDisabled->user_data = this;
- lv_obj_set_event_cb(cbDisabled, OnBluetoothDisabledEvent);
- SetRadioButtonStyle(cbDisabled);
-
- if (settingsController.GetBleRadioEnabled()) {
- lv_checkbox_set_checked(cbEnabled, true);
- priorMode = true;
- } else {
- lv_checkbox_set_checked(cbDisabled, true);
- priorMode = false;
- }
+ : Screen(app),
+ checkboxList(
+ 0,
+ 1,
+ app,
+ "Bluetooth",
+ Symbols::bluetooth,
+ settingsController.GetBleRadioEnabled() ? 0 : 1,
+ [&settings = settingsController](uint32_t index) {
+ const bool priorMode = settings.GetBleRadioEnabled();
+ const bool newMode = options[index].radioEnabled;
+ if (newMode != priorMode) {
+ settings.SetBleRadioEnabled(newMode);
+ }
+ },
+ CreateOptionArray()) {
}
SettingBluetooth::~SettingBluetooth() {
lv_obj_clean(lv_scr_act());
- // Do not call SaveSettings - see src/components/settings/Settings.h
- if (priorMode != settingsController.GetBleRadioEnabled()) {
- app->PushMessage(Pinetime::Applications::Display::Messages::BleRadioEnableToggle);
- }
-}
-
-void SettingBluetooth::OnBluetoothDisabled(lv_obj_t* object, lv_event_t event) {
- if (event == LV_EVENT_VALUE_CHANGED) {
- lv_checkbox_set_checked(cbEnabled, false);
- lv_checkbox_set_checked(cbDisabled, true);
- settingsController.SetBleRadioEnabled(false);
- }
-}
-
-void SettingBluetooth::OnBluetoothEnabled(lv_obj_t* object, lv_event_t event) {
- if (event == LV_EVENT_VALUE_CHANGED) {
- lv_checkbox_set_checked(cbEnabled, true);
- lv_checkbox_set_checked(cbDisabled, false);
- settingsController.SetBleRadioEnabled(true);
- }
+ // Pushing the message in the OnValueChanged function causes a freeze?
+ app->PushMessage(Pinetime::Applications::Display::Messages::BleRadioEnableToggle);
}
diff --git a/src/displayapp/screens/settings/SettingBluetooth.h b/src/displayapp/screens/settings/SettingBluetooth.h
index 12bb459a..611a0d5c 100644
--- a/src/displayapp/screens/settings/SettingBluetooth.h
+++ b/src/displayapp/screens/settings/SettingBluetooth.h
@@ -6,6 +6,7 @@
#include "components/settings/Settings.h"
#include "displayapp/screens/Screen.h"
+#include "displayapp/screens/CheckboxList.h"
namespace Pinetime {
@@ -17,14 +18,8 @@ namespace Pinetime {
SettingBluetooth(DisplayApp* app, Pinetime::Controllers::Settings& settingsController);
~SettingBluetooth() override;
- void OnBluetoothEnabled(lv_obj_t* object, lv_event_t event);
- void OnBluetoothDisabled(lv_obj_t* object, lv_event_t event);
-
private:
- Controllers::Settings& settingsController;
- lv_obj_t* cbEnabled;
- lv_obj_t* cbDisabled;
- bool priorMode;
+ CheckboxList checkboxList;
};
}
}
diff --git a/src/displayapp/screens/settings/SettingChimes.cpp b/src/displayapp/screens/settings/SettingChimes.cpp
index 7f519f75..6e12fb88 100644
--- a/src/displayapp/screens/settings/SettingChimes.cpp
+++ b/src/displayapp/screens/settings/SettingChimes.cpp
@@ -4,70 +4,62 @@
#include "displayapp/screens/Styles.h"
#include "displayapp/screens/Screen.h"
#include "displayapp/screens/Symbols.h"
+#include <array>
using namespace Pinetime::Applications::Screens;
namespace {
- void event_handler(lv_obj_t* obj, lv_event_t event) {
- auto* screen = static_cast<SettingChimes*>(obj->user_data);
- screen->UpdateSelected(obj, event);
- }
-}
-
-constexpr std::array<SettingChimes::Option, 3> SettingChimes::options;
-
-SettingChimes::SettingChimes(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
- : Screen(app), settingsController {settingsController} {
-
- lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr);
+ struct Option {
+ Pinetime::Controllers::Settings::ChimesOption chimesOption;
+ const char* name;
+ };
- lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
- lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10);
- lv_obj_set_style_local_pad_inner(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 5);
- lv_obj_set_style_local_border_width(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 0);
+ constexpr std::array<Option, 3> options = {{
+ {Pinetime::Controllers::Settings::ChimesOption::None, "Off"},
+ {Pinetime::Controllers::Settings::ChimesOption::Hours, "Every hour"},
+ {Pinetime::Controllers::Settings::ChimesOption::HalfHours, "Every 30 mins"},
+ }};
- lv_obj_set_pos(container1, 10, 60);
- lv_obj_set_width(container1, LV_HOR_RES - 20);
- lv_obj_set_height(container1, LV_VER_RES - 50);
- lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT);
-
- lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr);
- lv_label_set_text_static(title, "Chimes");
- lv_label_set_align(title, LV_LABEL_ALIGN_CENTER);
- lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 10, 15);
-
- lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr);
- lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
- lv_label_set_text_static(icon, Symbols::clock);
- lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER);
- lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0);
+ std::array<CheckboxList::Item, CheckboxList::MaxItems> CreateOptionArray() {
+ std::array<Pinetime::Applications::Screens::CheckboxList::Item, CheckboxList::MaxItems> optionArray;
+ for (size_t i = 0; i < CheckboxList::MaxItems; i++) {
+ if (i >= options.size()) {
+ optionArray[i].name = "";
+ optionArray[i].enabled = false;
+ } else {
+ optionArray[i].name = options[i].name;
+ optionArray[i].enabled = true;
+ }
+ }
+ return optionArray;
+ }
- for (unsigned int i = 0; i < options.size(); i++) {
- cbOption[i] = lv_checkbox_create(container1, nullptr);
- lv_checkbox_set_text(cbOption[i], options[i].name);
- if (settingsController.GetChimeOption() == options[i].chimesOption) {
- lv_checkbox_set_checked(cbOption[i], true);
+ uint32_t GetDefaultOption(Pinetime::Controllers::Settings::ChimesOption currentOption) {
+ for (size_t i = 0; i < options.size(); i++) {
+ if (options[i].chimesOption == currentOption) {
+ return i;
+ }
}
- cbOption[i]->user_data = this;
- lv_obj_set_event_cb(cbOption[i], event_handler);
- SetRadioButtonStyle(cbOption[i]);
+ return 0;
}
}
-SettingChimes::~SettingChimes() {
- lv_obj_clean(lv_scr_act());
- settingsController.SaveSettings();
+SettingChimes::SettingChimes(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
+ : Screen(app),
+ checkboxList(
+ 0,
+ 1,
+ app,
+ "Chimes",
+ Symbols::clock,
+ GetDefaultOption(settingsController.GetChimeOption()),
+ [&settings = settingsController](uint32_t index) {
+ settings.SetChimeOption(options[index].chimesOption);
+ settings.SaveSettings();
+ },
+ CreateOptionArray()) {
}
-void SettingChimes::UpdateSelected(lv_obj_t* object, lv_event_t event) {
- if (event == LV_EVENT_VALUE_CHANGED) {
- for (uint8_t i = 0; i < options.size(); i++) {
- if (object == cbOption[i]) {
- lv_checkbox_set_checked(cbOption[i], true);
- settingsController.SetChimeOption(options[i].chimesOption);
- } else {
- lv_checkbox_set_checked(cbOption[i], false);
- }
- }
- }
+SettingChimes::~SettingChimes() {
+ lv_obj_clean(lv_scr_act());
}
diff --git a/src/displayapp/screens/settings/SettingChimes.h b/src/displayapp/screens/settings/SettingChimes.h
index e48432c6..a306e81d 100644
--- a/src/displayapp/screens/settings/SettingChimes.h
+++ b/src/displayapp/screens/settings/SettingChimes.h
@@ -2,9 +2,10 @@
#include <cstdint>
#include <lvgl/lvgl.h>
+
#include "components/settings/Settings.h"
#include "displayapp/screens/Screen.h"
-#include <array>
+#include "displayapp/screens/CheckboxList.h"
namespace Pinetime {
@@ -19,19 +20,7 @@ namespace Pinetime {
void UpdateSelected(lv_obj_t* object, lv_event_t event);
private:
- struct Option {
- Controllers::Settings::ChimesOption chimesOption;
- const char* name;
- };
- static constexpr std::array<Option, 3> options = {{
- {Controllers::Settings::ChimesOption::None, " Off"},
- {Controllers::Settings::ChimesOption::Hours, " Every hour"},
- {Controllers::Settings::ChimesOption::HalfHours, " Every 30 mins"}
- }};
-
- std::array<lv_obj_t*, options.size()> cbOption;
-
- Controllers::Settings& settingsController;
+ CheckboxList checkboxList;
};
}
}
diff --git a/src/displayapp/screens/settings/SettingSetDate.cpp b/src/displayapp/screens/settings/SettingSetDate.cpp
index 421aef02..c58f6fca 100644
--- a/src/displayapp/screens/settings/SettingSetDate.cpp
+++ b/src/displayapp/screens/settings/SettingSetDate.cpp
@@ -1,4 +1,5 @@
#include "displayapp/screens/settings/SettingSetDate.h"
+#include "displayapp/screens/settings/SettingSetDateTime.h"
#include <lvgl/lvgl.h>
#include <hal/nrf_rtc.h>
#include <nrf_log.h>
@@ -44,8 +45,11 @@ namespace {
}
}
-SettingSetDate::SettingSetDate(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::DateTime& dateTimeController)
- : Screen(app), dateTimeController {dateTimeController} {
+SettingSetDate::SettingSetDate(Pinetime::Applications::DisplayApp* app,
+ Pinetime::Controllers::DateTime& dateTimeController,
+ Pinetime::Applications::Screens::SettingSetDateTime& settingSetDateTime)
+ : Screen(app), dateTimeController {dateTimeController}, settingSetDateTime {settingSetDateTime} {
+
lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_text_static(title, "Set current date");
lv_label_set_align(title, LV_LABEL_ALIGN_CENTER);
@@ -82,8 +86,6 @@ SettingSetDate::SettingSetDate(Pinetime::Applications::DisplayApp* app, Pinetime
lblSetTime = lv_label_create(btnSetTime, nullptr);
lv_label_set_text_static(lblSetTime, "Set");
lv_obj_set_event_cb(btnSetTime, event_handler);
- lv_btn_set_state(btnSetTime, LV_BTN_STATE_DISABLED);
- lv_obj_set_state(lblSetTime, LV_STATE_DISABLED);
}
SettingSetDate::~SettingSetDate() {
@@ -98,18 +100,14 @@ void SettingSetDate::HandleButtonPress() {
dateTimeController.SetTime(yearValue,
monthValue,
dayValue,
- 0,
dateTimeController.Hours(),
dateTimeController.Minutes(),
dateTimeController.Seconds(),
nrf_rtc_counter_get(portNRF_RTC_REG));
- lv_btn_set_state(btnSetTime, LV_BTN_STATE_DISABLED);
- lv_obj_set_state(lblSetTime, LV_STATE_DISABLED);
+ settingSetDateTime.Advance();
}
void SettingSetDate::CheckDay() {
const int maxDay = MaximumDayOfMonth(monthCounter.GetValue(), yearCounter.GetValue());
dayCounter.SetMax(maxDay);
- lv_btn_set_state(btnSetTime, LV_BTN_STATE_RELEASED);
- lv_obj_set_state(lblSetTime, LV_STATE_DEFAULT);
}
diff --git a/src/displayapp/screens/settings/SettingSetDate.h b/src/displayapp/screens/settings/SettingSetDate.h
index a0ffc683..dfb0e0d2 100644
--- a/src/displayapp/screens/settings/SettingSetDate.h
+++ b/src/displayapp/screens/settings/SettingSetDate.h
@@ -5,13 +5,17 @@
#include "components/datetime/DateTimeController.h"
#include "displayapp/screens/Screen.h"
#include "displayapp/widgets/Counter.h"
+#include "displayapp/widgets/DotIndicator.h"
+#include "displayapp/screens/settings/SettingSetDateTime.h"
namespace Pinetime {
namespace Applications {
namespace Screens {
class SettingSetDate : public Screen {
public:
- SettingSetDate(DisplayApp* app, Pinetime::Controllers::DateTime& dateTimeController);
+ SettingSetDate(DisplayApp* app,
+ Pinetime::Controllers::DateTime& dateTimeController,
+ Pinetime::Applications::Screens::SettingSetDateTime& settingSetDateTime);
~SettingSetDate() override;
void HandleButtonPress();
@@ -19,6 +23,7 @@ namespace Pinetime {
private:
Controllers::DateTime& dateTimeController;
+ Pinetime::Applications::Screens::SettingSetDateTime& settingSetDateTime;
lv_obj_t* btnSetTime;
lv_obj_t* lblSetTime;
diff --git a/src/displayapp/screens/settings/SettingSetDateTime.cpp b/src/displayapp/screens/settings/SettingSetDateTime.cpp
new file mode 100644
index 00000000..905a76ab
--- /dev/null
+++ b/src/displayapp/screens/settings/SettingSetDateTime.cpp
@@ -0,0 +1,54 @@
+#include "displayapp/screens/settings/SettingSetDateTime.h"
+#include "displayapp/screens/settings/SettingSetDate.h"
+#include "displayapp/screens/settings/SettingSetTime.h"
+#include "displayapp/DisplayApp.h"
+#include "displayapp/screens/ScreenList.h"
+#include "components/settings/Settings.h"
+#include "displayapp/widgets/DotIndicator.h"
+
+using namespace Pinetime::Applications::Screens;
+
+bool SettingSetDateTime::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
+ return screens.OnTouchEvent(event);
+}
+
+SettingSetDateTime::SettingSetDateTime(Pinetime::Applications::DisplayApp* app,
+ Pinetime::Controllers::DateTime& dateTimeController,
+ Pinetime::Controllers::Settings& settingsController)
+ : Screen(app),
+ dateTimeController {dateTimeController},
+ settingsController {settingsController},
+ screens {app,
+ 0,
+ {[this]() -> std::unique_ptr<Screen> {
+ return screenSetDate();
+ },
+ [this]() -> std::unique_ptr<Screen> {
+ return screenSetTime();
+ }},
+ Screens::ScreenListModes::UpDown} {
+}
+
+std::unique_ptr<Screen> SettingSetDateTime::screenSetDate() {
+ Widgets::DotIndicator dotIndicator(0, 2);
+ dotIndicator.Create();
+ return std::make_unique<Screens::SettingSetDate>(app, dateTimeController, *this);
+}
+
+std::unique_ptr<Screen> SettingSetDateTime::screenSetTime() {
+ Widgets::DotIndicator dotIndicator(1, 2);
+ dotIndicator.Create();
+ return std::make_unique<Screens::SettingSetTime>(app, dateTimeController, settingsController, *this);
+}
+
+SettingSetDateTime::~SettingSetDateTime() {
+ lv_obj_clean(lv_scr_act());
+}
+
+void SettingSetDateTime::Advance() {
+ screens.OnTouchEvent(Pinetime::Applications::TouchEvents::SwipeUp);
+}
+
+void SettingSetDateTime::Quit() {
+ running = false;
+}
diff --git a/src/displayapp/screens/settings/SettingSetDateTime.h b/src/displayapp/screens/settings/SettingSetDateTime.h
new file mode 100644
index 00000000..dea283f8
--- /dev/null
+++ b/src/displayapp/screens/settings/SettingSetDateTime.h
@@ -0,0 +1,32 @@
+#pragma once
+
+#include <cstdint>
+#include <lvgl/lvgl.h>
+#include "displayapp/screens/Screen.h"
+#include "displayapp/screens/ScreenList.h"
+
+namespace Pinetime {
+ namespace Applications {
+ namespace Screens {
+ class SettingSetDateTime : public Screen {
+ public:
+ SettingSetDateTime(DisplayApp* app,
+ Pinetime::Controllers::DateTime& dateTimeController,
+ Pinetime::Controllers::Settings& settingsController);
+ ~SettingSetDateTime() override;
+
+ bool OnTouchEvent(TouchEvents event) override;
+ void Advance();
+ void Quit();
+
+ private:
+ Controllers::DateTime& dateTimeController;
+ Controllers::Settings& settingsController;
+
+ ScreenList<2> screens;
+ std::unique_ptr<Screen> screenSetDate();
+ std::unique_ptr<Screen> screenSetTime();
+ };
+ }
+ }
+}
diff --git a/src/displayapp/screens/settings/SettingSetTime.cpp b/src/displayapp/screens/settings/SettingSetTime.cpp
index e7d824fd..67ea7afa 100644
--- a/src/displayapp/screens/settings/SettingSetTime.cpp
+++ b/src/displayapp/screens/settings/SettingSetTime.cpp
@@ -18,6 +18,7 @@ namespace {
screen->SetTime();
}
}
+
void ValueChangedHandler(void* userData) {
auto* screen = static_cast<SettingSetTime*>(userData);
screen->UpdateScreen();
@@ -26,8 +27,9 @@ namespace {
SettingSetTime::SettingSetTime(Pinetime::Applications::DisplayApp* app,
Pinetime::Controllers::DateTime& dateTimeController,
- Pinetime::Controllers::Settings& settingsController)
- : Screen(app), dateTimeController {dateTimeController}, settingsController {settingsController} {
+ Pinetime::Controllers::Settings& settingsController,
+ Pinetime::Applications::Screens::SettingSetDateTime& settingSetDateTime)
+ : Screen(app), dateTimeController {dateTimeController}, settingsController {settingsController}, settingSetDateTime {settingSetDateTime} {
lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_text_static(title, "Set current time");
@@ -74,8 +76,6 @@ SettingSetTime::SettingSetTime(Pinetime::Applications::DisplayApp* app,
lv_obj_set_event_cb(btnSetTime, SetTimeEventHandler);
UpdateScreen();
- lv_obj_set_state(btnSetTime, LV_STATE_DISABLED);
- lv_obj_set_state(lblSetTime, LV_STATE_DISABLED);
}
SettingSetTime::~SettingSetTime() {
@@ -90,8 +90,6 @@ void SettingSetTime::UpdateScreen() {
lv_label_set_text_static(lblampm, "AM");
}
}
- lv_obj_set_state(btnSetTime, LV_STATE_DEFAULT);
- lv_obj_set_state(lblSetTime, LV_STATE_DEFAULT);
}
void SettingSetTime::SetTime() {
@@ -101,11 +99,9 @@ void SettingSetTime::SetTime() {
dateTimeController.SetTime(dateTimeController.Year(),
static_cast<uint8_t>(dateTimeController.Month()),
dateTimeController.Day(),
- static_cast<uint8_t>(dateTimeController.DayOfWeek()),
static_cast<uint8_t>(hoursValue),
static_cast<uint8_t>(minutesValue),
0,
nrf_rtc_counter_get(portNRF_RTC_REG));
- lv_obj_set_state(btnSetTime, LV_STATE_DISABLED);
- lv_obj_set_state(lblSetTime, LV_STATE_DISABLED);
+ settingSetDateTime.Quit();
}
diff --git a/src/displayapp/screens/settings/SettingSetTime.h b/src/displayapp/screens/settings/SettingSetTime.h
index b61962c1..edd89b16 100644
--- a/src/displayapp/screens/settings/SettingSetTime.h
+++ b/src/displayapp/screens/settings/SettingSetTime.h
@@ -6,6 +6,8 @@
#include "components/settings/Settings.h"
#include "displayapp/widgets/Counter.h"
#include "displayapp/screens/Screen.h"
+#include "displayapp/widgets/DotIndicator.h"
+#include "displayapp/screens/settings/SettingSetDateTime.h"
namespace Pinetime {
namespace Applications {
@@ -14,7 +16,8 @@ namespace Pinetime {
public:
SettingSetTime(DisplayApp* app,
Pinetime::Controllers::DateTime& dateTimeController,
- Pinetime::Controllers::Settings& settingsController);
+ Pinetime::Controllers::Settings& settingsController,
+ Pinetime::Applications::Screens::SettingSetDateTime& settingSetDateTime);
~SettingSetTime() override;
void SetTime();
@@ -23,6 +26,7 @@ namespace Pinetime {
private:
Controllers::DateTime& dateTimeController;
Controllers::Settings& settingsController;
+ Pinetime::Applications::Screens::SettingSetDateTime& settingSetDateTime;
lv_obj_t* lblampm;
lv_obj_t* btnSetTime;
diff --git a/src/displayapp/screens/settings/SettingShakeThreshold.cpp b/src/displayapp/screens/settings/SettingShakeThreshold.cpp
index de46f7de..e7edee9a 100644
--- a/src/displayapp/screens/settings/SettingShakeThreshold.cpp
+++ b/src/displayapp/screens/settings/SettingShakeThreshold.cpp
@@ -57,7 +57,7 @@ SettingShakeThreshold::SettingShakeThreshold(DisplayApp* app,
lv_obj_set_width(calButton, 200);
lv_obj_align(calButton, lv_scr_act(), LV_ALIGN_IN_BOTTOM_MID, 0, 0);
lv_btn_set_checkable(calButton, true);
- calLabel = lv_label_create(calButton, NULL);
+ calLabel = lv_label_create(calButton, nullptr);
lv_label_set_text_static(calLabel, "Calibrate");
lv_arc_set_value(positionArc, settingsController.GetShakeThreshold());
@@ -102,7 +102,7 @@ void SettingShakeThreshold::Refresh() {
}
if (xTaskGetTickCount() - vCalTime > pdMS_TO_TICKS(7500)) {
lv_btn_set_state(calButton, LV_STATE_DEFAULT);
- lv_event_send(calButton, LV_EVENT_VALUE_CHANGED, NULL);
+ lv_event_send(calButton, LV_EVENT_VALUE_CHANGED, nullptr);
}
}
if (motionController.currentShakeSpeed() - 300 > lv_arc_get_value(animArc)) {
diff --git a/src/displayapp/screens/settings/SettingShakeThreshold.h b/src/displayapp/screens/settings/SettingShakeThreshold.h
index 43319468..d0979fa6 100644
--- a/src/displayapp/screens/settings/SettingShakeThreshold.h
+++ b/src/displayapp/screens/settings/SettingShakeThreshold.h
@@ -6,6 +6,7 @@
#include "displayapp/screens/Screen.h"
#include <components/motion/MotionController.h>
#include "systemtask/SystemTask.h"
+
namespace Pinetime {
namespace Applications {
diff --git a/src/displayapp/screens/settings/SettingTimeFormat.cpp b/src/displayapp/screens/settings/SettingTimeFormat.cpp
index 5502794b..824a10b2 100644
--- a/src/displayapp/screens/settings/SettingTimeFormat.cpp
+++ b/src/displayapp/screens/settings/SettingTimeFormat.cpp
@@ -8,76 +8,56 @@
using namespace Pinetime::Applications::Screens;
namespace {
- void event_handler(lv_obj_t* obj, lv_event_t event) {
- auto* screen = static_cast<SettingTimeFormat*>(obj->user_data);
- screen->UpdateSelected(obj, event);
- }
-}
-
-constexpr std::array<const char*, 2> SettingTimeFormat::options;
-
-SettingTimeFormat::SettingTimeFormat(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
- : Screen(app), settingsController {settingsController} {
-
- lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr);
-
- lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
- lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10);
- lv_obj_set_style_local_pad_inner(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 5);
- lv_obj_set_style_local_border_width(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 0);
+ struct Option {
+ Pinetime::Controllers::Settings::ClockType clockType;
+ const char* name;
+ };
- lv_obj_set_pos(container1, 10, 60);
- lv_obj_set_width(container1, LV_HOR_RES - 20);
- lv_obj_set_height(container1, LV_VER_RES - 50);
- lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT);
+ constexpr std::array<Option, 2> options = {{
+ {Pinetime::Controllers::Settings::ClockType::H12, "12-hour"},
+ {Pinetime::Controllers::Settings::ClockType::H24, "24-hour"},
+ }};
- lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr);
- lv_label_set_text_static(title, "Time format");
- lv_label_set_align(title, LV_LABEL_ALIGN_CENTER);
- lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 15, 15);
-
- lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr);
- lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
- lv_label_set_text_static(icon, Symbols::clock);
- lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER);
- lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0);
-
- for (unsigned int i = 0; i < options.size(); i++) {
- cbOption[i] = lv_checkbox_create(container1, nullptr);
- lv_checkbox_set_text(cbOption[i], options[i]);
- cbOption[i]->user_data = this;
- lv_obj_set_event_cb(cbOption[i], event_handler);
- SetRadioButtonStyle(cbOption[i]);
+ std::array<CheckboxList::Item, CheckboxList::MaxItems> CreateOptionArray() {
+ std::array<Pinetime::Applications::Screens::CheckboxList::Item, CheckboxList::MaxItems> optionArray;
+ for (size_t i = 0; i < CheckboxList::MaxItems; i++) {
+ if (i >= options.size()) {
+ optionArray[i].name = "";
+ optionArray[i].enabled = false;
+ } else {
+ optionArray[i].name = options[i].name;
+ optionArray[i].enabled = true;
+ }
+ }
+ return optionArray;
}
- if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) {
- lv_checkbox_set_checked(cbOption[0], true);
- } else if (settingsController.GetClockType() == Controllers::Settings::ClockType::H24) {
- lv_checkbox_set_checked(cbOption[1], true);
+ uint32_t GetDefaultOption(Pinetime::Controllers::Settings::ClockType currentOption) {
+ for (size_t i = 0; i < options.size(); i++) {
+ if (options[i].clockType == currentOption) {
+ return i;
+ }
+ }
+ return 0;
}
}
-SettingTimeFormat::~SettingTimeFormat() {
- lv_obj_clean(lv_scr_act());
- settingsController.SaveSettings();
+SettingTimeFormat::SettingTimeFormat(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
+ : Screen(app),
+ checkboxList(
+ 0,
+ 1,
+ app,
+ "Time format",
+ Symbols::clock,
+ GetDefaultOption(settingsController.GetClockType()),
+ [&settings = settingsController](uint32_t index) {
+ settings.SetClockType(options[index].clockType);
+ settings.SaveSettings();
+ },
+ CreateOptionArray()) {
}
-void SettingTimeFormat::UpdateSelected(lv_obj_t* object, lv_event_t event) {
- if (event == LV_EVENT_VALUE_CHANGED) {
- for (unsigned int i = 0; i < options.size(); i++) {
- if (object == cbOption[i]) {
- lv_checkbox_set_checked(cbOption[i], true);
-
- if (i == 0) {
- settingsController.SetClockType(Controllers::Settings::ClockType::H12);
- };
- if (i == 1) {
- settingsController.SetClockType(Controllers::Settings::ClockType::H24);
- };
-
- } else {
- lv_checkbox_set_checked(cbOption[i], false);
- }
- }
- }
+SettingTimeFormat::~SettingTimeFormat() {
+ lv_obj_clean(lv_scr_act());
}
diff --git a/src/displayapp/screens/settings/SettingTimeFormat.h b/src/displayapp/screens/settings/SettingTimeFormat.h
index 01ca2c9b..de37f43e 100644
--- a/src/displayapp/screens/settings/SettingTimeFormat.h
+++ b/src/displayapp/screens/settings/SettingTimeFormat.h
@@ -6,6 +6,7 @@
#include "components/settings/Settings.h"
#include "displayapp/screens/Screen.h"
+#include "displayapp/screens/CheckboxList.h"
namespace Pinetime {
@@ -17,12 +18,8 @@ namespace Pinetime {
SettingTimeFormat(DisplayApp* app, Pinetime::Controllers::Settings& settingsController);
~SettingTimeFormat() override;
- void UpdateSelected(lv_obj_t* object, lv_event_t event);
-
private:
- static constexpr std::array<const char*, 2> options = {"12-hour", "24-hour"};
- Controllers::Settings& settingsController;
- lv_obj_t* cbOption[options.size()];
+ CheckboxList checkboxList;
};
}
}
diff --git a/src/displayapp/screens/settings/SettingWakeUp.cpp b/src/displayapp/screens/settings/SettingWakeUp.cpp
index 59275e2f..620fe6e8 100644
--- a/src/displayapp/screens/settings/SettingWakeUp.cpp
+++ b/src/displayapp/screens/settings/SettingWakeUp.cpp
@@ -4,19 +4,23 @@
#include "displayapp/screens/Screen.h"
#include "displayapp/screens/Symbols.h"
#include "components/settings/Settings.h"
+#include "displayapp/screens/Styles.h"
using namespace Pinetime::Applications::Screens;
+constexpr std::array<SettingWakeUp::Option, 4> SettingWakeUp::options;
+
namespace {
void event_handler(lv_obj_t* obj, lv_event_t event) {
auto* screen = static_cast<SettingWakeUp*>(obj->user_data);
- screen->UpdateSelected(obj, event);
+ if (event == LV_EVENT_VALUE_CHANGED) {
+ screen->UpdateSelected(obj);
+ }
}
}
SettingWakeUp::SettingWakeUp(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
: Screen(app), settingsController {settingsController} {
- ignoringEvents = false;
lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
@@ -40,39 +44,15 @@ SettingWakeUp::SettingWakeUp(Pinetime::Applications::DisplayApp* app, Pinetime::
lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER);
lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0);
- optionsTotal = 0;
- cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
- lv_checkbox_set_text_static(cbOption[optionsTotal], "Single Tap");
- cbOption[optionsTotal]->user_data = this;
- lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
- if (settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::SingleTap)) {
- lv_checkbox_set_checked(cbOption[optionsTotal], true);
- }
- optionsTotal++;
- cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
- lv_checkbox_set_text_static(cbOption[optionsTotal], "Double Tap");
- cbOption[optionsTotal]->user_data = this;
- lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
- if (settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::DoubleTap)) {
- lv_checkbox_set_checked(cbOption[optionsTotal], true);
- }
- optionsTotal++;
- cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
- lv_checkbox_set_text_static(cbOption[optionsTotal], "Raise Wrist");
- cbOption[optionsTotal]->user_data = this;
- lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
- if (settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist)) {
- lv_checkbox_set_checked(cbOption[optionsTotal], true);
- }
- optionsTotal++;
- cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
- lv_checkbox_set_text_static(cbOption[optionsTotal], "Shake Wake");
- cbOption[optionsTotal]->user_data = this;
- lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
- if (settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::Shake)) {
- lv_checkbox_set_checked(cbOption[optionsTotal], true);
+ for (unsigned int i = 0; i < options.size(); i++) {
+ cbOption[i] = lv_checkbox_create(container1, nullptr);
+ lv_checkbox_set_text(cbOption[i], options[i].name);
+ if (settingsController.isWakeUpModeOn(static_cast<Controllers::Settings::WakeUpMode>(i))) {
+ lv_checkbox_set_checked(cbOption[i], true);
+ }
+ cbOption[i]->user_data = this;
+ lv_obj_set_event_cb(cbOption[i], event_handler);
}
- optionsTotal++;
}
SettingWakeUp::~SettingWakeUp() {
@@ -80,32 +60,21 @@ SettingWakeUp::~SettingWakeUp() {
settingsController.SaveSettings();
}
-void SettingWakeUp::UpdateSelected(lv_obj_t* object, lv_event_t event) {
- using WakeUpMode = Pinetime::Controllers::Settings::WakeUpMode;
- if (event == LV_EVENT_VALUE_CHANGED && !ignoringEvents) {
- ignoringEvents = true;
-
- // Find the index of the checkbox that triggered the event
- int index = 0;
- for (; index < optionsTotal; ++index) {
- if (cbOption[index] == object) {
- break;
- }
- }
-
- // Toggle needed wakeup mode
- auto mode = static_cast<WakeUpMode>(index);
- auto currentState = settingsController.isWakeUpModeOn(mode);
- settingsController.setWakeUpMode(mode, !currentState);
-
- // Update checkbox according to current wakeup modes.
- // This is needed because we can have extra logic when setting or unsetting wakeup modes,
- // for example, when setting SingleTap, DoubleTap is unset and vice versa.
- auto modes = settingsController.getWakeUpModes();
- for (int i = 0; i < optionsTotal; ++i) {
- lv_checkbox_set_checked(cbOption[i], modes[i]);
+void SettingWakeUp::UpdateSelected(lv_obj_t* object) {
+ // Find the index of the checkbox that triggered the event
+ for (size_t i = 0; i < options.size(); i++) {
+ if (cbOption[i] == object) {
+ bool currentState = settingsController.isWakeUpModeOn(options[i].wakeUpMode);
+ settingsController.setWakeUpMode(options[i].wakeUpMode, !currentState);
+ break;
}
+ }
- ignoringEvents = false;
+ // Update checkbox according to current wakeup modes.
+ // This is needed because we can have extra logic when setting or unsetting wakeup modes,
+ // for example, when setting SingleTap, DoubleTap is unset and vice versa.
+ auto modes = settingsController.getWakeUpModes();
+ for (size_t i = 0; i < options.size(); ++i) {
+ lv_checkbox_set_checked(cbOption[i], modes[i]);
}
}
diff --git a/src/displayapp/screens/settings/SettingWakeUp.h b/src/displayapp/screens/settings/SettingWakeUp.h
index cd244ae5..2a4e7509 100644
--- a/src/displayapp/screens/settings/SettingWakeUp.h
+++ b/src/displayapp/screens/settings/SettingWakeUp.h
@@ -1,5 +1,6 @@
#pragma once
+#include <array>
#include <cstdint>
#include <lvgl/lvgl.h>
#include "components/settings/Settings.h"
@@ -15,17 +16,23 @@ namespace Pinetime {
SettingWakeUp(DisplayApp* app, Pinetime::Controllers::Settings& settingsController);
~SettingWakeUp() override;
- void UpdateSelected(lv_obj_t* object, lv_event_t event);
+ void UpdateSelected(lv_obj_t* object);
private:
+ struct Option {
+ Controllers::Settings::WakeUpMode wakeUpMode;
+ const char* name;
+ };
+
Controllers::Settings& settingsController;
- uint8_t optionsTotal;
- lv_obj_t* cbOption[5];
- // When UpdateSelected is called, it uses lv_checkbox_set_checked,
- // which can cause extra events to be fired,
- // which might trigger UpdateSelected again, causing a loop.
- // This variable is used as a mutex to prevent that.
- bool ignoringEvents;
+ static constexpr std::array<Option, 4> options = {{
+ {Controllers::Settings::WakeUpMode::SingleTap, "Single Tap"},
+ {Controllers::Settings::WakeUpMode::DoubleTap, "Double Tap"},
+ {Controllers::Settings::WakeUpMode::RaiseWrist, "Raise Wrist"},
+ {Controllers::Settings::WakeUpMode::Shake, "Shake Wake"},
+ }};
+
+ lv_obj_t* cbOption[options.size()];
};
}
}
diff --git a/src/displayapp/screens/settings/SettingWatchFace.cpp b/src/displayapp/screens/settings/SettingWatchFace.cpp
index 217f97b8..da32b5ee 100644
--- a/src/displayapp/screens/settings/SettingWatchFace.cpp
+++ b/src/displayapp/screens/settings/SettingWatchFace.cpp
@@ -1,32 +1,31 @@
#include "displayapp/screens/settings/SettingWatchFace.h"
#include <lvgl/lvgl.h>
#include "displayapp/DisplayApp.h"
-#include "displayapp/screens/CheckboxList.h"
#include "displayapp/screens/Screen.h"
#include "components/settings/Settings.h"
-#include "displayapp/screens/WatchFaceInfineat.h"
-#include "displayapp/screens/WatchFaceCasioStyleG7710.h"
using namespace Pinetime::Applications::Screens;
constexpr const char* SettingWatchFace::title;
constexpr const char* SettingWatchFace::symbol;
+auto SettingWatchFace::CreateScreenList() const {
+ std::array<std::function<std::unique_ptr<Screen>()>, nScreens> screens;
+ for (size_t i = 0; i < screens.size(); i++) {
+ screens[i] = [this, i]() -> std::unique_ptr<Screen> {
+ return CreateScreen(i);
+ };
+ }
+ return screens;
+}
+
SettingWatchFace::SettingWatchFace(Pinetime::Applications::DisplayApp* app,
Pinetime::Controllers::Settings& settingsController,
Pinetime::Controllers::FS& filesystem)
: Screen(app),
settingsController {settingsController},
filesystem {filesystem},
- screens {app,
- 0,
- {[this]() -> std::unique_ptr<Screen> {
- return CreateScreen1();
- },
- [this]() -> std::unique_ptr<Screen> {
- return CreateScreen2();
- }},
- Screens::ScreenListModes::UpDown} {
+ screens {app, 0, CreateScreenList(), Screens::ScreenListModes::UpDown} {
}
SettingWatchFace::~SettingWatchFace() {
@@ -37,32 +36,15 @@ bool SettingWatchFace::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
return screens.OnTouchEvent(event);
}
-std::unique_ptr<Screen> SettingWatchFace::CreateScreen1() {
- std::array<Screens::CheckboxList::Item, 4> watchfaces {
- {{"Digital face", true}, {"Analog face", true}, {"PineTimeStyle", true}, {"Terminal", true}}};
- return std::make_unique<Screens::CheckboxList>(
- 0,
- 2,
- app,
- title,
- symbol,
- settingsController.GetClockFace(),
- [&settings = settingsController](uint32_t clockFace) {
- settings.SetClockFace(clockFace);
- settings.SaveSettings();
- },
- watchfaces);
-}
+std::unique_ptr<Screen> SettingWatchFace::CreateScreen(unsigned int screenNum) const {
+ std::array<Screens::CheckboxList::Item, settingsPerScreen> watchfacesOnThisScreen;
+ for (int i = 0; i < settingsPerScreen; i++) {
+ watchfacesOnThisScreen[i] = watchfaces[screenNum * settingsPerScreen + i];
+ }
-std::unique_ptr<Screen> SettingWatchFace::CreateScreen2() {
- std::array<Screens::CheckboxList::Item, 4> watchfaces {
- {{"Infineat face", Applications::Screens::WatchFaceInfineat::IsAvailable(filesystem)},
- {"Casio G7710", Applications::Screens::WatchFaceCasioStyleG7710::IsAvailable(filesystem)},
- {"", false},
- {"", false}}};
return std::make_unique<Screens::CheckboxList>(
- 1,
- 2,
+ screenNum,
+ nScreens,
app,
title,
symbol,
@@ -71,5 +53,5 @@ std::unique_ptr<Screen> SettingWatchFace::CreateScreen2() {
settings.SetClockFace(clockFace);
settings.SaveSettings();
},
- watchfaces);
+ watchfacesOnThisScreen);
}
diff --git a/src/displayapp/screens/settings/SettingWatchFace.h b/src/displayapp/screens/settings/SettingWatchFace.h
index 158397f8..7b8cdcdc 100644
--- a/src/displayapp/screens/settings/SettingWatchFace.h
+++ b/src/displayapp/screens/settings/SettingWatchFace.h
@@ -8,6 +8,9 @@
#include "components/settings/Settings.h"
#include "displayapp/screens/Screen.h"
#include "displayapp/screens/Symbols.h"
+#include "displayapp/screens/CheckboxList.h"
+#include "displayapp/screens/WatchFaceInfineat.h"
+#include "displayapp/screens/WatchFaceCasioStyleG7710.h"
namespace Pinetime {
@@ -22,14 +25,30 @@ namespace Pinetime {
bool OnTouchEvent(TouchEvents event) override;
private:
+ auto CreateScreenList() const;
+ std::unique_ptr<Screen> CreateScreen(unsigned int screenNum) const;
+
Controllers::Settings& settingsController;
Pinetime::Controllers::FS& filesystem;
- ScreenList<2> screens;
static constexpr const char* title = "Watch face";
static constexpr const char* symbol = Symbols::home;
- std::unique_ptr<Screen> CreateScreen1();
- std::unique_ptr<Screen> CreateScreen2();
+
+ static constexpr int settingsPerScreen = 4;
+
+ // Increment this when more space is needed
+ static constexpr int nScreens = 2;
+
+ std::array<Screens::CheckboxList::Item, settingsPerScreen * nScreens> watchfaces {
+ {{"Digital face", true},
+ {"Analog face", true},
+ {"PineTimeStyle", true},
+ {"Terminal", true},
+ {"Infineat face", Applications::Screens::WatchFaceInfineat::IsAvailable(filesystem)},
+ {"Casio G7710", Applications::Screens::WatchFaceCasioStyleG7710::IsAvailable(filesystem)},
+ {"", false},
+ {"", false}}};
+ ScreenList<nScreens> screens;
};
}
}
diff --git a/src/displayapp/screens/settings/Settings.h b/src/displayapp/screens/settings/Settings.h
index a86db44f..b88c13b7 100644
--- a/src/displayapp/screens/settings/Settings.h
+++ b/src/displayapp/screens/settings/Settings.h
@@ -28,7 +28,7 @@ namespace Pinetime {
static constexpr int entriesPerScreen = 4;
// Increment this when more space is needed
- static constexpr int nScreens = 4;
+ static constexpr int nScreens = 3;
static constexpr std::array<List::Applications, entriesPerScreen * nScreens> entries {{
{Symbols::sun, "Display", Apps::SettingDisplay},
@@ -37,19 +37,20 @@ namespace Pinetime {
{Symbols::home, "Watch face", Apps::SettingWatchFace},
{Symbols::shoe, "Steps", Apps::SettingSteps},
- {Symbols::clock, "Set date", Apps::SettingSetDate},
- {Symbols::clock, "Set time", Apps::SettingSetTime},
+ {Symbols::clock, "Date&Time", Apps::SettingSetDateTime},
{Symbols::batteryHalf, "Battery", Apps::BatteryInfo},
-
{Symbols::clock, "Chimes", Apps::SettingChimes},
+
{Symbols::tachometer, "Shake Calib.", Apps::SettingShakeThreshold},
{Symbols::check, "Firmware", Apps::FirmwareValidation},
{Symbols::bluetooth, "Bluetooth", Apps::SettingBluetooth},
-
{Symbols::list, "About", Apps::SysInfo},
- {Symbols::none, "None", Apps::None},
- {Symbols::none, "None", Apps::None},
- {Symbols::none, "None", Apps::None},
+
+ // {Symbols::none, "None", Apps::None},
+ // {Symbols::none, "None", Apps::None},
+ // {Symbols::none, "None", Apps::None},
+ // {Symbols::none, "None", Apps::None},
+
}};
ScreenList<nScreens> screens;
};