diff options
author | Riku Isokoski <riksu9000@gmail.com> | 2022-06-16 22:41:54 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-16 21:41:54 +0200 |
commit | 9b775c6a91b91531edda67892b93041e5fb3f882 (patch) | |
tree | 7b2f4e4f4c1e96211de2e0eab8e9d0c1cb95bbd9 /src/displayapp/screens/ApplicationList.h | |
parent | 10ca036ffb09e1921b7ea684816b7cd9f5b0f510 (diff) |
Automatically create screens for applist and settings (#1153)
Apps and settings are now stored in a single array (two arrays in total).
Replace magic values with appsPerScreen and entriesPerScreen.
Diffstat (limited to 'src/displayapp/screens/ApplicationList.h')
-rw-r--r-- | src/displayapp/screens/ApplicationList.h | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/src/displayapp/screens/ApplicationList.h b/src/displayapp/screens/ApplicationList.h index f430a89e..14d7623c 100644 --- a/src/displayapp/screens/ApplicationList.h +++ b/src/displayapp/screens/ApplicationList.h @@ -1,5 +1,6 @@ #pragma once +#include <array> #include <memory> #include "displayapp/screens/Screen.h" @@ -7,6 +8,8 @@ #include "components/datetime/DateTimeController.h" #include "components/settings/Settings.h" #include "components/battery/BatteryController.h" +#include "displayapp/screens/Symbols.h" +#include "displayapp/screens/Tile.h" namespace Pinetime { namespace Applications { @@ -21,14 +24,34 @@ 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::Battery& batteryController; Controllers::DateTime& dateTimeController; - ScreenList<2> screens; - std::unique_ptr<Screen> CreateScreen1(); - std::unique_ptr<Screen> CreateScreen2(); - // std::unique_ptr<Screen> CreateScreen3(); + static constexpr int appsPerScreen = 6; + + // Increment this when more space is needed + static constexpr int nScreens = 2; + + static constexpr std::array<Tile::Applications, appsPerScreen * nScreens> applications {{ + {Symbols::stopWatch, Apps::StopWatch}, + {Symbols::clock, Apps::Alarm}, + {Symbols::hourGlass, Apps::Timer}, + {Symbols::shoe, Apps::Steps}, + {Symbols::heartBeat, Apps::HeartRate}, + {Symbols::music, Apps::Music}, + + {Symbols::paintbrush, Apps::Paint}, + {Symbols::paddle, Apps::Paddle}, + {"2", Apps::Twos}, + {Symbols::chartLine, Apps::Motion}, + {Symbols::drum, Apps::Metronome}, + {Symbols::map, Apps::Navigation}, + }}; + ScreenList<nScreens> screens; }; } } |