Skip to content

Commit 2e7b51c

Browse files
committed
clang-format and clang-tidy PineTimeStyle
1 parent 39157f2 commit 2e7b51c

2 files changed

Lines changed: 31 additions & 25 deletions

File tree

src/displayapp/screens/PineTimeStyle.cpp

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
using namespace Pinetime::Applications::Screens;
3939

4040
namespace {
41-
static void event_handler(lv_obj_t* obj, lv_event_t event) {
42-
PineTimeStyle* screen = static_cast<PineTimeStyle*>(obj->user_data);
41+
void event_handler(lv_obj_t* obj, lv_event_t event) {
42+
auto* screen = static_cast<PineTimeStyle*>(obj->user_data);
4343
screen->UpdateSelected(obj, event);
4444
}
4545
}
@@ -169,8 +169,8 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app,
169169

170170
// Step count gauge
171171
if (settingsController.GetPTSColorBar() == Pinetime::Controllers::Settings::Colors::White) {
172-
needle_colors[0] = LV_COLOR_BLACK;
173-
} else {
172+
needle_colors[0] = LV_COLOR_BLACK;
173+
} else {
174174
needle_colors[0] = LV_COLOR_WHITE;
175175
}
176176
stepGauge = lv_gauge_create(lv_scr_act(), nullptr);
@@ -305,7 +305,7 @@ PineTimeStyle::~PineTimeStyle() {
305305
}
306306

307307
bool PineTimeStyle::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
308-
if ((event == Pinetime::Applications::TouchEvents::LongTap) && (lv_obj_get_hidden(btnRandom) == true)) {
308+
if ((event == Pinetime::Applications::TouchEvents::LongTap) && lv_obj_get_hidden(btnRandom)) {
309309
lv_obj_set_hidden(btnSet, false);
310310
savedTick = lv_tick_get();
311311
return true;
@@ -392,7 +392,7 @@ void PineTimeStyle::Refresh() {
392392
char hoursChar[3];
393393
char ampmChar[5];
394394
if (settingsController.GetClockType() == Controllers::Settings::ClockType::H24) {
395-
sprintf(hoursChar, "%02d", hour);
395+
sprintf(hoursChar, "%02d", hour);
396396
} else {
397397
if (hour == 0 && hour != 12) {
398398
hour = 12;
@@ -447,7 +447,7 @@ void PineTimeStyle::Refresh() {
447447
lv_obj_set_style_local_scale_grad_color(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
448448
}
449449
}
450-
if (lv_obj_get_hidden(btnSet) == false) {
450+
if (!lv_obj_get_hidden(btnSet)) {
451451
if ((savedTick > 0) && (lv_tick_get() - savedTick > 3000)) {
452452
lv_obj_set_hidden(btnSet, true);
453453
savedTick = 0;
@@ -463,57 +463,63 @@ void PineTimeStyle::UpdateSelected(lv_obj_t* object, lv_event_t event) {
463463
if (event == LV_EVENT_CLICKED) {
464464
if (object == btnNextTime) {
465465
valueTime = GetNext(valueTime);
466-
if(valueTime == valueBG)
466+
if (valueTime == valueBG) {
467467
valueTime = GetNext(valueTime);
468+
}
468469
settingsController.SetPTSColorTime(valueTime);
469470
lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime));
470471
lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime));
471472
lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime));
472473
}
473474
if (object == btnPrevTime) {
474475
valueTime = GetPrevious(valueTime);
475-
if(valueTime == valueBG)
476+
if (valueTime == valueBG) {
476477
valueTime = GetPrevious(valueTime);
478+
}
477479
settingsController.SetPTSColorTime(valueTime);
478480
lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime));
479481
lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime));
480482
lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime));
481483
}
482484
if (object == btnNextBar) {
483485
valueBar = GetNext(valueBar);
484-
if(valueBar == Controllers::Settings::Colors::Black)
486+
if (valueBar == Controllers::Settings::Colors::Black) {
485487
valueBar = GetNext(valueBar);
486-
if(valueBar == Controllers::Settings::Colors::White) {
487-
needle_colors[0] = LV_COLOR_BLACK;
488-
} else {
488+
}
489+
if (valueBar == Controllers::Settings::Colors::White) {
490+
needle_colors[0] = LV_COLOR_BLACK;
491+
} else {
489492
needle_colors[0] = LV_COLOR_WHITE;
490493
}
491494
settingsController.SetPTSColorBar(valueBar);
492495
lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBar));
493496
}
494497
if (object == btnPrevBar) {
495498
valueBar = GetPrevious(valueBar);
496-
if(valueBar == Controllers::Settings::Colors::Black)
499+
if (valueBar == Controllers::Settings::Colors::Black) {
497500
valueBar = GetPrevious(valueBar);
498-
if(valueBar == Controllers::Settings::Colors::White) {
499-
needle_colors[0] = LV_COLOR_BLACK;
500-
} else {
501+
}
502+
if (valueBar == Controllers::Settings::Colors::White) {
503+
needle_colors[0] = LV_COLOR_BLACK;
504+
} else {
501505
needle_colors[0] = LV_COLOR_WHITE;
502506
}
503507
settingsController.SetPTSColorBar(valueBar);
504508
lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBar));
505509
}
506510
if (object == btnNextBG) {
507511
valueBG = GetNext(valueBG);
508-
if(valueBG == valueTime)
512+
if (valueBG == valueTime) {
509513
valueBG = GetNext(valueBG);
514+
}
510515
settingsController.SetPTSColorBG(valueBG);
511516
lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBG));
512517
}
513518
if (object == btnPrevBG) {
514519
valueBG = GetPrevious(valueBG);
515-
if(valueBG == valueTime)
520+
if (valueBG == valueTime) {
516521
valueBG = GetPrevious(valueBG);
522+
}
517523
settingsController.SetPTSColorBG(valueBG);
518524
lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBG));
519525
}
@@ -545,12 +551,12 @@ void PineTimeStyle::UpdateSelected(lv_obj_t* object, lv_event_t event) {
545551
}
546552
settingsController.SetPTSColorTime(static_cast<Controllers::Settings::Colors>(valueTime));
547553
lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime));
548-
lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime));
549-
lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime));
554+
lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime));
555+
lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime));
550556
settingsController.SetPTSColorBar(static_cast<Controllers::Settings::Colors>(valueBar));
551-
lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBar));
557+
lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBar));
552558
settingsController.SetPTSColorBG(static_cast<Controllers::Settings::Colors>(valueBG));
553-
lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBG));
559+
lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBG));
554560
}
555561
if (object == btnClose) {
556562
CloseMenu();

src/displayapp/screens/PineTimeStyle.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ namespace Pinetime {
5454
DirtyValue<uint32_t> stepCount {};
5555
DirtyValue<bool> notificationState {};
5656

57-
Pinetime::Controllers::Settings::Colors GetNext(Controllers::Settings::Colors color);
58-
Pinetime::Controllers::Settings::Colors GetPrevious(Controllers::Settings::Colors color);
57+
static Pinetime::Controllers::Settings::Colors GetNext(Controllers::Settings::Colors color);
58+
static Pinetime::Controllers::Settings::Colors GetPrevious(Controllers::Settings::Colors color);
5959

6060
lv_obj_t* btnNextTime;
6161
lv_obj_t* btnPrevTime;

0 commit comments

Comments
 (0)