Fix code formatting

This commit is contained in:
Jean-François Milants 2023-11-01 21:06:26 +01:00 committed by JF
parent 97ba1a456d
commit 473d9c4fa4
21 changed files with 73 additions and 25 deletions

View File

@ -40,6 +40,7 @@ namespace Pinetime {
Error, Error,
Weather Weather
}; };
template <Apps> template <Apps>
struct AppTraits {}; struct AppTraits {};

View File

@ -1,11 +1,14 @@
#pragma once #pragma once
namespace Pinetime { namespace Pinetime {
namespace Applications { namespace Applications {
class DisplayApp; class DisplayApp;
} }
namespace Components { namespace Components {
class LittleVgl; class LittleVgl;
} }
namespace Controllers { namespace Controllers {
class Battery; class Battery;
class Ble; class Ble;
@ -23,9 +26,11 @@ namespace Pinetime {
class MusicService; class MusicService;
class NavigationService; class NavigationService;
} }
namespace System { namespace System {
class SystemTask; class SystemTask;
} }
namespace Applications { namespace Applications {
struct AppControllers { struct AppControllers {
const Pinetime::Controllers::Battery& batteryController; const Pinetime::Controllers::Battery& batteryController;

View File

@ -98,11 +98,24 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
filesystem {filesystem}, filesystem {filesystem},
lvgl {lcd, filesystem}, lvgl {lcd, filesystem},
timer(this, TimerCallback), timer(this, TimerCallback),
controllers{ controllers {batteryController,
batteryController, bleController, dateTimeController, notificationManager, heartRateController, bleController,
settingsController, motorController, motionController, alarmController, brightnessController, dateTimeController,
nullptr, filesystem, timer, nullptr, this, lvgl, nullptr, nullptr} notificationManager,
{ heartRateController,
settingsController,
motorController,
motionController,
alarmController,
brightnessController,
nullptr,
filesystem,
timer,
nullptr,
this,
lvgl,
nullptr,
nullptr} {
} }
void DisplayApp::Start(System::BootErrors error) { void DisplayApp::Start(System::BootErrors error) {
@ -421,8 +434,7 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
dateTimeController, dateTimeController,
filesystem, filesystem,
std::move(apps)); std::move(apps));
} } break;
break;
case Apps::Clock: case Apps::Clock:
currentScreen = std::make_unique<Screens::Clock>(dateTimeController, currentScreen = std::make_unique<Screens::Clock>(dateTimeController,
batteryController, batteryController,

View File

@ -73,7 +73,6 @@ namespace Pinetime {
void Register(Pinetime::Controllers::MusicService* musicService); void Register(Pinetime::Controllers::MusicService* musicService);
void Register(Pinetime::Controllers::NavigationService* NavigationService); void Register(Pinetime::Controllers::NavigationService* NavigationService);
private: private:
TaskHandle_t taskHandle; TaskHandle_t taskHandle;
static void Process(void* instance); static void Process(void* instance);

View File

@ -65,14 +65,18 @@ namespace Pinetime {
Widgets::Counter minuteCounter = Widgets::Counter(0, 59, jetbrains_mono_76); Widgets::Counter minuteCounter = Widgets::Counter(0, 59, jetbrains_mono_76);
}; };
} }
template <> template <>
struct AppTraits<Apps::Alarm> { struct AppTraits<Apps::Alarm> {
static constexpr Apps app = Apps::Alarm; static constexpr Apps app = Apps::Alarm;
static constexpr const char* icon = Screens::Symbols::clock; static constexpr const char* icon = Screens::Symbols::clock;
static Screens::Screen *Create(AppControllers& controllers) { return new Screens::Alarm(controllers.alarmController,
static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::Alarm(controllers.alarmController,
controllers.settingsController.GetClockType(), controllers.settingsController.GetClockType(),
*controllers.systemTask, *controllers.systemTask,
controllers.motorController); }; controllers.motorController);
};
}; };
} }
} }

View File

@ -38,10 +38,12 @@ namespace Pinetime {
lv_task_t* taskRefresh; lv_task_t* taskRefresh;
}; };
} }
template <> template <>
struct AppTraits<Apps::HeartRate> { struct AppTraits<Apps::HeartRate> {
static constexpr Apps app = Apps::HeartRate; static constexpr Apps app = Apps::HeartRate;
static constexpr const char* icon = Screens::Symbols::heartBeat; static constexpr const char* icon = Screens::Symbols::heartBeat;
static Screens::Screen* Create(AppControllers& controllers) { static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::HeartRate(controllers.heartRateController, *controllers.systemTask); return new Screens::HeartRate(controllers.heartRateController, *controllers.systemTask);
}; };

View File

@ -38,10 +38,12 @@ namespace Pinetime {
uint8_t color = 2; uint8_t color = 2;
}; };
} }
template <> template <>
struct AppTraits<Apps::Paint> { struct AppTraits<Apps::Paint> {
static constexpr Apps app = Apps::Paint; static constexpr Apps app = Apps::Paint;
static constexpr const char* icon = Screens::Symbols::paintbrush; static constexpr const char* icon = Screens::Symbols::paintbrush;
static Screens::Screen* Create(AppControllers& controllers) { static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::InfiniPaint(controllers.lvgl, controllers.motorController); return new Screens::InfiniPaint(controllers.lvgl, controllers.motorController);
}; };

View File

@ -37,10 +37,12 @@ namespace Pinetime {
lv_task_t* taskRefresh; lv_task_t* taskRefresh;
}; };
} }
template <> template <>
struct AppTraits<Apps::Metronome> { struct AppTraits<Apps::Metronome> {
static constexpr Apps app = Apps::Metronome; static constexpr Apps app = Apps::Metronome;
static constexpr const char* icon = Screens::Symbols::drum; static constexpr const char* icon = Screens::Symbols::drum;
static Screens::Screen* Create(AppControllers& controllers) { static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::Metronome(controllers.motorController, *controllers.systemTask); return new Screens::Metronome(controllers.motorController, *controllers.systemTask);
}; };

View File

@ -32,10 +32,12 @@ namespace Pinetime {
lv_task_t* taskRefresh; lv_task_t* taskRefresh;
}; };
} }
template <> template <>
struct AppTraits<Apps::Motion> { struct AppTraits<Apps::Motion> {
static constexpr Apps app = Apps::Motion; static constexpr Apps app = Apps::Motion;
static constexpr const char* icon = "M"; static constexpr const char* icon = "M";
static Screens::Screen* Create(AppControllers& controllers) { static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::Motion(controllers.motionController); return new Screens::Motion(controllers.motionController);
}; };

View File

@ -85,10 +85,12 @@ namespace Pinetime {
/** Watchapp */ /** Watchapp */
}; };
} }
template <> template <>
struct AppTraits<Apps::Music> { struct AppTraits<Apps::Music> {
static constexpr Apps app = Apps::Music; static constexpr Apps app = Apps::Music;
static constexpr const char* icon = Screens::Symbols::music; static constexpr const char* icon = Screens::Symbols::music;
static Screens::Screen* Create(AppControllers& controllers) { static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::Music(*controllers.musicService); return new Screens::Music(*controllers.musicService);
}; };

View File

@ -58,10 +58,12 @@ namespace Pinetime {
lv_task_t* taskRefresh; lv_task_t* taskRefresh;
}; };
} }
template <> template <>
struct AppTraits<Apps::Navigation> { struct AppTraits<Apps::Navigation> {
static constexpr Apps app = Apps::Navigation; static constexpr Apps app = Apps::Navigation;
static constexpr const char* icon = Screens::Symbols::map; static constexpr const char* icon = Screens::Symbols::map;
static Screens::Screen* Create(AppControllers& controllers) { static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::Navigation(*controllers.navigationService); return new Screens::Navigation(*controllers.navigationService);
}; };

View File

@ -48,10 +48,12 @@ namespace Pinetime {
lv_task_t* taskRefresh; lv_task_t* taskRefresh;
}; };
} }
template <> template <>
struct AppTraits<Apps::Paddle> { struct AppTraits<Apps::Paddle> {
static constexpr Apps app = Apps::Paddle; static constexpr Apps app = Apps::Paddle;
static constexpr const char* icon = Screens::Symbols::paddle; static constexpr const char* icon = Screens::Symbols::paddle;
static Screens::Screen* Create(AppControllers& controllers) { static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::Paddle(controllers.lvgl); return new Screens::Paddle(controllers.lvgl);
}; };

View File

@ -42,10 +42,12 @@ namespace Pinetime {
lv_task_t* taskRefresh; lv_task_t* taskRefresh;
}; };
} }
template <> template <>
struct AppTraits<Apps::Steps> { struct AppTraits<Apps::Steps> {
static constexpr Apps app = Apps::Steps; static constexpr Apps app = Apps::Steps;
static constexpr const char* icon = Screens::Symbols::shoe; static constexpr const char* icon = Screens::Symbols::shoe;
static Screens::Screen* Create(AppControllers& controllers) { static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::Steps(controllers.motionController, controllers.settingsController); return new Screens::Steps(controllers.motionController, controllers.settingsController);
}; };

View File

@ -59,10 +59,12 @@ namespace Pinetime {
lv_task_t* taskRefresh; lv_task_t* taskRefresh;
}; };
} }
template <> template <>
struct AppTraits<Apps::StopWatch> { struct AppTraits<Apps::StopWatch> {
static constexpr Apps app = Apps::StopWatch; static constexpr Apps app = Apps::StopWatch;
static constexpr const char* icon = Screens::Symbols::stopWatch; static constexpr const char* icon = Screens::Symbols::stopWatch;
static Screens::Screen* Create(AppControllers& controllers) { static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::StopWatch(*controllers.systemTask); return new Screens::StopWatch(*controllers.systemTask);
}; };

View File

@ -50,6 +50,9 @@ namespace Pinetime::Applications{
struct AppTraits<Apps::Timer> { struct AppTraits<Apps::Timer> {
static constexpr Apps app = Apps::Timer; static constexpr Apps app = Apps::Timer;
static constexpr const char* icon = Screens::Symbols::hourGlass; static constexpr const char* icon = Screens::Symbols::hourGlass;
static Screens::Screen *Create(AppControllers& controllers) { return new Screens::Timer(controllers.timer); };
static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::Timer(controllers.timer);
};
}; };
} }

View File

@ -36,11 +36,15 @@ namespace Pinetime {
bool placeNewTile(); bool placeNewTile();
}; };
} }
template <> template <>
struct AppTraits<Apps::Twos> { struct AppTraits<Apps::Twos> {
static constexpr Apps app = Apps::Twos; static constexpr Apps app = Apps::Twos;
static constexpr const char* icon = "2"; static constexpr const char* icon = "2";
static Screens::Screen *Create(AppControllers& /*controllers*/) { return new Screens::Twos(); };
static Screens::Screen* Create(AppControllers& /*controllers*/) {
return new Screens::Twos();
};
}; };
} }
} }

View File

@ -44,10 +44,12 @@ namespace Pinetime {
std::unique_ptr<Screen> CreateScreenHumidity(); std::unique_ptr<Screen> CreateScreenHumidity();
}; };
} }
template <> template <>
struct AppTraits<Apps::Weather> { struct AppTraits<Apps::Weather> {
static constexpr Apps app = Apps::Weather; static constexpr Apps app = Apps::Weather;
static constexpr const char* icon = Screens::Symbols::sun; static constexpr const char* icon = Screens::Symbols::sun;
static Screens::Screen* Create(AppControllers& controllers) { static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::Weather(controllers.displayApp, *controllers.weatherController); return new Screens::Weather(controllers.displayApp, *controllers.weatherController);
}; };