Skip to content

Commit

Permalink
Remove unused pointer to DisplayApp member variables (#2125)
Browse files Browse the repository at this point in the history
In the screens that use `DisplayApp *app` and pass it to a child item,
or use the reference just in the constructor. Afterwards the `app`
member is not used. So remove it from the private member variables.

Completely remove `app` parameter from `SettingDisplay` constructor as
it is unused.
  • Loading branch information
NeroBurner authored Sep 29, 2024
1 parent a0cd439 commit 3db4e01
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/displayapp/DisplayApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
currentScreen = std::make_unique<Screens::SettingWakeUp>(settingsController);
break;
case Apps::SettingDisplay:
currentScreen = std::make_unique<Screens::SettingDisplay>(this, settingsController);
currentScreen = std::make_unique<Screens::SettingDisplay>(settingsController);
break;
case Apps::SettingSteps:
currentScreen = std::make_unique<Screens::SettingSteps>(settingsController);
Expand Down
3 changes: 1 addition & 2 deletions src/displayapp/screens/SystemInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ SystemInfo::SystemInfo(Pinetime::Applications::DisplayApp* app,
Pinetime::Controllers::MotionController& motionController,
const Pinetime::Drivers::Cst816S& touchPanel,
const Pinetime::Drivers::SpiNorFlash& spiNorFlash)
: app {app},
dateTimeController {dateTimeController},
: dateTimeController {dateTimeController},
batteryController {batteryController},
brightnessController {brightnessController},
bleController {bleController},
Expand Down
1 change: 0 additions & 1 deletion src/displayapp/screens/SystemInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ namespace Pinetime {
bool OnTouchEvent(TouchEvents event) override;

private:
DisplayApp* app;
Pinetime::Controllers::DateTime& dateTimeController;
const Pinetime::Controllers::Battery& batteryController;
Pinetime::Controllers::BrightnessController& brightnessController;
Expand Down
3 changes: 1 addition & 2 deletions src/displayapp/screens/settings/SettingDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ namespace {

constexpr std::array<uint16_t, 6> SettingDisplay::options;

SettingDisplay::SettingDisplay(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
: app {app}, settingsController {settingsController} {
SettingDisplay::SettingDisplay(Pinetime::Controllers::Settings& settingsController) : settingsController {settingsController} {

lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr);

Expand Down
3 changes: 1 addition & 2 deletions src/displayapp/screens/settings/SettingDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ namespace Pinetime {

class SettingDisplay : public Screen {
public:
SettingDisplay(DisplayApp* app, Pinetime::Controllers::Settings& settingsController);
SettingDisplay(Pinetime::Controllers::Settings& settingsController);
~SettingDisplay() override;

void UpdateSelected(lv_obj_t* object, lv_event_t event);
void ToggleAlwaysOn();

private:
DisplayApp* app;
static constexpr std::array<uint16_t, 6> options = {5000, 7000, 10000, 15000, 20000, 30000};

Controllers::Settings& settingsController;
Expand Down
3 changes: 1 addition & 2 deletions src/displayapp/screens/settings/SettingSetDateTime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ bool SettingSetDateTime::OnTouchEvent(Pinetime::Applications::TouchEvents event)
SettingSetDateTime::SettingSetDateTime(Pinetime::Applications::DisplayApp* app,
Pinetime::Controllers::DateTime& dateTimeController,
Pinetime::Controllers::Settings& settingsController)
: app {app},
dateTimeController {dateTimeController},
: dateTimeController {dateTimeController},
settingsController {settingsController},
screens {app,
0,
Expand Down
1 change: 0 additions & 1 deletion src/displayapp/screens/settings/SettingSetDateTime.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ namespace Pinetime {
void Quit();

private:
DisplayApp* app;
Controllers::DateTime& dateTimeController;
Controllers::Settings& settingsController;

Expand Down
3 changes: 1 addition & 2 deletions src/displayapp/screens/settings/SettingWatchFace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ SettingWatchFace::SettingWatchFace(Pinetime::Applications::DisplayApp* app,
std::array<Screens::SettingWatchFace::Item, UserWatchFaceTypes::Count>&& watchfaceItems,
Pinetime::Controllers::Settings& settingsController,
Pinetime::Controllers::FS& filesystem)
: app {app},
watchfaceItems {std::move(watchfaceItems)},
: watchfaceItems {std::move(watchfaceItems)},
settingsController {settingsController},
filesystem {filesystem},
screens {app, 0, CreateScreenList(), Screens::ScreenListModes::UpDown} {
Expand Down
1 change: 0 additions & 1 deletion src/displayapp/screens/settings/SettingWatchFace.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ namespace Pinetime {
bool OnTouchEvent(TouchEvents event) override;

private:
DisplayApp* app;
auto CreateScreenList() const;
std::unique_ptr<Screen> CreateScreen(unsigned int screenNum) const;

Expand Down

0 comments on commit 3db4e01

Please sign in to comment.