diff options
Diffstat (limited to 'src/displayapp/screens/ApplicationList.h')
| -rw-r--r-- | src/displayapp/screens/ApplicationList.h | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/src/displayapp/screens/ApplicationList.h b/src/displayapp/screens/ApplicationList.h index 3ff71b8..5517ed5 100644 --- a/src/displayapp/screens/ApplicationList.h +++ b/src/displayapp/screens/ApplicationList.h @@ -31,22 +31,37 @@ namespace Pinetime { Controllers::DateTime& dateTimeController; static constexpr int appsPerScreen = 6; - static constexpr std::array<Tile::Applications, appsPerScreen * 2> applications {{ - {Symbols::stopWatch, Apps::StopWatch}, - {Symbols::music, Apps::Music}, - {Symbols::shoe, Apps::Steps}, - {Symbols::heartBeat, Apps::HeartRate}, - {Symbols::hourGlass, Apps::Timer}, - {Symbols::clock, Apps::Alarm}, + static constexpr auto applications{[]() constexpr{ + constexpr Tile::Applications list[] = { + {Symbols::stopWatch, Apps::StopWatch}, + {Symbols::music, Apps::Music}, + {Symbols::shoe, Apps::Steps}, + {Symbols::heartBeat, Apps::HeartRate}, + {Symbols::hourGlass, Apps::Timer}, + {Symbols::clock, Apps::Alarm}, - {Symbols::chartLine, Apps::Jumpscore}, - {Symbols::map, Apps::Navigation}, - {Symbols::drum, Apps::Metronome}, - {Symbols::paintbrush, Apps::Paint}, - {Symbols::paddle, Apps::Paddle}, - {"2", Apps::Twos}, - }}; - static constexpr int nScreens = (applications.size() + appsPerScreen - 1) / appsPerScreen; + {Symbols::chartLine, Apps::Jumpscore}, + {Symbols::map, Apps::Navigation}, + {Symbols::drum, Apps::Metronome}, + {Symbols::paintbrush, Apps::Paint}, + {Symbols::paddle, Apps::Paddle}, + {"2", Apps::Twos} + }; + std::array<std::array<Tile::Applications, appsPerScreen>, ((std::size(list) + appsPerScreen - 1) / appsPerScreen)> r{};; + int idx = 0; + for (auto& f : r) { + for (auto& e : f) { + if (idx < std::size(list)) { + e = list[idx]; + } else { + e = { Symbols::none, Apps::None }; + } + idx++; + } + } + return r; + }()}; + static constexpr auto nScreens = std::size(applications); ScreenList<nScreens> screens; }; } |
