diff options
Diffstat (limited to 'src/displayapp/screens/settings')
14 files changed, 98 insertions, 106 deletions
diff --git a/src/displayapp/screens/settings/QuickSettings.cpp b/src/displayapp/screens/settings/QuickSettings.cpp index 388525b..708d510 100644 --- a/src/displayapp/screens/settings/QuickSettings.cpp +++ b/src/displayapp/screens/settings/QuickSettings.cpp @@ -6,12 +6,12 @@ using namespace Pinetime::Applications::Screens; namespace { - static void ButtonEventHandler(lv_obj_t* obj, lv_event_t event) { + void ButtonEventHandler(lv_obj_t* obj, lv_event_t event) { auto* screen = static_cast<QuickSettings*>(obj->user_data); screen->OnButtonEvent(obj, event); } - static void lv_update_task(struct _lv_task_t* task) { + void lv_update_task(struct _lv_task_t* task) { auto* user_data = static_cast<QuickSettings*>(task->user_data); user_data->UpdateScreen(); } @@ -35,23 +35,21 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app, // Time label_time = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text(label_time, dateTimeController.FormattedTime().c_str()); lv_label_set_align(label_time, LV_LABEL_ALIGN_CENTER); lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 0, 0); - batteryIcon = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text_static(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining())); - lv_obj_align(batteryIcon, nullptr, LV_ALIGN_IN_TOP_RIGHT, 0, 0); + batteryIcon.Create(lv_scr_act()); + lv_obj_align(batteryIcon.GetObject(), nullptr, LV_ALIGN_IN_TOP_RIGHT, 0, 0); static constexpr uint8_t barHeight = 20 + innerDistance; static constexpr uint8_t buttonHeight = (LV_VER_RES_MAX - barHeight - innerDistance) / 2; static constexpr uint8_t buttonWidth = (LV_HOR_RES_MAX - innerDistance) / 2; // wide buttons - //static constexpr uint8_t buttonWidth = buttonHeight; // square buttons + // static constexpr uint8_t buttonWidth = buttonHeight; // square buttons static constexpr uint8_t buttonXOffset = (LV_HOR_RES_MAX - buttonWidth * 2 - innerDistance) / 2; lv_style_init(&btn_style); lv_style_set_radius(&btn_style, LV_STATE_DEFAULT, buttonHeight / 4); - lv_style_set_bg_color(&btn_style, LV_STATE_DEFAULT, lv_color_hex(0x111111)); + lv_style_set_bg_color(&btn_style, LV_STATE_DEFAULT, LV_COLOR_MAKE(0x38, 0x38, 0x38)); btn1 = lv_btn_create(lv_scr_act(), nullptr); btn1->user_data = this; @@ -69,7 +67,7 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app, lv_obj_set_event_cb(btn2, ButtonEventHandler); lv_obj_add_style(btn2, LV_BTN_PART_MAIN, &btn_style); lv_obj_set_size(btn2, buttonWidth, buttonHeight); - lv_obj_align(btn2, nullptr, LV_ALIGN_IN_TOP_RIGHT, - buttonXOffset, barHeight); + lv_obj_align(btn2, nullptr, LV_ALIGN_IN_TOP_RIGHT, -buttonXOffset, barHeight); lv_obj_t* lbl_btn; lbl_btn = lv_label_create(btn2, nullptr); @@ -81,7 +79,7 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app, lv_obj_set_event_cb(btn3, ButtonEventHandler); lv_btn_set_checkable(btn3, true); lv_obj_add_style(btn3, LV_BTN_PART_MAIN, &btn_style); - lv_obj_set_style_local_bg_color(btn3, LV_BTN_PART_MAIN, LV_STATE_CHECKED, LV_COLOR_GREEN); + lv_obj_set_style_local_bg_color(btn3, LV_BTN_PART_MAIN, LV_STATE_CHECKED, LV_COLOR_MAKE(0x0, 0xb0, 0x0)); lv_obj_set_size(btn3, buttonWidth, buttonHeight); lv_obj_align(btn3, nullptr, LV_ALIGN_IN_BOTTOM_LEFT, buttonXOffset, 0); @@ -100,19 +98,15 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app, lv_obj_set_event_cb(btn4, ButtonEventHandler); lv_obj_add_style(btn4, LV_BTN_PART_MAIN, &btn_style); lv_obj_set_size(btn4, buttonWidth, buttonHeight); - lv_obj_align(btn4, nullptr, LV_ALIGN_IN_BOTTOM_RIGHT, - buttonXOffset, 0); + lv_obj_align(btn4, nullptr, LV_ALIGN_IN_BOTTOM_RIGHT, -buttonXOffset, 0); lbl_btn = lv_label_create(btn4, nullptr); lv_obj_set_style_local_text_font(lbl_btn, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48); lv_label_set_text_static(lbl_btn, Symbols::settings); - lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); - lv_obj_set_size(backgroundLabel, 240, 240); - lv_obj_set_pos(backgroundLabel, 0, 0); - lv_label_set_text_static(backgroundLabel, ""); - taskUpdate = lv_task_create(lv_update_task, 5000, LV_TASK_PRIO_MID, this); + + UpdateScreen(); } QuickSettings::~QuickSettings() { @@ -124,7 +118,7 @@ QuickSettings::~QuickSettings() { void QuickSettings::UpdateScreen() { lv_label_set_text(label_time, dateTimeController.FormattedTime().c_str()); - lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining())); + batteryIcon.SetBatteryPercentage(batteryController.PercentRemaining()); } void QuickSettings::OnButtonEvent(lv_obj_t* object, lv_event_t event) { diff --git a/src/displayapp/screens/settings/QuickSettings.h b/src/displayapp/screens/settings/QuickSettings.h index 7913898..40a2a2e 100644 --- a/src/displayapp/screens/settings/QuickSettings.h +++ b/src/displayapp/screens/settings/QuickSettings.h @@ -8,6 +8,7 @@ #include "components/motor/MotorController.h" #include "components/settings/Settings.h" #include "components/battery/BatteryController.h" +#include <displayapp/screens/BatteryIcon.h> namespace Pinetime { @@ -37,7 +38,6 @@ namespace Pinetime { Controllers::Settings& settingsController; lv_task_t* taskUpdate; - lv_obj_t* batteryIcon; lv_obj_t* label_time; lv_style_t btn_style; @@ -48,6 +48,8 @@ namespace Pinetime { lv_obj_t* btn3; lv_obj_t* btn3_lvl; lv_obj_t* btn4; + + BatteryIcon batteryIcon; }; } } diff --git a/src/displayapp/screens/settings/SettingBluetooth.cpp b/src/displayapp/screens/settings/SettingBluetooth.cpp index ed7fbee..09556c4 100644 --- a/src/displayapp/screens/settings/SettingBluetooth.cpp +++ b/src/displayapp/screens/settings/SettingBluetooth.cpp @@ -9,12 +9,12 @@ using namespace Pinetime::Applications::Screens; namespace { - static void OnBluetoothDisabledEvent(lv_obj_t* obj, lv_event_t event) { + void OnBluetoothDisabledEvent(lv_obj_t* obj, lv_event_t event) { auto* screen = static_cast<SettingBluetooth*>(obj->user_data); screen->OnBluetoothDisabled(obj, event); } - static void OnBluetoothEnabledEvent(lv_obj_t* obj, lv_event_t event) { + void OnBluetoothEnabledEvent(lv_obj_t* obj, lv_event_t event) { auto* screen = static_cast<SettingBluetooth*>(obj->user_data); screen->OnBluetoothEnabled(obj, event); } @@ -108,4 +108,3 @@ void SettingBluetooth::OnBluetoothPasskeyEnableToggle(lv_obj_t* object, lv_event lv_checkbox_set_checked(cbPasskey, enabled); } } - diff --git a/src/displayapp/screens/settings/SettingChimes.cpp b/src/displayapp/screens/settings/SettingChimes.cpp index ae89a49..d07b0d4 100644 --- a/src/displayapp/screens/settings/SettingChimes.cpp +++ b/src/displayapp/screens/settings/SettingChimes.cpp @@ -8,8 +8,8 @@ using namespace Pinetime::Applications::Screens; namespace { - static void event_handler(lv_obj_t* obj, lv_event_t event) { - SettingChimes* screen = static_cast<SettingChimes*>(obj->user_data); + void event_handler(lv_obj_t* obj, lv_event_t event) { + auto* screen = static_cast<SettingChimes*>(obj->user_data); screen->UpdateSelected(obj, event); } } diff --git a/src/displayapp/screens/settings/SettingDisplay.cpp b/src/displayapp/screens/settings/SettingDisplay.cpp index 9e972af..bf2087a 100644 --- a/src/displayapp/screens/settings/SettingDisplay.cpp +++ b/src/displayapp/screens/settings/SettingDisplay.cpp @@ -9,8 +9,8 @@ using namespace Pinetime::Applications::Screens; namespace { - static void event_handler(lv_obj_t* obj, lv_event_t event) { - SettingDisplay* screen = static_cast<SettingDisplay*>(obj->user_data); + void event_handler(lv_obj_t* obj, lv_event_t event) { + auto* screen = static_cast<SettingDisplay*>(obj->user_data); screen->UpdateSelected(obj, event); } } @@ -46,7 +46,7 @@ SettingDisplay::SettingDisplay(Pinetime::Applications::DisplayApp* app, Pinetime char buffer[12]; for (unsigned int i = 0; i < options.size(); i++) { cbOption[i] = lv_checkbox_create(container1, nullptr); - sprintf(buffer, "%3d seconds", options[i] / 1000); + sprintf(buffer, "%3d seconds", options[i] / 1000); lv_checkbox_set_text(cbOption[i], buffer); cbOption[i]->user_data = this; lv_obj_set_event_cb(cbOption[i], event_handler); diff --git a/src/displayapp/screens/settings/SettingSetDate.cpp b/src/displayapp/screens/settings/SettingSetDate.cpp index 8bfded3..7acf0c1 100644 --- a/src/displayapp/screens/settings/SettingSetDate.cpp +++ b/src/displayapp/screens/settings/SettingSetDate.cpp @@ -15,23 +15,22 @@ namespace { constexpr int16_t POS_Y_TEXT = -6; constexpr int16_t POS_Y_MINUS = 40; - void event_handler(lv_obj_t * obj, lv_event_t event) { - auto* screen = static_cast<SettingSetDate *>(obj->user_data); + void event_handler(lv_obj_t* obj, lv_event_t event) { + auto* screen = static_cast<SettingSetDate*>(obj->user_data); screen->HandleButtonPress(obj, event); } } -SettingSetDate::SettingSetDate(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::DateTime &dateTimeController) : - Screen(app), - dateTimeController {dateTimeController} { - lv_obj_t * title = lv_label_create(lv_scr_act(), nullptr); +SettingSetDate::SettingSetDate(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::DateTime& dateTimeController) + : Screen(app), dateTimeController {dateTimeController} { + lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr); lv_label_set_text_static(title, "Set current date"); lv_label_set_align(title, LV_LABEL_ALIGN_CENTER); lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 15, 15); - lv_obj_t * icon = lv_label_create(lv_scr_act(), nullptr); + lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE); - + lv_label_set_text_static(icon, Symbols::clock); lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER); lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0); @@ -113,7 +112,7 @@ SettingSetDate::~SettingSetDate() { lv_obj_clean(lv_scr_act()); } -void SettingSetDate::HandleButtonPress(lv_obj_t *object, lv_event_t event) { +void SettingSetDate::HandleButtonPress(lv_obj_t* object, lv_event_t event) { if (event != LV_EVENT_CLICKED) return; @@ -194,5 +193,6 @@ void SettingSetDate::CheckDay() { void SettingSetDate::UpdateMonthLabel() { lv_label_set_text_static( - lblMonth, Pinetime::Controllers::DateTime::MonthShortToStringLow(static_cast<Pinetime::Controllers::DateTime::Months>(monthValue))); + lblMonth, + Pinetime::Controllers::DateTime::MonthShortToStringLow(static_cast<Pinetime::Controllers::DateTime::Months>(monthValue))); } diff --git a/src/displayapp/screens/settings/SettingSetDate.h b/src/displayapp/screens/settings/SettingSetDate.h index 477337f..a179594 100644 --- a/src/displayapp/screens/settings/SettingSetDate.h +++ b/src/displayapp/screens/settings/SettingSetDate.h @@ -8,33 +8,33 @@ namespace Pinetime { namespace Applications { namespace Screens { - class SettingSetDate : public Screen{ - public: - SettingSetDate(DisplayApp* app, Pinetime::Controllers::DateTime &dateTimeController); - ~SettingSetDate() override; + class SettingSetDate : public Screen { + public: + SettingSetDate(DisplayApp* app, Pinetime::Controllers::DateTime& dateTimeController); + ~SettingSetDate() override; - void HandleButtonPress(lv_obj_t *object, lv_event_t event); - - private: - Controllers::DateTime& dateTimeController; + void HandleButtonPress(lv_obj_t* object, lv_event_t event); - int dayValue; - int monthValue; - int yearValue; - lv_obj_t * lblDay; - lv_obj_t * lblMonth; - lv_obj_t * lblYear; - lv_obj_t * btnDayPlus; - lv_obj_t * btnDayMinus; - lv_obj_t * btnMonthPlus; - lv_obj_t * btnMonthMinus; - lv_obj_t * btnYearPlus; - lv_obj_t * btnYearMinus; - lv_obj_t * btnSetTime; + private: + Controllers::DateTime& dateTimeController; - int MaximumDayOfMonth() const; - void CheckDay(); - void UpdateMonthLabel(); + int dayValue; + int monthValue; + int yearValue; + lv_obj_t* lblDay; + lv_obj_t* lblMonth; + lv_obj_t* lblYear; + lv_obj_t* btnDayPlus; + lv_obj_t* btnDayMinus; + lv_obj_t* btnMonthPlus; + lv_obj_t* btnMonthMinus; + lv_obj_t* btnYearPlus; + lv_obj_t* btnYearMinus; + lv_obj_t* btnSetTime; + + int MaximumDayOfMonth() const; + void CheckDay(); + void UpdateMonthLabel(); }; } } diff --git a/src/displayapp/screens/settings/SettingShakeThreshold.cpp b/src/displayapp/screens/settings/SettingShakeThreshold.cpp index c354bdc..aac1eaf 100644 --- a/src/displayapp/screens/settings/SettingShakeThreshold.cpp +++ b/src/displayapp/screens/settings/SettingShakeThreshold.cpp @@ -64,9 +64,9 @@ SettingShakeThreshold::SettingShakeThreshold(DisplayApp* app, vDecay = xTaskGetTickCount(); calibrating = false; EnableForCal = false; - if(!settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::Shake)){ + if (!settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::Shake)) { EnableForCal = true; - settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::Shake,true); + settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::Shake, true); } refreshTask = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); } @@ -74,8 +74,8 @@ SettingShakeThreshold::SettingShakeThreshold(DisplayApp* app, SettingShakeThreshold::~SettingShakeThreshold() { settingsController.SetShakeThreshold(lv_arc_get_value(positionArc)); - if(EnableForCal){ - settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::Shake,false); + if (EnableForCal) { + settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::Shake, false); EnableForCal = false; } lv_task_del(refreshTask); @@ -123,8 +123,8 @@ void SettingShakeThreshold::UpdateSelected(lv_obj_t* object, lv_event_t event) { vCalTime = xTaskGetTickCount(); lv_label_set_text_static(calLabel, "Ready!"); lv_obj_set_click(positionArc, false); - lv_obj_set_style_local_bg_color(calButton, LV_BTN_PART_MAIN, LV_STATE_CHECKED, LV_COLOR_GREEN); - lv_obj_set_style_local_bg_color(calButton, LV_BTN_PART_MAIN, LV_STATE_CHECKED, LV_COLOR_GREEN); + lv_obj_set_style_local_bg_color(calButton, LV_BTN_PART_MAIN, LV_STATE_CHECKED, LV_COLOR_MAKE(0x0, 0xb0, 0x0)); + lv_obj_set_style_local_bg_color(calButton, LV_BTN_PART_MAIN, LV_STATE_CHECKED, LV_COLOR_MAKE(0x0, 0xb0, 0x0)); } else if (lv_btn_get_state(calButton) == LV_BTN_STATE_RELEASED) { calibrating = 0; lv_obj_set_click(positionArc, true); diff --git a/src/displayapp/screens/settings/SettingShakeThreshold.h b/src/displayapp/screens/settings/SettingShakeThreshold.h index 37f4a65..4331946 100644 --- a/src/displayapp/screens/settings/SettingShakeThreshold.h +++ b/src/displayapp/screens/settings/SettingShakeThreshold.h @@ -28,8 +28,8 @@ namespace Pinetime { System::SystemTask& systemTask; uint8_t calibrating; bool EnableForCal; - uint32_t vDecay,vCalTime; - lv_obj_t *positionArc, *animArc,*calButton, *calLabel; + uint32_t vDecay, vCalTime; + lv_obj_t *positionArc, *animArc, *calButton, *calLabel; lv_task_t* refreshTask; }; } diff --git a/src/displayapp/screens/settings/SettingSteps.cpp b/src/displayapp/screens/settings/SettingSteps.cpp index 5ca3eec..e92600c 100644 --- a/src/displayapp/screens/settings/SettingSteps.cpp +++ b/src/displayapp/screens/settings/SettingSteps.cpp @@ -12,15 +12,12 @@ namespace { } } -SettingSteps::SettingSteps( - Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Settings &settingsController) : - Screen(app), - settingsController{settingsController} -{ +SettingSteps::SettingSteps(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController) + : Screen(app), settingsController {settingsController} { - lv_obj_t * container1 = lv_cont_create(lv_scr_act(), nullptr); + lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr); - //lv_obj_set_style_local_bg_color(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111)); + // lv_obj_set_style_local_bg_color(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111)); lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP); lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10); lv_obj_set_style_local_pad_inner(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 5); @@ -31,13 +28,13 @@ SettingSteps::SettingSteps( lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT); lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text_static(title,"Daily steps goal"); + lv_label_set_text_static(title, "Daily steps goal"); lv_label_set_align(title, LV_LABEL_ALIGN_CENTER); lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 15, 15); lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE); - + lv_label_set_text_static(icon, Symbols::shoe); lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER); lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0); @@ -61,7 +58,6 @@ SettingSteps::SettingSteps( lv_obj_set_event_cb(btnMinus, event_handler); lv_obj_align(btnMinus, lv_scr_act(), LV_ALIGN_CENTER, -55, 80); lv_obj_set_style_local_value_str(btnMinus, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "-"); - } SettingSteps::~SettingSteps() { @@ -69,24 +65,23 @@ SettingSteps::~SettingSteps() { settingsController.SaveSettings(); } -void SettingSteps::UpdateSelected(lv_obj_t *object, lv_event_t event) { +void SettingSteps::UpdateSelected(lv_obj_t* object, lv_event_t event) { uint32_t value = settingsController.GetStepsGoal(); - if(object == btnPlus && (event == LV_EVENT_PRESSED)) { + if (object == btnPlus && (event == LV_EVENT_PRESSED)) { value += 1000; - if ( value <= 500000 ) { + if (value <= 500000) { settingsController.SetStepsGoal(value); lv_label_set_text_fmt(stepValue, "%lu", settingsController.GetStepsGoal()); lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_CENTER, 0, -10); } } - if(object == btnMinus && (event == LV_EVENT_PRESSED)) { + if (object == btnMinus && (event == LV_EVENT_PRESSED)) { value -= 1000; - if ( value >= 1000 ) { + if (value >= 1000) { settingsController.SetStepsGoal(value); lv_label_set_text_fmt(stepValue, "%lu", settingsController.GetStepsGoal()); lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_CENTER, 0, -10); } } - } diff --git a/src/displayapp/screens/settings/SettingTimeFormat.cpp b/src/displayapp/screens/settings/SettingTimeFormat.cpp index bd9af15..5502794 100644 --- a/src/displayapp/screens/settings/SettingTimeFormat.cpp +++ b/src/displayapp/screens/settings/SettingTimeFormat.cpp @@ -8,8 +8,8 @@ using namespace Pinetime::Applications::Screens; namespace { - static void event_handler(lv_obj_t* obj, lv_event_t event) { - SettingTimeFormat* screen = static_cast<SettingTimeFormat*>(obj->user_data); + void event_handler(lv_obj_t* obj, lv_event_t event) { + auto* screen = static_cast<SettingTimeFormat*>(obj->user_data); screen->UpdateSelected(obj, event); } } diff --git a/src/displayapp/screens/settings/SettingWakeUp.cpp b/src/displayapp/screens/settings/SettingWakeUp.cpp index e1b6e36..4a4b60f 100644 --- a/src/displayapp/screens/settings/SettingWakeUp.cpp +++ b/src/displayapp/screens/settings/SettingWakeUp.cpp @@ -8,8 +8,8 @@ using namespace Pinetime::Applications::Screens; namespace { - static void event_handler(lv_obj_t* obj, lv_event_t event) { - SettingWakeUp* screen = static_cast<SettingWakeUp*>(obj->user_data); + void event_handler(lv_obj_t* obj, lv_event_t event) { + auto* screen = static_cast<SettingWakeUp*>(obj->user_data); screen->UpdateSelected(obj, event); } } diff --git a/src/displayapp/screens/settings/SettingWatchFace.cpp b/src/displayapp/screens/settings/SettingWatchFace.cpp index 9e2748c..e6f940a 100644 --- a/src/displayapp/screens/settings/SettingWatchFace.cpp +++ b/src/displayapp/screens/settings/SettingWatchFace.cpp @@ -8,8 +8,8 @@ using namespace Pinetime::Applications::Screens; namespace { - static void event_handler(lv_obj_t* obj, lv_event_t event) { - SettingWatchFace* screen = static_cast<SettingWatchFace*>(obj->user_data); + void event_handler(lv_obj_t* obj, lv_event_t event) { + auto* screen = static_cast<SettingWatchFace*>(obj->user_data); screen->UpdateSelected(obj, event); } } diff --git a/src/displayapp/screens/settings/Settings.cpp b/src/displayapp/screens/settings/Settings.cpp index bc7efcc..a91b8f7 100644 --- a/src/displayapp/screens/settings/Settings.cpp +++ b/src/displayapp/screens/settings/Settings.cpp @@ -13,18 +13,19 @@ Settings::Settings(Pinetime::Applications::DisplayApp* app, Pinetime::Controller settingsController {settingsController}, screens {app, settingsController.GetSettingsMenu(), - {[this]() -> std::unique_ptr<Screen> { - return CreateScreen1(); - }, - [this]() -> std::unique_ptr<Screen> { - return CreateScreen2(); - }, - [this]() -> std::unique_ptr<Screen> { - return CreateScreen3(); - }, - [this]() -> std::unique_ptr<Screen> { - return CreateScreen4(); - }, + { + [this]() -> std::unique_ptr<Screen> { + return CreateScreen1(); + }, + [this]() -> std::unique_ptr<Screen> { + return CreateScreen2(); + }, + [this]() -> std::unique_ptr<Screen> { + return CreateScreen3(); + }, + [this]() -> std::unique_ptr<Screen> { + return CreateScreen4(); + }, }, Screens::ScreenListModes::UpDown} { } @@ -53,7 +54,8 @@ std::unique_ptr<Screen> Settings::CreateScreen2() { {Symbols::shoe, "Steps", Apps::SettingSteps}, {Symbols::clock, "Set date", Apps::SettingSetDate}, {Symbols::clock, "Set time", Apps::SettingSetTime}, - {Symbols::batteryHalf, "Battery", Apps::BatteryInfo}}}; + {Symbols::batteryHalf, "Battery", Apps::BatteryInfo}, + }}; return std::make_unique<Screens::List>(1, 4, app, settingsController, applications); } @@ -64,7 +66,7 @@ std::unique_ptr<Screen> Settings::CreateScreen3() { {Symbols::clock, "Chimes", Apps::SettingChimes}, {Symbols::tachometer, "Shake Calib.", Apps::SettingShakeThreshold}, {Symbols::check, "Firmware", Apps::FirmwareValidation}, - {Symbols::bluetooth, "Bluetooth", Apps::SettingBluetooth} + {Symbols::bluetooth, "Bluetooth", Apps::SettingBluetooth}, }}; return std::make_unique<Screens::List>(2, 4, app, settingsController, applications); @@ -76,7 +78,7 @@ std::unique_ptr<Screen> Settings::CreateScreen4() { {Symbols::list, "About", Apps::SysInfo}, {Symbols::none, "None", Apps::None}, {Symbols::none, "None", Apps::None}, - {Symbols::none, "None", Apps::None} + {Symbols::none, "None", Apps::None}, }}; return std::make_unique<Screens::List>(3, 4, app, settingsController, applications); |
