summaryrefslogtreecommitdiff
path: root/src/displayapp/screens/settings
diff options
context:
space:
mode:
authorFinlay Davidson <finlay.davidson@coderclass.nl>2022-05-09 17:16:08 +0200
committerRiku Isokoski <riksu9000@gmail.com>2022-06-05 09:15:46 +0300
commit7f45538eb53235ab4015fcf13533796c8759c7bc (patch)
tree79d9a2f60e8fb13cb5356bcc5c6e93259449530b /src/displayapp/screens/settings
parent718fbdab98ae80923a548ac03b7843f5d618a4f6 (diff)
Apply clang-format to all C++ files
Diffstat (limited to 'src/displayapp/screens/settings')
-rw-r--r--src/displayapp/screens/settings/QuickSettings.cpp6
-rw-r--r--src/displayapp/screens/settings/SettingBluetooth.cpp1
-rw-r--r--src/displayapp/screens/settings/SettingDisplay.cpp2
-rw-r--r--src/displayapp/screens/settings/SettingSetDate.cpp20
-rw-r--r--src/displayapp/screens/settings/SettingSetDate.h48
-rw-r--r--src/displayapp/screens/settings/SettingShakeThreshold.cpp8
-rw-r--r--src/displayapp/screens/settings/SettingShakeThreshold.h4
-rw-r--r--src/displayapp/screens/settings/SettingSteps.cpp27
-rw-r--r--src/displayapp/screens/settings/Settings.cpp32
9 files changed, 72 insertions, 76 deletions
diff --git a/src/displayapp/screens/settings/QuickSettings.cpp b/src/displayapp/screens/settings/QuickSettings.cpp
index fe8f3cb4..708d5109 100644
--- a/src/displayapp/screens/settings/QuickSettings.cpp
+++ b/src/displayapp/screens/settings/QuickSettings.cpp
@@ -44,7 +44,7 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app,
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);
@@ -67,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);
@@ -98,7 +98,7 @@ 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);
diff --git a/src/displayapp/screens/settings/SettingBluetooth.cpp b/src/displayapp/screens/settings/SettingBluetooth.cpp
index 2fc5d95c..c66be3e9 100644
--- a/src/displayapp/screens/settings/SettingBluetooth.cpp
+++ b/src/displayapp/screens/settings/SettingBluetooth.cpp
@@ -90,4 +90,3 @@ void SettingBluetooth::OnBluetoothEnabled(lv_obj_t* object, lv_event_t event) {
settingsController.SetBleRadioEnabled(true);
}
}
-
diff --git a/src/displayapp/screens/settings/SettingDisplay.cpp b/src/displayapp/screens/settings/SettingDisplay.cpp
index 229143f7..bf2087ab 100644
--- a/src/displayapp/screens/settings/SettingDisplay.cpp
+++ b/src/displayapp/screens/settings/SettingDisplay.cpp
@@ -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 8bfded34..7acf0c19 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 477337ff..a1795942 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 0cf5821c..aac1eaff 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);
diff --git a/src/displayapp/screens/settings/SettingShakeThreshold.h b/src/displayapp/screens/settings/SettingShakeThreshold.h
index 37f4a65e..43319468 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 5ca3eecd..e92600c2 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/Settings.cpp b/src/displayapp/screens/settings/Settings.cpp
index bc7efcc2..a91b8f77 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);