Skip to content

Commit 7c7a860

Browse files
committed
screens: Remove displayapp parameter from screen
The DisplayApp class isn't used in the Screen base class and most screens, so requiring it is pointless. In this commit, DisplayApp pointers were added to screens which use it and the explicit Screen constructor was removed in those screens.
1 parent e2d4084 commit 7c7a860

30 files changed

Lines changed: 44 additions & 29 deletions

src/displayapp/screens/ApplicationList.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ ApplicationList::ApplicationList(Pinetime::Applications::DisplayApp* app,
2323
const Pinetime::Controllers::Battery& batteryController,
2424
const Pinetime::Controllers::Ble& bleController,
2525
Controllers::DateTime& dateTimeController)
26-
: Screen(app),
26+
: app {app},
2727
settingsController {settingsController},
2828
batteryController {batteryController},
2929
bleController {bleController},

src/displayapp/screens/ApplicationList.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ namespace Pinetime {
2525
bool OnTouchEvent(TouchEvents event) override;
2626

2727
private:
28+
DisplayApp* app;
2829
auto CreateScreenList() const;
2930
std::unique_ptr<Screen> CreateScreen(unsigned int screenNum) const;
3031

src/displayapp/screens/Clock.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Clock::Clock(DisplayApp* app,
2626
Controllers::HeartRateController& heartRateController,
2727
Controllers::MotionController& motionController,
2828
Controllers::FS& filesystem)
29-
: Screen(app),
29+
: app {app},
3030
dateTimeController {dateTimeController},
3131
batteryController {batteryController},
3232
bleController {bleController},

src/displayapp/screens/Clock.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ namespace Pinetime {
3636
bool OnButtonPushed() override;
3737

3838
private:
39+
DisplayApp* app;
3940
Controllers::DateTime& dateTimeController;
4041
const Controllers::Battery& batteryController;
4142
const Controllers::Ble& bleController;

src/displayapp/screens/Label.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
using namespace Pinetime::Applications::Screens;
44

5-
Label::Label(uint8_t screenID, uint8_t numScreens, Pinetime::Applications::DisplayApp* app, lv_obj_t* labelText)
6-
: Screen(app), labelText {labelText}, pageIndicator(screenID, numScreens) {
5+
Label::Label(uint8_t screenID, uint8_t numScreens, lv_obj_t* labelText)
6+
: labelText {labelText}, pageIndicator(screenID, numScreens) {
77

88
pageIndicator.Create();
99
}

src/displayapp/screens/Label.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace Pinetime {
1010

1111
class Label : public Screen {
1212
public:
13-
Label(uint8_t screenID, uint8_t numScreens, DisplayApp* app, lv_obj_t* labelText);
13+
Label(uint8_t screenID, uint8_t numScreens, lv_obj_t* labelText);
1414
~Label() override;
1515

1616
private:

src/displayapp/screens/List.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ List::List(uint8_t screenID,
1717
DisplayApp* app,
1818
Controllers::Settings& settingsController,
1919
std::array<Applications, MAXLISTITEMS>& applications)
20-
: Screen(app), settingsController {settingsController}, pageIndicator(screenID, numScreens) {
20+
: app {app}, settingsController {settingsController}, pageIndicator(screenID, numScreens) {
2121

2222
// Set the background to Black
2323
lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, lv_color_make(0, 0, 0));

src/displayapp/screens/List.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ namespace Pinetime {
3131
void OnButtonEvent(lv_obj_t* object, lv_event_t event);
3232

3333
private:
34+
DisplayApp* app;
3435
Controllers::Settings& settingsController;
3536
Pinetime::Applications::Apps apps[MAXLISTITEMS];
3637

src/displayapp/screens/Notifications.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Notifications::Notifications(DisplayApp* app,
1616
Pinetime::Controllers::MotorController& motorController,
1717
System::SystemTask& systemTask,
1818
Modes mode)
19-
: Screen(app),
19+
: app {app},
2020
notificationManager {notificationManager},
2121
alertNotificationService {alertNotificationService},
2222
motorController {motorController},

src/displayapp/screens/Notifications.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ namespace Pinetime {
6969
};
7070

7171
private:
72+
DisplayApp* app;
7273
Pinetime::Controllers::NotificationManager& notificationManager;
7374
Pinetime::Controllers::AlertNotificationService& alertNotificationService;
7475
Pinetime::Controllers::MotorController& motorController;

0 commit comments

Comments
 (0)