Watchface : remove the Watchface enum

Move all watch faces in their own folder, along with a CMake file that specify the name of the watch face, its namespace, the include file and sources files.
This commit is contained in:
Jean-François Milants 2024-08-17 22:25:33 +02:00
parent 6f146fc0cd
commit fad61bdca7
38 changed files with 70 additions and 53 deletions

View file

@ -28,6 +28,7 @@ endif ()
set(CMAKE_OSX_SYSROOT "/")
set(CMAKE_OSX_DEPLOYMENT_TARGET "")
add_subdirectory(displayapp)
set(SDK_SOURCE_FILES
# Startup
@ -420,12 +421,7 @@ list(APPEND SOURCE_FILES
displayapp/screens/settings/SettingBluetooth.cpp
## Watch faces
displayapp/screens/WatchFaceAnalog.cpp
displayapp/screens/WatchFaceDigital.cpp
displayapp/screens/WatchFaceInfineat.cpp
displayapp/screens/WatchFaceTerminal.cpp
displayapp/screens/WatchFacePineTimeStyle.cpp
displayapp/screens/WatchFaceCasioStyleG7710.cpp
${WATCHFACE_SOURCES}
##
@ -848,8 +844,6 @@ target_compile_options(infinitime_fonts PUBLIC
$<$<COMPILE_LANGUAGE:ASM>: ${ASM_FLAGS}>
)
add_subdirectory(displayapp/apps)
# NRF SDK
add_library(nrf-sdk STATIC ${SDK_SOURCE_FILES})
target_include_directories(nrf-sdk SYSTEM PUBLIC . ../)

View file

@ -5,8 +5,8 @@
#include <array>
#include "components/brightness/BrightnessController.h"
#include "components/fs/FS.h"
#include "displayapp/apps/Apps.h"
#include "displayapp/apps/WatchFaces.h"
#include "displayapp/Apps.h"
#include "displayapp/WatchFaces.h"
namespace Pinetime {
namespace Controllers {

View file

@ -18,16 +18,20 @@ else ()
set(USERAPP_TYPES "${DEFAULT_USER_APP_TYPES}" CACHE STRING "List of user apps to build into the firmware")
endif ()
if(DEFINED ENABLE_WATCHFACES)
set(DEFAULT_WATCHFACE_TYPES ${ENABLE_WATCHFACES})
else ()
list(APPEND DEFAULT_WATCHFACE_TYPES "Pinetime::Applications::Screens::WatchFaceDigital")
list(APPEND DEFAULT_WATCHFACE_TYPES "Pinetime::Applications::Screens::WatchFaceAnalog")
list(APPEND DEFAULT_WATCHFACE_TYPES "Pinetime::Applications::Screens::WatchFacePineTimeStyle")
list(APPEND DEFAULT_WATCHFACE_TYPES "Pinetime::Applications::Screens::WatchFaceTerminal")
list(APPEND DEFAULT_WATCHFACE_TYPES "Pinetime::Applications::Screens::WatchFaceInfineat")
list(APPEND DEFAULT_WATCHFACE_TYPES "Pinetime::Applications::Screens::WatchFaceCasioStyleG7710")
endif ()
if(NOT DEFINED DEFAULT_WATCHFACE_NAMES )
set(DEFAULT_WATCHFACE_NAMES "digital;analog;pinetimestyle;terminal;infineat;casioStyleG7710")
endif()
message("WATCH FACES\n-----------")
foreach(item ${DEFAULT_WATCHFACE_NAMES})
if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/watchfaces/${item})
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/watchfaces/${item})
message(" * Watch face ${INFINITIME_WATCHFACE_NAME} enabled!")
list(APPEND DEFAULT_WATCHFACE_TYPES "${INFINITIME_WATCHFACE_NAMESPACE}")
list(APPEND WATCHFACE_SOURCES_LIST "${INFINITIME_WATCHFACE_SOURCES}")
string(APPEND WATCHFACE_INCLUDE "#include \"${INFINITIME_WATCHFACE_INCLUDES}\"\n")
endif()
endforeach()
set(WATCHFACE_SOURCES ${WATCHFACE_SOURCES_LIST} PARENT_SCOPE)
# Generate the list of watchface types necessary to instantiate WatchFaceTypeList<> needed in WatchFace.h
set(FIRST_ITERATION TRUE)
@ -49,9 +53,6 @@ foreach (w IN LISTS DEFAULT_WATCHFACE_TYPES)
string(SUBSTRING ${w} ${beginIndex} ${watchfaceLength} className)
string(SUBSTRING ${w} 0 ${classIndex} namespaceName)
string(APPEND WATCHFACE_NAMESPACE "namespace ${namespaceName} { class ${className}; }\n")
# TODO the include path should be specified by the CMake file of the watchface
string(APPEND WATCHFACE_INCLUDE "#include \"displayapp/screens/${className}.h\"\n")
endforeach ()
add_library(infinitime_apps INTERFACE)
@ -62,4 +63,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)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../UserApps.h.in ${CMAKE_CURRENT_BINARY_DIR}/../UserApps.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/UserApps.h.in ${CMAKE_CURRENT_BINARY_DIR}/UserApps.h)

View file

@ -4,7 +4,7 @@
#include <task.h>
#include <memory>
#include <systemtask/Messages.h>
#include "displayapp/apps/Apps.h"
#include "displayapp/Apps.h"
#include "displayapp/LittleVgl.h"
#include "displayapp/TouchEvents.h"
#include "components/brightness/BrightnessController.h"

View file

@ -1,5 +1,5 @@
#pragma once
#include "displayapp/apps/Apps.h"
#include "displayapp/Apps.h"
#include "displayapp/Controllers.h"
#include "displayapp/screens/Alarm.h"

View file

@ -17,7 +17,7 @@
*/
#pragma once
#include "displayapp/apps/Apps.h"
#include "displayapp/Apps.h"
#include "components/settings/Settings.h"
#include "displayapp/screens/Screen.h"
#include "displayapp/widgets/Counter.h"

View file

@ -1,6 +1,6 @@
#pragma once
#include "displayapp/apps/Apps.h"
#include "displayapp/Apps.h"
#include "displayapp/screens/Screen.h"
#include "displayapp/widgets/Counter.h"
#include "displayapp/Controllers.h"

View file

@ -6,7 +6,7 @@
#include "displayapp/screens/Screen.h"
#include "components/motor/MotorController.h"
#include "Symbols.h"
#include "displayapp/apps/Apps.h"
#include "displayapp/Apps.h"
#include <displayapp/Controllers.h>
namespace Pinetime {

View file

@ -7,7 +7,7 @@
#include <lvgl/src/lv_core/lv_obj.h>
#include <components/motion/MotionController.h>
#include "displayapp/Controllers.h"
#include "displayapp/apps/Apps.h"
#include "displayapp/Apps.h"
namespace Pinetime {
namespace Applications {

View file

@ -21,7 +21,7 @@
#include <lvgl/src/lv_core/lv_obj.h>
#include <string>
#include "displayapp/screens/Screen.h"
#include "displayapp/apps/Apps.h"
#include "displayapp/Apps.h"
#include "displayapp/Controllers.h"
#include "Symbols.h"

View file

@ -22,7 +22,7 @@
#include <string>
#include "displayapp/screens/Screen.h"
#include <array>
#include "displayapp/apps/Apps.h"
#include "displayapp/Apps.h"
#include "displayapp/Controllers.h"
#include "Symbols.h"

View file

@ -3,7 +3,7 @@
#include <lvgl/lvgl.h>
#include <cstdint>
#include "displayapp/screens/Screen.h"
#include "displayapp/apps/Apps.h"
#include "displayapp/Apps.h"
#include "displayapp/Controllers.h"
#include "Symbols.h"

View file

@ -4,7 +4,7 @@
#include <lvgl/lvgl.h>
#include "displayapp/screens/Screen.h"
#include <components/motion/MotionController.h>
#include "displayapp/apps/Apps.h"
#include "displayapp/Apps.h"
#include "displayapp/Controllers.h"
#include "Symbols.h"

View file

@ -7,7 +7,7 @@
#include "portmacro_cmsis.h"
#include "systemtask/SystemTask.h"
#include "displayapp/apps/Apps.h"
#include "displayapp/Apps.h"
#include "displayapp/Controllers.h"
#include "Symbols.h"

View file

@ -1,6 +1,6 @@
#pragma once
#include "displayapp/apps/Apps.h"
#include "displayapp/Apps.h"
#include "displayapp/screens/Screen.h"
#include "displayapp/Controllers.h"

View file

@ -4,7 +4,7 @@
#include <lvgl/lvgl.h>
#include "displayapp/screens/Screen.h"
#include "components/ble/SimpleWeatherService.h"
#include "displayapp/apps/Apps.h"
#include "displayapp/Apps.h"
#include "displayapp/Controllers.h"
#include "Symbols.h"
#include "utility/DirtyValue.h"

View file

@ -9,9 +9,7 @@
#include "displayapp/screens/Screen.h"
#include "displayapp/screens/Symbols.h"
#include "displayapp/screens/CheckboxList.h"
#include "displayapp/screens/WatchFaceInfineat.h"
#include "displayapp/screens/WatchFaceCasioStyleG7710.h"
#include "displayapp/apps/WatchFaces.h"
#include "displayapp/WatchFaces.h"
namespace Pinetime {

View file

@ -1,7 +1,7 @@
#include "displayapp/screens/settings/Settings.h"
#include <lvgl/lvgl.h>
#include <functional>
#include "displayapp/apps/Apps.h"
#include "displayapp/Apps.h"
#include "displayapp/DisplayApp.h"
using namespace Pinetime::Applications::Screens;

View file

@ -0,0 +1,4 @@
set(INFINITIME_WATCHFACE_NAME "Analog" PARENT_SCOPE)
set(INFINITIME_WATCHFACE_NAMESPACE "Pinetime::Applications::Screens::WatchFaceAnalog" PARENT_SCOPE)
set(INFINITIME_WATCHFACE_INCLUDES "displayapp/watchfaces/analog/WatchFaceAnalog.h" PARENT_SCOPE)
set(INFINITIME_WATCHFACE_SOURCES "displayapp/watchfaces/analog/WatchFaceAnalog.cpp" PARENT_SCOPE)

View file

@ -1,4 +1,4 @@
#include "displayapp/screens/WatchFaceAnalog.h"
#include "displayapp/watchfaces/analog/WatchFaceAnalog.h"
#include <cmath>
#include <lvgl/lvgl.h>
#include "displayapp/screens/BatteryIcon.h"

View file

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

View file

@ -0,0 +1,4 @@
set(INFINITIME_WATCHFACE_NAME "CasioStyleG7710" PARENT_SCOPE)
set(INFINITIME_WATCHFACE_NAMESPACE "Pinetime::Applications::Screens::WatchFaceCasioStyleG7710" PARENT_SCOPE)
set(INFINITIME_WATCHFACE_INCLUDES "displayapp/watchfaces/casioStyleG7710/WatchFaceCasioStyleG7710.h" PARENT_SCOPE)
set(INFINITIME_WATCHFACE_SOURCES "displayapp/watchfaces/casioStyleG7710/WatchFaceCasioStyleG7710.cpp" PARENT_SCOPE)

View file

@ -1,4 +1,4 @@
#include "displayapp/screens/WatchFaceCasioStyleG7710.h"
#include "displayapp/watchfaces/casioStyleG7710/WatchFaceCasioStyleG7710.h"
#include <lvgl/lvgl.h>
#include <cstdio>

View file

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

View file

@ -0,0 +1,4 @@
set(INFINITIME_WATCHFACE_NAME "Digital" PARENT_SCOPE)
set(INFINITIME_WATCHFACE_NAMESPACE "Pinetime::Applications::Screens::WatchFaceDigital" PARENT_SCOPE)
set(INFINITIME_WATCHFACE_INCLUDES "displayapp/watchfaces/digital/WatchFaceDigital.h" PARENT_SCOPE)
set(INFINITIME_WATCHFACE_SOURCES "displayapp/watchfaces/digital/WatchFaceDigital.cpp" PARENT_SCOPE)

View file

@ -1,4 +1,4 @@
#include "displayapp/screens/WatchFaceDigital.h"
#include "displayapp/watchfaces/digital/WatchFaceDigital.h"
#include <lvgl/lvgl.h>
#include <cstdio>

View file

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

View file

@ -0,0 +1,4 @@
set(INFINITIME_WATCHFACE_NAME "Infineat" PARENT_SCOPE)
set(INFINITIME_WATCHFACE_NAMESPACE "Pinetime::Applications::Screens::WatchFaceInfineat" PARENT_SCOPE)
set(INFINITIME_WATCHFACE_INCLUDES "displayapp/watchfaces/infineat/WatchFaceInfineat.h" PARENT_SCOPE)
set(INFINITIME_WATCHFACE_SOURCES "displayapp/watchfaces/infineat/WatchFaceInfineat.cpp" PARENT_SCOPE)

View file

@ -1,4 +1,4 @@
#include "displayapp/screens/WatchFaceInfineat.h"
#include "displayapp/watchfaces/infineat/WatchFaceInfineat.h"
#include <lvgl/lvgl.h>
#include <cstdio>

View file

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

View file

@ -0,0 +1,4 @@
set(INFINITIME_WATCHFACE_NAME "PineTimeStyle" PARENT_SCOPE)
set(INFINITIME_WATCHFACE_NAMESPACE "Pinetime::Applications::Screens::WatchFacePineTimeStyle" PARENT_SCOPE)
set(INFINITIME_WATCHFACE_INCLUDES "displayapp/watchfaces/pinetimestyle/WatchFacePineTimeStyle.h" PARENT_SCOPE)
set(INFINITIME_WATCHFACE_SOURCES "displayapp/watchfaces/pinetimestyle/WatchFacePineTimeStyle.cpp" PARENT_SCOPE)

View file

@ -19,7 +19,7 @@
* Style/layout copied from TimeStyle for Pebble by Dan Tilden (github.com/tilden)
*/
#include "displayapp/screens/WatchFacePineTimeStyle.h"
#include "displayapp/watchfaces/pinetimestyle/WatchFacePineTimeStyle.h"
#include <lvgl/lvgl.h>
#include <cstdio>
#include <displayapp/Colors.h>

View file

@ -12,7 +12,7 @@
#include "components/ble/SimpleWeatherService.h"
#include "components/ble/BleController.h"
#include "utility/DirtyValue.h"
#include "displayapp/apps/WatchFaces.h"
#include "displayapp/WatchFaces.h"
namespace Pinetime {
namespace Controllers {

View file

@ -0,0 +1,4 @@
set(INFINITIME_WATCHFACE_NAME "Terminal" PARENT_SCOPE)
set(INFINITIME_WATCHFACE_NAMESPACE "Pinetime::Applications::Screens::WatchFaceTerminal" PARENT_SCOPE)
set(INFINITIME_WATCHFACE_INCLUDES "displayapp/watchfaces/terminal/WatchFaceTerminal.h" PARENT_SCOPE)
set(INFINITIME_WATCHFACE_SOURCES "displayapp/watchfaces/terminal/WatchFaceTerminal.cpp" PARENT_SCOPE)

View file

@ -1,5 +1,5 @@
#include <lvgl/lvgl.h>
#include "displayapp/screens/WatchFaceTerminal.h"
#include "displayapp/watchfaces/terminal/WatchFaceTerminal.h"
#include "displayapp/screens/BatteryIcon.h"
#include "displayapp/screens/NotificationIcon.h"
#include "displayapp/screens/Symbols.h"

View file

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