ref: e5b73212f6addcfdb5e306df63d7135e543c4f8d
src/displayapp/UserApps.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
#pragma once #include "Apps.h" #include "Controllers.h" #include "displayapp/screens/Alarm.h" #include "displayapp/screens/Timer.h" #include "displayapp/screens/Twos.h" #include "displayapp/screens/Tile.h" #include "displayapp/screens/ApplicationList.h" #include "displayapp/screens/WatchFaceDigital.h" #include "displayapp/screens/WatchFaceAnalog.h" #include "displayapp/screens/WatchFaceCasioStyleG7710.h" #include "displayapp/screens/WatchFaceInfineat.h" #include "displayapp/screens/WatchFacePineTimeStyle.h" #include "displayapp/screens/WatchFaceTerminal.h" namespace Pinetime { namespace Applications { namespace Screens { class Screen; } struct AppDescription { Apps app; const char* icon; Screens::Screen* (*create)(AppControllers& controllers); }; struct WatchFaceDescription { WatchFace watchFace; const char* name; Screens::Screen* (*create)(AppControllers& controllers); bool (*isAvailable)(Controllers::FS& fileSystem); }; template <Apps t> consteval AppDescription CreateAppDescription() { return {AppTraits<t>::app, AppTraits<t>::icon, &AppTraits<t>::Create}; } template <WatchFace t> consteval WatchFaceDescription CreateWatchFaceDescription() { return {WatchFaceTraits<t>::watchFace, WatchFaceTraits<t>::name, &WatchFaceTraits<t>::Create, &WatchFaceTraits<t>::IsAvailable}; } template <template <Apps...> typename T, Apps... ts> consteval std::array<AppDescription, sizeof...(ts)> CreateAppDescriptions(T<ts...>) { return {CreateAppDescription<ts>()...}; } template <template <WatchFace...> typename T, WatchFace... ts> consteval std::array<WatchFaceDescription, sizeof...(ts)> CreateWatchFaceDescriptions(T<ts...>) { return {CreateWatchFaceDescription<ts>()...}; } constexpr auto userApps = CreateAppDescriptions(UserAppTypes {}); constexpr auto userWatchFaces = CreateWatchFaceDescriptions(UserWatchFaceTypes {}); } } |