diff options
| author | Jean-François Milants <jf@codingfield.com> | 2023-12-10 18:35:19 +0100 |
|---|---|---|
| committer | JF <JF002@users.noreply.github.com> | 2023-12-21 20:49:22 +0100 |
| commit | 39bc166e549e8ccae75468aa2dd3613d51f54e27 (patch) | |
| tree | f4f995bf75e1a8e6bd9db9d1e84b225f3c53d686 /src/displayapp/screens/settings/SettingWatchFace.h | |
| parent | a544da9ed174bc184176ae50bedda5dd51c06021 (diff) | |
Watch face selection at build time
Watch faces can now be selected at buid time. It's implemented in a similar way than the selection of user apps, using a list of watch face description that is generated at build time (consteval, constexpr)
Diffstat (limited to 'src/displayapp/screens/settings/SettingWatchFace.h')
| -rw-r--r-- | src/displayapp/screens/settings/SettingWatchFace.h | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/src/displayapp/screens/settings/SettingWatchFace.h b/src/displayapp/screens/settings/SettingWatchFace.h index 45a50e3d..66559c73 100644 --- a/src/displayapp/screens/settings/SettingWatchFace.h +++ b/src/displayapp/screens/settings/SettingWatchFace.h @@ -19,7 +19,10 @@ namespace Pinetime { class SettingWatchFace : public Screen { public: - SettingWatchFace(DisplayApp* app, Pinetime::Controllers::Settings& settingsController, Pinetime::Controllers::FS& filesystem); + SettingWatchFace(DisplayApp* app, + std::array<Screens::CheckboxList::Item, UserWatchFaceTypes::Count>&& watchfaceItems, + Pinetime::Controllers::Settings& settingsController, + Pinetime::Controllers::FS& filesystem); ~SettingWatchFace() override; bool OnTouchEvent(TouchEvents event) override; @@ -29,26 +32,16 @@ namespace Pinetime { auto CreateScreenList() const; std::unique_ptr<Screen> CreateScreen(unsigned int screenNum) const; + static constexpr int settingsPerScreen = 4; + std::array<Screens::CheckboxList::Item, UserWatchFaceTypes::Count> watchfaceItems; + static constexpr int nScreens = UserWatchFaceTypes::Count > 0 ? (UserWatchFaceTypes ::Count - 1) / settingsPerScreen + 1 : 1; + Controllers::Settings& settingsController; Pinetime::Controllers::FS& filesystem; static constexpr const char* title = "Watch face"; static constexpr const char* symbol = Symbols::home; - 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; }; } |
