Code cleanup (#466)

* Code cleanup
* Remove override again
This commit is contained in:
Riku Isokoski 2021-07-25 17:54:05 +03:00 committed by GitHub
parent 34949a47c5
commit ec2469a6c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 42 additions and 66 deletions

View file

@ -383,8 +383,8 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break;
case Apps::SysInfo:
currentScreen =
std::make_unique<Screens::SystemInfo>(this, dateTimeController, batteryController, brightnessController, bleController, watchdog, motionController);
currentScreen = std::make_unique<Screens::SystemInfo>(
this, dateTimeController, batteryController, brightnessController, bleController, watchdog, motionController);
ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break;
case Apps::FlashLight:

View file

@ -15,8 +15,6 @@ namespace Pinetime {
bool Refresh() override;
private:
bool running = true;
lv_obj_t* labelText = nullptr;
lv_point_t pageIndicatorBasePoints[2];
lv_point_t pageIndicatorPoints[2];

View file

@ -36,7 +36,6 @@ Motion::Motion(Pinetime::Applications::DisplayApp* app, Controllers::MotionContr
labelStep = lv_label_create(lv_scr_act(), NULL);
lv_obj_align(labelStep, chart, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
lv_label_set_text(labelStep, "Steps ---");
}
Motion::~Motion() {
@ -50,13 +49,12 @@ bool Motion::Refresh() {
lv_label_set_text_fmt(labelStep, "Steps %lu", motionController.NbSteps());
lv_label_set_text_fmt(label, "X #FF0000 %d# Y #008000 %d# Z #FFFF00 %d#", motionController.X() / 0x10, motionController.Y() / 0x10, motionController.Z() / 0x10);
lv_label_set_text_fmt(label,
"X #FF0000 %d# Y #008000 %d# Z #FFFF00 %d#",
motionController.X() / 0x10,
motionController.Y() / 0x10,
motionController.Z() / 0x10);
lv_obj_align(label, NULL, LV_ALIGN_IN_TOP_MID, 0, 10);
return running;
}
bool Motion::OnButtonPushed() {
running = false;
return true;
}

View file

@ -18,7 +18,6 @@ namespace Pinetime {
~Motion() override;
bool Refresh() override;
bool OnButtonPushed() override;
private:
Controllers::MotionController& motionController;
@ -29,9 +28,6 @@ namespace Pinetime {
lv_obj_t* label;
lv_obj_t* labelStep;
static constexpr uint8_t nbStepsBufferSize = 9;
char nbStepsBuffer[nbStepsBufferSize + 1];
bool running = true;
};
}
}

View file

@ -5,13 +5,10 @@
using namespace Pinetime::Applications::Screens;
Steps::Steps(
Pinetime::Applications::DisplayApp *app,
Steps::Steps(Pinetime::Applications::DisplayApp* app,
Controllers::MotionController& motionController,
Controllers::Settings& settingsController)
: Screen(app),
motionController{motionController},
settingsController{settingsController} {
: Screen(app), motionController {motionController}, settingsController {settingsController} {
stepsArc = lv_arc_create(lv_scr_act(), nullptr);

View file

@ -70,11 +70,6 @@ bool SystemInfo::Refresh() {
return running;
}
bool SystemInfo::OnButtonPushed() {
running = false;
return true;
}
bool SystemInfo::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
return screens.OnTouchEvent(event);
}

View file

@ -31,12 +31,9 @@ namespace Pinetime {
Pinetime::Controllers::MotionController& motionController);
~SystemInfo() override;
bool Refresh() override;
bool OnButtonPushed() override;
bool OnTouchEvent(TouchEvents event) override;
private:
bool running = true;
Pinetime::Controllers::DateTime& dateTimeController;
Pinetime::Controllers::Battery& batteryController;
Pinetime::Controllers::BrightnessController& brightnessController;

View file

@ -154,10 +154,6 @@ void QuickSettings::OnButtonEvent(lv_obj_t* object, lv_event_t event) {
}
}
bool QuickSettings::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
return false;
}
bool QuickSettings::Refresh() {
return running;
}

View file

@ -29,7 +29,6 @@ namespace Pinetime {
bool Refresh() override;
bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
void OnButtonEvent(lv_obj_t* object, lv_event_t event);
void UpdateScreen();