diff options
author | Niall Cooling <niallcooling@gmail.com> | 2021-03-22 17:56:26 +0000 |
---|---|---|
committer | Niall Cooling <niallcooling@gmail.com> | 2021-03-22 17:56:26 +0000 |
commit | 8eb947a2239d431146de9295e281ee0163fa20e2 (patch) | |
tree | bead1be9cc9175ab1a394fa8eeb78f07618f3a7a /src/displayapp/screens | |
parent | e5e3fc02b8a2adf9ea100c162d1290cecdf617ef (diff) |
replaced all unique_ptr.reset calls with std::make_unique
Diffstat (limited to 'src/displayapp/screens')
-rw-r--r-- | src/displayapp/screens/ApplicationList.cpp | 6 | ||||
-rw-r--r-- | src/displayapp/screens/Clock.cpp | 8 | ||||
-rw-r--r-- | src/displayapp/screens/Notifications.cpp | 16 | ||||
-rw-r--r-- | src/displayapp/screens/SystemInfo.cpp | 6 |
4 files changed, 18 insertions, 18 deletions
diff --git a/src/displayapp/screens/ApplicationList.cpp b/src/displayapp/screens/ApplicationList.cpp index dd9cb2a8..60039045 100644 --- a/src/displayapp/screens/ApplicationList.cpp +++ b/src/displayapp/screens/ApplicationList.cpp @@ -56,7 +56,7 @@ std::unique_ptr<Screen> ApplicationList::CreateScreen1() { }; - return std::unique_ptr<Screen>(new Screens::Tile(0, app, settingsController, applications)); + return std::make_unique<Screens::Tile>(0, app, settingsController, applications); } std::unique_ptr<Screen> ApplicationList::CreateScreen2() { @@ -70,7 +70,7 @@ std::unique_ptr<Screen> ApplicationList::CreateScreen2() { } }; - return std::unique_ptr<Screen>(new Screens::Tile(1, app, settingsController, applications)); + return std::make_unique<Screens::Tile>(1, app, settingsController, applications); } std::unique_ptr<Screen> ApplicationList::CreateScreen3() { @@ -84,6 +84,6 @@ std::unique_ptr<Screen> ApplicationList::CreateScreen3() { } }; - return std::unique_ptr<Screen>(new Screens::Tile(2, app, settingsController, applications)); + return std::make_unique<Screens::Tile>(2, app, settingsController, applications); } diff --git a/src/displayapp/screens/Clock.cpp b/src/displayapp/screens/Clock.cpp index 342dd222..69180370 100644 --- a/src/displayapp/screens/Clock.cpp +++ b/src/displayapp/screens/Clock.cpp @@ -64,20 +64,20 @@ bool Clock::OnTouchEvent(Pinetime::Applications::TouchEvents event) { } std::unique_ptr<Screen> Clock::WatchFaceDigitalScreen() { - return std::unique_ptr<Screen>(new Screens::WatchFaceDigital(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController, heartRateController)); + return std::make_unique<Screens::WatchFaceDigital>(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController, heartRateController); } std::unique_ptr<Screen> Clock::WatchFaceAnalogScreen() { - return std::unique_ptr<Screen>(new Screens::WatchFaceAnalog(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController)); + return std::make_unique<Screens::WatchFaceAnalog>(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController); } /* // Examples for more watch faces std::unique_ptr<Screen> Clock::WatchFaceMinimalScreen() { - return std::unique_ptr<Screen>(new Screens::WatchFaceMinimal(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController)); + return std::make_unique<Screens::WatchFaceMinimal>(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController); } std::unique_ptr<Screen> Clock::WatchFaceCustomScreen() { - return std::unique_ptr<Screen>(new Screens::WatchFaceCustom(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController)); + return std::make_unique<Screens::WatchFaceCustom>(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController); } */
\ No newline at end of file diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp index 4219bac7..c903ed0f 100644 --- a/src/displayapp/screens/Notifications.cpp +++ b/src/displayapp/screens/Notifications.cpp @@ -17,22 +17,22 @@ Notifications::Notifications(DisplayApp *app, auto notification = notificationManager.GetLastNotification(); if(notification.valid) { currentId = notification.id; - currentItem.reset(new NotificationItem("\nNotification", + currentItem = std::make_unique<NotificationItem>("\nNotification", notification.message.data(), notification.index, notification.category, notificationManager.NbNotifications(), mode, - alertNotificationService)); + alertNotificationService); validDisplay = true; } else { - currentItem.reset(new NotificationItem("\nNotification", + currentItem = std::make_unique<NotificationItem>("\nNotification", "No notification to display", 0, notification.category, notificationManager.NbNotifications(), Modes::Preview, - alertNotificationService)); + alertNotificationService); } if(mode == Modes::Preview) { @@ -87,13 +87,13 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) { currentId = previousNotification.id; currentItem.reset(nullptr); app->SetFullRefresh(DisplayApp::FullRefreshDirections::Up); - currentItem.reset(new NotificationItem("\nNotification", + currentItem = std::make_unique<NotificationItem>("\nNotification", previousNotification.message.data(), previousNotification.index, previousNotification.category, notificationManager.NbNotifications(), mode, - alertNotificationService)); + alertNotificationService); } return true; case Pinetime::Applications::TouchEvents::SwipeDown: { @@ -109,13 +109,13 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) { currentId = nextNotification.id; currentItem.reset(nullptr); app->SetFullRefresh(DisplayApp::FullRefreshDirections::Down); - currentItem.reset(new NotificationItem("\nNotification", + currentItem = std::make_unique<NotificationItem>("\nNotification", nextNotification.message.data(), nextNotification.index, nextNotification.category, notificationManager.NbNotifications(), mode, - alertNotificationService)); + alertNotificationService); } return true; case Pinetime::Applications::TouchEvents::LongTap: { diff --git a/src/displayapp/screens/SystemInfo.cpp b/src/displayapp/screens/SystemInfo.cpp index 0d6f8e5a..949fd345 100644 --- a/src/displayapp/screens/SystemInfo.cpp +++ b/src/displayapp/screens/SystemInfo.cpp @@ -104,14 +104,14 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen1() { uptimeDays, uptimeHours, uptimeMinutes, uptimeSeconds, batteryPercent, brightness, resetReason); - return std::unique_ptr<Screen>(new Screens::Label(app, t1)); + return std::make_unique<Screens::Label>(app, t1); } std::unique_ptr<Screen> SystemInfo::CreateScreen2() { auto& bleAddr = bleController.Address(); sprintf(t2, "BLE MAC: \n %02x:%02x:%02x:%02x:%02x:%02x", bleAddr[5], bleAddr[4], bleAddr[3], bleAddr[2], bleAddr[1], bleAddr[0]); - return std::unique_ptr<Screen>(new Screens::Label(app, t2)); + return std::make_unique<Screens::Label>(app, t2); } std::unique_ptr<Screen> SystemInfo::CreateScreen3() { @@ -123,5 +123,5 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen3() { "Source code:\n" "https://github.com/\n" " JF002/InfiniTime"); - return std::unique_ptr<Screen>(new Screens::Label(app, t3)); + return std::make_unique<Screens::Label>(app, t3); } |