diff options
Diffstat (limited to 'src/components/settings')
| -rw-r--r-- | src/components/settings/Settings.h | 69 |
1 files changed, 54 insertions, 15 deletions
diff --git a/src/components/settings/Settings.h b/src/components/settings/Settings.h index d1e71656..602de3a5 100644 --- a/src/components/settings/Settings.h +++ b/src/components/settings/Settings.h @@ -3,20 +3,17 @@ #include <bitset> #include "components/brightness/BrightnessController.h" #include "components/fs/FS.h" +#include "displayapp/apps/Apps.h" namespace Pinetime { namespace Controllers { class Settings { public: enum class ClockType : uint8_t { H24, H12 }; + enum class WeatherFormat : uint8_t { Metric, Imperial }; enum class Notification : uint8_t { On, Off, Sleep }; enum class ChimesOption : uint8_t { None, Hours, HalfHours }; - enum class WakeUpMode : uint8_t { - SingleTap = 0, - DoubleTap = 1, - RaiseWrist = 2, - Shake = 3, - }; + enum class WakeUpMode : uint8_t { SingleTap = 0, DoubleTap = 1, RaiseWrist = 2, Shake = 3, LowerWrist = 4 }; enum class Colors : uint8_t { White, Silver, @@ -38,12 +35,14 @@ namespace Pinetime { Pink }; enum class PTSGaugeStyle : uint8_t { Full, Half, Numeric }; + enum class PTSWeather : uint8_t { On, Off }; struct PineTimeStyle { Colors ColorTime = Colors::Teal; Colors ColorBar = Colors::Teal; Colors ColorBG = Colors::Black; PTSGaugeStyle gaugeStyle = PTSGaugeStyle::Full; + PTSWeather weatherEnable = PTSWeather::Off; }; struct WatchFaceInfineat { @@ -61,15 +60,15 @@ namespace Pinetime { void Init(); void SaveSettings(); - void SetClockFace(uint8_t face) { - if (face != settings.clockFace) { + void SetWatchFace(Pinetime::Applications::WatchFace face) { + if (face != settings.watchFace) { settingsChanged = true; } - settings.clockFace = face; + settings.watchFace = face; }; - uint8_t GetClockFace() const { - return settings.clockFace; + Pinetime::Applications::WatchFace GetWatchFace() const { + return settings.watchFace; }; void SetChimeOption(ChimesOption chimeOption) { @@ -145,6 +144,16 @@ namespace Pinetime { return settings.PTS.gaugeStyle; }; + void SetPTSWeather(PTSWeather weatherEnable) { + if (weatherEnable != settings.PTS.weatherEnable) + settingsChanged = true; + settings.PTS.weatherEnable = weatherEnable; + }; + + PTSWeather GetPTSWeather() const { + return settings.PTS.weatherEnable; + }; + void SetAppMenu(uint8_t menu) { appMenu = menu; }; @@ -172,6 +181,17 @@ namespace Pinetime { return settings.clockType; }; + void SetWeatherFormat(WeatherFormat weatherFormat) { + if (weatherFormat != settings.weatherFormat) { + settingsChanged = true; + } + settings.weatherFormat = weatherFormat; + }; + + WeatherFormat GetWeatherFormat() const { + return settings.weatherFormat; + }; + void SetNotificationStatus(Notification status) { if (status != settings.notificationStatus) { settingsChanged = true; @@ -194,6 +214,21 @@ namespace Pinetime { return settings.screenTimeOut; }; + bool GetAlwaysOnDisplay() const { + return settings.alwaysOnDisplay && GetNotificationStatus() != Notification::Sleep; + }; + + void SetAlwaysOnDisplaySetting(bool state) { + if (state != settings.alwaysOnDisplay) { + settingsChanged = true; + } + settings.alwaysOnDisplay = state; + } + + bool GetAlwaysOnDisplaySetting() const { + return settings.alwaysOnDisplay; + } + void SetShakeThreshold(uint16_t thresh) { if (settings.shakeWakeThreshold != thresh) { settings.shakeWakeThreshold = thresh; @@ -225,7 +260,7 @@ namespace Pinetime { } }; - std::bitset<4> getWakeUpModes() const { + std::bitset<5> getWakeUpModes() const { return settings.wakeUpMode; } @@ -266,25 +301,29 @@ namespace Pinetime { private: Pinetime::Controllers::FS& fs; - static constexpr uint32_t settingsVersion = 0x0004; + static constexpr uint32_t settingsVersion = 0x0008; struct SettingsData { uint32_t version = settingsVersion; uint32_t stepsGoal = 10000; uint32_t screenTimeOut = 15000; + bool alwaysOnDisplay = false; + ClockType clockType = ClockType::H24; + WeatherFormat weatherFormat = WeatherFormat::Metric; Notification notificationStatus = Notification::On; - uint8_t clockFace = 0; + Pinetime::Applications::WatchFace watchFace = Pinetime::Applications::WatchFace::Digital; ChimesOption chimesOption = ChimesOption::None; PineTimeStyle PTS; WatchFaceInfineat watchFaceInfineat; - std::bitset<4> wakeUpMode {0}; + std::bitset<5> wakeUpMode {0}; uint16_t shakeWakeThreshold = 150; + Controllers::BrightnessController::Levels brightLevel = Controllers::BrightnessController::Levels::Medium; }; |
