Code cleaning : Split displayapp/apps/Apps.h.in into 2 files : Apps.h and WatchFaces.h

This commit is contained in:
Jean-François Milants 2024-02-25 16:11:30 +01:00
parent 73b22aaaa4
commit 45f0d9880c
9 changed files with 37 additions and 24 deletions

View File

@ -4,6 +4,7 @@
#include "components/brightness/BrightnessController.h"
#include "components/fs/FS.h"
#include "displayapp/apps/Apps.h"
#include "displayapp/apps/WatchFaces.h"
namespace Pinetime {
namespace Controllers {

View File

@ -45,35 +45,14 @@ namespace Pinetime {
Error
};
enum class WatchFace : uint8_t {
Digital,
Analog,
PineTimeStyle,
Terminal,
Infineat,
CasioStyleG7710,
};
template <Apps>
struct AppTraits {};
template <WatchFace>
struct WatchFaceTraits {};
template <Apps... As>
struct TypeList {
static constexpr size_t Count = sizeof...(As);
};
using UserAppTypes = TypeList<@USERAPP_TYPES@>;
template <WatchFace... Ws>
struct WatchFaceTypeList {
static constexpr size_t Count = sizeof...(Ws);
};
using UserWatchFaceTypes = WatchFaceTypeList<@WATCHFACE_TYPES@>;
static_assert(UserWatchFaceTypes::Count >= 1);
}
}

View File

@ -36,3 +36,4 @@ target_include_directories(infinitime_apps INTERFACE "${CMAKE_CURRENT_BINARY_DIR
# Generate the list of user apps to be compiled into the firmware
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Apps.h.in ${CMAKE_CURRENT_BINARY_DIR}/Apps.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/WatchFaces.h.in ${CMAKE_CURRENT_BINARY_DIR}/WatchFaces.h)

View File

@ -0,0 +1,28 @@
#pragma once
#include <cstddef>
#include <cstdint>
namespace Pinetime {
namespace Applications {
enum class WatchFace : uint8_t {
Digital,
Analog,
PineTimeStyle,
Terminal,
Infineat,
CasioStyleG7710,
};
template <WatchFace T>
struct WatchFaceTraits {};
template <WatchFace... Ws>
struct WatchFaceTypeList {
static constexpr size_t Count = sizeof...(Ws);
};
using UserWatchFaceTypes = WatchFaceTypeList<@WATCHFACE_TYPES@>;
static_assert(UserWatchFaceTypes::Count >= 1);
}
}

View File

@ -11,6 +11,8 @@
#include "components/ble/NotificationManager.h"
#include "displayapp/screens/BatteryIcon.h"
#include "utility/DirtyValue.h"
#include "displayapp/apps/WatchFaces.h"
namespace Pinetime {
namespace Controllers {

View File

@ -10,7 +10,7 @@
#include "components/datetime/DateTimeController.h"
#include "components/ble/BleController.h"
#include "utility/DirtyValue.h"
#include "displayapp/apps/Apps.h"
#include "displayapp/apps/WatchFaces.h"
namespace Pinetime {
namespace Controllers {

View File

@ -10,7 +10,8 @@
#include "components/ble/BleController.h"
#include "displayapp/widgets/StatusIcons.h"
#include "utility/DirtyValue.h"
#include "displayapp/apps/Apps.h"
#include "displayapp/apps/WatchFaces.h"
namespace Pinetime {
namespace Controllers {

View File

@ -8,7 +8,7 @@
#include "displayapp/screens/Screen.h"
#include "components/datetime/DateTimeController.h"
#include "utility/DirtyValue.h"
#include "displayapp/apps/Apps.h"
#include "displayapp/apps/WatchFaces.h"
namespace Pinetime {
namespace Controllers {

View File

@ -8,6 +8,7 @@
#include "displayapp/screens/Screen.h"
#include "components/datetime/DateTimeController.h"
#include "utility/DirtyValue.h"
#include "displayapp/apps/WatchFaces.h"
namespace Pinetime {
namespace Controllers {