Skip to content

Commit 57c696e

Browse files
author
Aaron Züger
committed
better class / variable names, A24HourMode-->AClockStyle
1 parent 3862aa5 commit 57c696e

3 files changed

Lines changed: 24 additions & 24 deletions

File tree

src/components/settings/Settings.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ namespace Pinetime {
3636
};
3737
enum class PTSGaugeStyle : uint8_t { Full, Half, Numeric };
3838
enum class PTSWeather : uint8_t { On, Off };
39-
enum class A24HourMode : uint8_t { On, Off };
39+
enum class AClockStyle : uint8_t { H24, H12 };
4040
enum class ASecondHand : uint8_t { On, Off };
4141

4242
struct PineTimeStyle {
@@ -48,7 +48,7 @@ namespace Pinetime {
4848
};
4949

5050
struct Analog {
51-
A24HourMode tfHourEnable = A24HourMode::Off;
51+
AClockStyle tfHourEnable = AClockStyle::H12;
5252
ASecondHand secondHandEnable = ASecondHand::On;
5353
};
5454

@@ -161,13 +161,13 @@ namespace Pinetime {
161161
return settings.PTS.weatherEnable;
162162
};
163163

164-
void SetA24HourMode(A24HourMode tfHourEnable) {
164+
void SetAClockStyle(AClockStyle tfHourEnable) {
165165
if (tfHourEnable != settings.A.tfHourEnable)
166166
settingsChanged = true;
167167
settings.A.tfHourEnable = tfHourEnable;
168168
};
169169

170-
A24HourMode GetA24HourMode() const {
170+
AClockStyle GetAClockStyle() const {
171171
return settings.A.tfHourEnable;
172172
};
173173

src/displayapp/screens/WatchFaceAnalog.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ WatchFaceAnalog::WatchFaceAnalog(Controllers::DateTime& dateTimeController,
6565
sTfHourEnable = true;
6666

6767
minor_scales = lv_linemeter_create(lv_scr_act(), nullptr);
68-
if (settingsController.GetA24HourMode() == Pinetime::Controllers::Settings::A24HourMode::On) {
68+
if (settingsController.GetAClockStyle() == Pinetime::Controllers::Settings::AClockStyle::H24) {
6969
lv_linemeter_set_scale(minor_scales, 360, 61);
7070
} else {
7171
lv_linemeter_set_scale(minor_scales, 300, 51);
@@ -79,7 +79,7 @@ WatchFaceAnalog::WatchFaceAnalog(Controllers::DateTime& dateTimeController,
7979
lv_obj_set_style_local_scale_end_color(minor_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
8080

8181
major_scales = lv_linemeter_create(lv_scr_act(), nullptr);
82-
if (settingsController.GetA24HourMode() == Pinetime::Controllers::Settings::A24HourMode::On) {
82+
if (settingsController.GetAClockStyle() == Pinetime::Controllers::Settings::AClockStyle::H24) {
8383
lv_linemeter_set_scale(major_scales, 360, 13);
8484
lv_linemeter_set_angle_offset(major_scales, 30);
8585
lv_obj_set_style_local_scale_width(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 4);
@@ -97,7 +97,7 @@ WatchFaceAnalog::WatchFaceAnalog(Controllers::DateTime& dateTimeController,
9797

9898

9999
large_scales = lv_linemeter_create(lv_scr_act(), nullptr);
100-
if (settingsController.GetA24HourMode() == Pinetime::Controllers::Settings::A24HourMode::On) {
100+
if (settingsController.GetAClockStyle() == Pinetime::Controllers::Settings::AClockStyle::H24) {
101101
lv_linemeter_set_scale(large_scales, 360, 13);
102102
lv_linemeter_set_angle_offset(large_scales, 15);
103103
lv_obj_set_size(large_scales, 225, 225);
@@ -154,7 +154,7 @@ WatchFaceAnalog::WatchFaceAnalog(Controllers::DateTime& dateTimeController,
154154
twelve = lv_label_create(lv_scr_act(), nullptr);
155155
lv_label_set_align(twelve, LV_LABEL_ALIGN_CENTER);
156156
lv_label_set_text_static(twelve, "12");
157-
if (settingsController.GetA24HourMode() == Pinetime::Controllers::Settings::A24HourMode::On) {
157+
if (settingsController.GetAClockStyle() == Pinetime::Controllers::Settings::AClockStyle::H24) {
158158
lv_obj_set_pos(twelve, 107, 198);
159159
} else {
160160
lv_obj_set_pos(twelve, 107, 10);
@@ -191,7 +191,7 @@ WatchFaceAnalog::WatchFaceAnalog(Controllers::DateTime& dateTimeController,
191191
/* lv_obj_set_pos(twentytwo, 62, 30); */
192192
/* lv_obj_set_style_local_text_color(twentytwo, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA); */
193193

194-
if (settingsController.GetA24HourMode() == Pinetime::Controllers::Settings::A24HourMode::On) {
194+
if (settingsController.GetAClockStyle() == Pinetime::Controllers::Settings::AClockStyle::H24) {
195195
lv_obj_set_hidden(zero, false);
196196
/* lv_obj_set_hidden(two, false); */
197197
/* lv_obj_set_hidden(four, false); */
@@ -294,15 +294,15 @@ WatchFaceAnalog::WatchFaceAnalog(Controllers::DateTime& dateTimeController,
294294
lv_obj_set_event_cb(btnClose, event_handler);
295295
lv_obj_set_hidden(btnClose, true);
296296

297-
btn24HourMode = lv_btn_create(lv_scr_act(), nullptr);
298-
btn24HourMode->user_data = this;
299-
lv_obj_set_size(btn24HourMode, 160, 60);
300-
lv_obj_align(btn24HourMode, lv_scr_act(), LV_ALIGN_CENTER, 0, -10);
301-
lv_obj_set_style_local_bg_opa(btn24HourMode, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50);
302-
lv_obj_t* lbl24HourMode = lv_label_create(btn24HourMode, nullptr);
303-
lv_label_set_text_static(lbl24HourMode, "Toggle 24h");
304-
lv_obj_set_event_cb(btn24HourMode, event_handler);
305-
lv_obj_set_hidden(btn24HourMode, true);
297+
btnClockStyle = lv_btn_create(lv_scr_act(), nullptr);
298+
btnClockStyle->user_data = this;
299+
lv_obj_set_size(btnClockStyle, 160, 60);
300+
lv_obj_align(btnClockStyle, lv_scr_act(), LV_ALIGN_CENTER, 0, -10);
301+
lv_obj_set_style_local_bg_opa(btnClockStyle, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50);
302+
lv_obj_t* lblClockStyle = lv_label_create(btnClockStyle, nullptr);
303+
lv_label_set_text_static(lblClockStyle, "Toggle 24h");
304+
lv_obj_set_event_cb(btnClockStyle, event_handler);
305+
lv_obj_set_hidden(btnClockStyle, true);
306306

307307
btnSecondHand = lv_btn_create(lv_scr_act(), nullptr);
308308
btnSecondHand->user_data = this;
@@ -335,7 +335,7 @@ WatchFaceAnalog::~WatchFaceAnalog() {
335335
bool WatchFaceAnalog::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
336336
if ((event == Pinetime::Applications::TouchEvents::LongTap) && lv_obj_get_hidden(btnClose)) {
337337
lv_obj_set_hidden(btnClose, false);
338-
lv_obj_set_hidden(btn24HourMode, false);
338+
lv_obj_set_hidden(btnClockStyle, false);
339339
lv_obj_set_hidden(btnSecondHand, false);
340340
savedTick = lv_tick_get();
341341
return true;
@@ -349,7 +349,7 @@ bool WatchFaceAnalog::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
349349
void WatchFaceAnalog::CloseMenu() {
350350
settingsController.SaveSettings();
351351
lv_obj_set_hidden(btnClose, true);
352-
lv_obj_set_hidden(btn24HourMode, true);
352+
lv_obj_set_hidden(btnClockStyle, true);
353353
lv_obj_set_hidden(btnSecondHand, true);
354354
}
355355

@@ -466,7 +466,7 @@ void WatchFaceAnalog::UpdateSelected(lv_obj_t* object, lv_event_t event) {
466466
CloseMenu();
467467
}
468468

469-
if (object == btn24HourMode) {
469+
if (object == btnClockStyle) {
470470
if (tfHourEnable == false) {
471471
// set mode to 24 hours
472472
tfHourEnable = true;
@@ -488,7 +488,7 @@ void WatchFaceAnalog::UpdateSelected(lv_obj_t* object, lv_event_t event) {
488488
lv_obj_set_style_local_scale_width(large_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 10);
489489
lv_obj_set_style_local_scale_end_line_width(large_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 3);
490490

491-
settingsController.SetA24HourMode(Controllers::Settings::A24HourMode::On);
491+
settingsController.SetAClockStyle(Controllers::Settings::AClockStyle::H24);
492492
} else {
493493
// set mode to 12 hours
494494
tfHourEnable = false;
@@ -510,7 +510,7 @@ void WatchFaceAnalog::UpdateSelected(lv_obj_t* object, lv_event_t event) {
510510
lv_obj_set_style_local_scale_width(large_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 20);
511511
lv_obj_set_style_local_scale_end_line_width(large_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 4);
512512

513-
settingsController.SetA24HourMode(Controllers::Settings::A24HourMode::Off);
513+
settingsController.SetAClockStyle(Controllers::Settings::AClockStyle::H12);
514514
}
515515
}
516516

src/displayapp/screens/WatchFaceAnalog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ namespace Pinetime {
5454
bool tfHourEnable, sTfHourEnable;
5555

5656
lv_obj_t* btnClose;
57-
lv_obj_t* btn24HourMode;
57+
lv_obj_t* btnClockStyle;
5858
lv_obj_t* btnSecondHand;
5959
lv_obj_t* minor_scales;
6060
lv_obj_t* major_scales;

0 commit comments

Comments
 (0)