aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/displayapp/DisplayApp.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp
index add00650..f5b2efde 100644
--- a/src/displayapp/DisplayApp.cpp
+++ b/src/displayapp/DisplayApp.cpp
@@ -54,6 +54,8 @@
#include "libs/lv_conf.h"
#include "UserApps.h"
+#include <algorithm>
+
using namespace Pinetime::Applications;
using namespace Pinetime::Applications::Display;
@@ -516,10 +518,9 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
switch (app) {
case Apps::Launcher: {
std::array<Screens::Tile::Applications, UserAppTypes::Count> apps;
- int i = 0;
- for (const auto& userApp : userApps) {
- apps[i++] = Screens::Tile::Applications {userApp.icon, userApp.app, true};
- }
+ std::ranges::transform(userApps, apps.begin(), [](const auto& userApp) {
+ return Screens::Tile::Applications {userApp.icon, userApp.app, true};
+ });
currentScreen = std::make_unique<Screens::ApplicationList>(this,
settingsController,
batteryController,
@@ -530,13 +531,12 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
std::move(apps));
} break;
case Apps::Clock: {
- const auto* watchFace =
- std::find_if(userWatchFaces.begin(), userWatchFaces.end(), [this](const WatchFaceDescription& watchfaceDescription) {
- return watchfaceDescription.watchFace == settingsController.GetWatchFace();
- });
- if (watchFace != userWatchFaces.end())
+ const auto* watchFace = std::ranges::find_if(userWatchFaces, [this](const WatchFaceDescription& watchfaceDescription) {
+ return watchfaceDescription.watchFace == settingsController.GetWatchFace();
+ });
+ if (watchFace != userWatchFaces.end()) {
currentScreen.reset(watchFace->create(controllers));
- else {
+ } else {
currentScreen.reset(userWatchFaces[0].create(controllers));
}
settingsController.SetAppMenu(0);
@@ -587,11 +587,11 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
break;
case Apps::SettingWatchFace: {
std::array<Screens::SettingWatchFace::Item, UserWatchFaceTypes::Count> items;
- int i = 0;
- for (const auto& userWatchFace : userWatchFaces) {
- items[i++] =
- Screens::SettingWatchFace::Item {userWatchFace.name, userWatchFace.watchFace, userWatchFace.isAvailable(controllers.filesystem)};
- }
+ std::ranges::transform(userWatchFaces, items.begin(), [this](const WatchFaceDescription& userWatchFace) {
+ return Screens::SettingWatchFace::Item {userWatchFace.name,
+ userWatchFace.watchFace,
+ userWatchFace.isAvailable(controllers.filesystem)};
+ });
currentScreen = std::make_unique<Screens::SettingWatchFace>(this, std::move(items), settingsController, filesystem);
} break;
case Apps::SettingTimeFormat:
@@ -639,7 +639,7 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
currentScreen = std::make_unique<Screens::FlashLight>(*systemTask, brightnessController);
break;
default: {
- const auto* d = std::find_if(userApps.begin(), userApps.end(), [app](const AppDescription& appDescription) {
+ const auto* d = std::ranges::find_if(userApps, [app](const AppDescription& appDescription) {
return appDescription.app == app;
});
if (d != userApps.end()) {