replaced all unique_ptr.reset calls with std::make_unique

This commit is contained in:
Niall Cooling
2021-03-22 17:56:26 +00:00
parent e5e3fc02b8
commit 8eb947a223
7 changed files with 45 additions and 39 deletions

View File

@@ -123,7 +123,7 @@ void DisplayApp::Refresh() {
currentScreen.reset(nullptr);
lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Up);
onClockApp = false;
currentScreen.reset(new Screens::Notifications(this, notificationManager, systemTask.nimble().alertService(), Screens::Notifications::Modes::Preview));
currentScreen = std::make_unique<Screens::Notifications>(this, notificationManager, systemTask.nimble().alertService(), Screens::Notifications::Modes::Preview);
}
}
break;
@@ -161,10 +161,10 @@ void DisplayApp::Refresh() {
// lvgl.SetFullRefresh(components::LittleVgl::FullRefreshDirections::Down);
// currentScreen.reset(nullptr);
// if(toggle) {
// currentScreen.reset(new Screens::Tile(this));
// currentScreen = std::make_unique<Screens::Tile>(this);
// toggle = false;
// } else {
// currentScreen.reset(new Screens::Clock(this, dateTimeController, batteryController, bleController));
// currentScreen = std::make_unique<Screens::Clock>(this, dateTimeController, batteryController, bleController);
// toggle = true;
// }
@@ -172,10 +172,14 @@ void DisplayApp::Refresh() {
case Messages::BleFirmwareUpdateStarted:
lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Down);
currentScreen.reset(nullptr);
currentScreen.reset(new Screens::FirmwareUpdate(this, bleController));
currentScreen = std::make_unique<Screens::FirmwareUpdate>(this, bleController);
onClockApp = false;
break;
case Messages::UpdateDateTime:
// Added to remove warning
// What should happen here?
break;
}
}
@@ -198,23 +202,23 @@ void DisplayApp::RunningState() {
onClockApp = false;
switch(nextApp) {
case Apps::None:
case Apps::Launcher: currentScreen.reset(new Screens::ApplicationList(this, settingsController)); break;
case Apps::Launcher: currentScreen = std::make_unique<Screens::ApplicationList>(this, settingsController); break;
case Apps::Clock:
currentScreen.reset(new Screens::Clock(this, dateTimeController, batteryController, bleController, notificationManager, settingsController, heartRateController));
currentScreen = std::make_unique<Screens::Clock>(this, dateTimeController, batteryController, bleController, notificationManager, settingsController, heartRateController);
onClockApp = true;
break;
case Apps::SysInfo: currentScreen.reset(new Screens::SystemInfo(this, dateTimeController, batteryController, brightnessController, bleController, watchdog)); break;
case Apps::Meter: currentScreen.reset(new Screens::Meter(this)); break;
case Apps::StopWatch: currentScreen.reset(new Screens::StopWatch(this)); break;
case Apps::Twos: currentScreen.reset(new Screens::Twos(this)); break;
case Apps::Paint: currentScreen.reset(new Screens::InfiniPaint(this, lvgl)); break;
case Apps::Paddle: currentScreen.reset(new Screens::Paddle(this, lvgl)); break;
case Apps::Brightness : currentScreen.reset(new Screens::Brightness(this, brightnessController)); break;
case Apps::Music : currentScreen.reset(new Screens::Music(this, systemTask.nimble().music())); break;
case Apps::Navigation : currentScreen.reset(new Screens::Navigation(this, systemTask.nimble().navigation())); break;
case Apps::FirmwareValidation: currentScreen.reset(new Screens::FirmwareValidation(this, validator)); break;
case Apps::Notifications: currentScreen.reset(new Screens::Notifications(this, notificationManager, systemTask.nimble().alertService(), Screens::Notifications::Modes::Normal)); break;
case Apps::HeartRate: currentScreen.reset(new Screens::HeartRate(this, heartRateController)); break;
case Apps::SysInfo: currentScreen = std::make_unique<Screens::SystemInfo>(this, dateTimeController, batteryController, brightnessController, bleController, watchdog); break;
case Apps::Meter: currentScreen = std::make_unique<Screens::Meter>(this);break;
case Apps::StopWatch: currentScreen = std::make_unique<Screens::StopWatch>(this); break;
case Apps::Twos: currentScreen = std::make_unique<Screens::Twos>(this); break;
case Apps::Paint: currentScreen = std::make_unique<Screens::InfiniPaint>(this, lvgl); break;
case Apps::Paddle: currentScreen = std::make_unique<Screens::Paddle>(this, lvgl); break;
case Apps::Brightness : currentScreen = std::make_unique<Screens::Brightness>(this, brightnessController); break;
case Apps::Music : currentScreen = std::make_unique<Screens::Music>(this, systemTask.nimble().music()); break;
case Apps::Navigation : currentScreen = std::make_unique<Screens::Navigation>(this, systemTask.nimble().navigation()); break;
case Apps::FirmwareValidation: currentScreen = std::make_unique<Screens::FirmwareValidation>(this, validator); break;
case Apps::Notifications: currentScreen = std::make_unique<Screens::Notifications>(this, notificationManager, systemTask.nimble().alertService(), Screens::Notifications::Modes::Normal); break;
case Apps::HeartRate: currentScreen = std::make_unique<Screens::HeartRate>(this, heartRateController); break;
}
nextApp = Apps::None;
}