Watch face selection at build time
Watch faces can now be selected at buid time. It's implemented in a similar way than the selection of user apps, using a list of watch face description that is generated at build time (consteval, constexpr)main
parent
a544da9ed1
commit
39bc166e54
@ -1,14 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Applications {
|
||||
enum class WatchFace : uint8_t {
|
||||
Digital = 0,
|
||||
Analog = 1,
|
||||
PineTimeStyle = 2,
|
||||
Terminal = 3,
|
||||
Infineat = 4,
|
||||
CasioStyleG7710 = 5,
|
||||
};
|
||||
}
|
||||
}
|
@ -1,133 +0,0 @@
|
||||
#include "displayapp/screens/Clock.h"
|
||||
|
||||
#include <lvgl/lvgl.h>
|
||||
#include "components/battery/BatteryController.h"
|
||||
#include "components/motion/MotionController.h"
|
||||
#include "components/ble/BleController.h"
|
||||
#include "components/ble/NotificationManager.h"
|
||||
#include "components/settings/Settings.h"
|
||||
#include "displayapp/DisplayApp.h"
|
||||
#include "displayapp/screens/WatchFaceDigital.h"
|
||||
#include "displayapp/screens/WatchFaceTerminal.h"
|
||||
#include "displayapp/screens/WatchFaceInfineat.h"
|
||||
#include "displayapp/screens/WatchFaceAnalog.h"
|
||||
#include "displayapp/screens/WatchFacePineTimeStyle.h"
|
||||
#include "displayapp/screens/WatchFaceCasioStyleG7710.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
using namespace Pinetime::Applications;
|
||||
|
||||
Clock::Clock(Controllers::DateTime& dateTimeController,
|
||||
const Controllers::Battery& batteryController,
|
||||
const Controllers::Ble& bleController,
|
||||
Controllers::NotificationManager& notificationManager,
|
||||
Controllers::Settings& settingsController,
|
||||
Controllers::HeartRateController& heartRateController,
|
||||
Controllers::MotionController& motionController,
|
||||
Controllers::WeatherService& weatherService,
|
||||
Controllers::FS& filesystem)
|
||||
: dateTimeController {dateTimeController},
|
||||
batteryController {batteryController},
|
||||
bleController {bleController},
|
||||
notificationManager {notificationManager},
|
||||
settingsController {settingsController},
|
||||
heartRateController {heartRateController},
|
||||
motionController {motionController},
|
||||
weatherService {weatherService},
|
||||
filesystem {filesystem},
|
||||
screen {[this, &settingsController]() {
|
||||
switch (settingsController.GetWatchFace()) {
|
||||
case WatchFace::Digital:
|
||||
return WatchFaceDigitalScreen();
|
||||
break;
|
||||
case WatchFace::Analog:
|
||||
return WatchFaceAnalogScreen();
|
||||
break;
|
||||
case WatchFace::PineTimeStyle:
|
||||
return WatchFacePineTimeStyleScreen();
|
||||
break;
|
||||
case WatchFace::Terminal:
|
||||
return WatchFaceTerminalScreen();
|
||||
break;
|
||||
case WatchFace::Infineat:
|
||||
return WatchFaceInfineatScreen();
|
||||
break;
|
||||
case WatchFace::CasioStyleG7710:
|
||||
return WatchFaceCasioStyleG7710();
|
||||
break;
|
||||
}
|
||||
return WatchFaceDigitalScreen();
|
||||
}()} {
|
||||
settingsController.SetAppMenu(0);
|
||||
}
|
||||
|
||||
Clock::~Clock() {
|
||||
lv_obj_clean(lv_scr_act());
|
||||
}
|
||||
|
||||
bool Clock::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
||||
return screen->OnTouchEvent(event);
|
||||
}
|
||||
|
||||
bool Clock::OnButtonPushed() {
|
||||
return screen->OnButtonPushed();
|
||||
}
|
||||
|
||||
std::unique_ptr<Screen> Clock::WatchFaceDigitalScreen() {
|
||||
return std::make_unique<Screens::WatchFaceDigital>(dateTimeController,
|
||||
batteryController,
|
||||
bleController,
|
||||
notificationManager,
|
||||
settingsController,
|
||||
heartRateController,
|
||||
motionController);
|
||||
}
|
||||
|
||||
std::unique_ptr<Screen> Clock::WatchFaceAnalogScreen() {
|
||||
return std::make_unique<Screens::WatchFaceAnalog>(dateTimeController,
|
||||
batteryController,
|
||||
bleController,
|
||||
notificationManager,
|
||||
settingsController);
|
||||
}
|
||||
|
||||
std::unique_ptr<Screen> Clock::WatchFacePineTimeStyleScreen() {
|
||||
return std::make_unique<Screens::WatchFacePineTimeStyle>(dateTimeController,
|
||||
batteryController,
|
||||
bleController,
|
||||
notificationManager,
|
||||
settingsController,
|
||||
motionController,
|
||||
weatherService);
|
||||
}
|
||||
|
||||
std::unique_ptr<Screen> Clock::WatchFaceTerminalScreen() {
|
||||
return std::make_unique<Screens::WatchFaceTerminal>(dateTimeController,
|
||||
batteryController,
|
||||
bleController,
|
||||
notificationManager,
|
||||
settingsController,
|
||||
heartRateController,
|
||||
motionController);
|
||||
}
|
||||
|
||||
std::unique_ptr<Screen> Clock::WatchFaceInfineatScreen() {
|
||||
return std::make_unique<Screens::WatchFaceInfineat>(dateTimeController,
|
||||
batteryController,
|
||||
bleController,
|
||||
notificationManager,
|
||||
settingsController,
|
||||
motionController,
|
||||
filesystem);
|
||||
}
|
||||
|
||||
std::unique_ptr<Screen> Clock::WatchFaceCasioStyleG7710() {
|
||||
return std::make_unique<Screens::WatchFaceCasioStyleG7710>(dateTimeController,
|
||||
batteryController,
|
||||
bleController,
|
||||
notificationManager,
|
||||
settingsController,
|
||||
heartRateController,
|
||||
motionController,
|
||||
filesystem);
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include "displayapp/Controllers.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include "displayapp/Apps.h"
|
||||
#include "Symbols.h"
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Controllers {
|
||||
class Settings;
|
||||
class Battery;
|
||||
class Ble;
|
||||
class NotificationManager;
|
||||
class MotionController;
|
||||
class DateTime;
|
||||
class HeartRateController;
|
||||
class WeatherService;
|
||||
class FS;
|
||||
}
|
||||
|
||||
namespace Applications {
|
||||
namespace Screens {
|
||||
class Clock : public Screen {
|
||||
public:
|
||||
Clock(Controllers::DateTime& dateTimeController,
|
||||
const Controllers::Battery& batteryController,
|
||||
const Controllers::Ble& bleController,
|
||||
Controllers::NotificationManager& notificationManager,
|
||||
Controllers::Settings& settingsController,
|
||||
Controllers::HeartRateController& heartRateController,
|
||||
Controllers::MotionController& motionController,
|
||||
Controllers::WeatherService& weatherService,
|
||||
Controllers::FS& filesystem);
|
||||
~Clock() override;
|
||||
|
||||
bool OnTouchEvent(TouchEvents event) override;
|
||||
bool OnButtonPushed() override;
|
||||
|
||||
private:
|
||||
Controllers::DateTime& dateTimeController;
|
||||
const Controllers::Battery& batteryController;
|
||||
const Controllers::Ble& bleController;
|
||||
Controllers::NotificationManager& notificationManager;
|
||||
Controllers::Settings& settingsController;
|
||||
Controllers::HeartRateController& heartRateController;
|
||||
Controllers::MotionController& motionController;
|
||||
Controllers::WeatherService& weatherService;
|
||||
Controllers::FS& filesystem;
|
||||
|
||||
std::unique_ptr<Screen> screen;
|
||||
std::unique_ptr<Screen> WatchFaceDigitalScreen();
|
||||
std::unique_ptr<Screen> WatchFaceAnalogScreen();
|
||||
std::unique_ptr<Screen> WatchFacePineTimeStyleScreen();
|
||||
std::unique_ptr<Screen> WatchFaceTerminalScreen();
|
||||
std::unique_ptr<Screen> WatchFaceInfineatScreen();
|
||||
std::unique_ptr<Screen> WatchFaceCasioStyleG7710();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue