Skip to content

Commit 94d384e

Browse files
committed
Reformatted the code to comply with clang-format.
1 parent e90c69c commit 94d384e

File tree

2 files changed

+64
-65
lines changed

2 files changed

+64
-65
lines changed

src/displayapp/screens/Calendar.cpp

+62-64
Original file line numberDiff line numberDiff line change
@@ -23,75 +23,73 @@ using namespace Pinetime::Applications::Screens;
2323

2424
Calendar::Calendar(Controllers::DateTime& dateTimeController) : dateTimeController {dateTimeController} {
2525

26-
// Create calendar object
27-
calendar = lv_calendar_create(lv_scr_act(), NULL);
28-
// Set size
29-
lv_obj_set_size(calendar, LV_HOR_RES, LV_VER_RES);
30-
// Set alignment
31-
lv_obj_align(calendar, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, -5);
32-
// Disable clicks
33-
lv_obj_set_click(calendar, false);
34-
35-
// Set style of today's date
36-
lv_obj_set_style_local_text_color(calendar, LV_CALENDAR_PART_DATE, LV_STATE_FOCUSED, LV_COLOR_RED);
37-
38-
// Set style of inactive month's days
39-
lv_obj_set_style_local_text_color(calendar, LV_CALENDAR_PART_DATE, LV_STATE_DISABLED, lv_color_hex(0x505050));
40-
41-
// Get today's date
42-
current.year = static_cast<int>(dateTimeController.Year());
43-
current.month = static_cast<int>(dateTimeController.Month());
44-
current.day = static_cast<int>(dateTimeController.Day());
45-
46-
// Set today's date
47-
lv_calendar_set_today_date(calendar, &current);
48-
lv_calendar_set_showed_date(calendar, &current);
26+
// Create calendar object
27+
calendar = lv_calendar_create(lv_scr_act(), NULL);
28+
// Set size
29+
lv_obj_set_size(calendar, LV_HOR_RES, LV_VER_RES);
30+
// Set alignment
31+
lv_obj_align(calendar, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, -5);
32+
// Disable clicks
33+
lv_obj_set_click(calendar, false);
34+
35+
// Set style of today's date
36+
lv_obj_set_style_local_text_color(calendar, LV_CALENDAR_PART_DATE, LV_STATE_FOCUSED, LV_COLOR_RED);
37+
38+
// Set style of inactive month's days
39+
lv_obj_set_style_local_text_color(calendar, LV_CALENDAR_PART_DATE, LV_STATE_DISABLED, lv_color_hex(0x505050));
40+
41+
// Get today's date
42+
current.year = static_cast<int>(dateTimeController.Year());
43+
current.month = static_cast<int>(dateTimeController.Month());
44+
current.day = static_cast<int>(dateTimeController.Day());
45+
46+
// Set today's date
47+
lv_calendar_set_today_date(calendar, &current);
48+
lv_calendar_set_showed_date(calendar, &current);
4949
}
5050

5151
bool Calendar::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
52-
switch (event) {
53-
case TouchEvents::SwipeLeft: {
54-
if (current.month == 12) {
55-
current.month = 1;
56-
current.year++;
57-
}
58-
else{
59-
current.month++;
60-
}
61-
62-
lv_calendar_set_showed_date(calendar, &current);
63-
return true;
64-
}
65-
case TouchEvents::SwipeRight: {
66-
if (current.month == 1) {
67-
current.month = 12;
68-
current.year--;
69-
}
70-
else{
71-
current.month--;
72-
}
73-
74-
lv_calendar_set_showed_date(calendar, &current);
75-
return true;
76-
}
77-
/*
78-
case TouchEvents::SwipeUp: {
79-
current.year++;
80-
lv_calendar_set_showed_date(calendar, &current);
81-
return true;
82-
}
83-
case TouchEvents::SwipeDown: {
84-
current.year--;
85-
lv_calendar_set_showed_date(calendar, &current);
86-
return true;
87-
}
88-
*/
89-
default: {
90-
return false;
91-
}
52+
switch (event) {
53+
case TouchEvents::SwipeLeft: {
54+
if (current.month == 12) {
55+
current.month = 1;
56+
current.year++;
57+
} else {
58+
current.month++;
59+
}
60+
61+
lv_calendar_set_showed_date(calendar, &current);
62+
return true;
9263
}
64+
case TouchEvents::SwipeRight: {
65+
if (current.month == 1) {
66+
current.month = 12;
67+
current.year--;
68+
} else {
69+
current.month--;
70+
}
71+
72+
lv_calendar_set_showed_date(calendar, &current);
73+
return true;
74+
}
75+
/*
76+
case TouchEvents::SwipeUp: {
77+
current.year++;
78+
lv_calendar_set_showed_date(calendar, &current);
79+
return true;
80+
}
81+
case TouchEvents::SwipeDown: {
82+
current.year--;
83+
lv_calendar_set_showed_date(calendar, &current);
84+
return true;
85+
}
86+
*/
87+
default: {
88+
return false;
89+
}
90+
}
9391
}
9492

9593
Calendar::~Calendar() {
96-
lv_obj_clean(lv_scr_act());
94+
lv_obj_clean(lv_scr_act());
9795
}

src/displayapp/screens/Calendar.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "displayapp/screens/Screen.h"
2424
#include "components/datetime/DateTimeController.h"
2525
#include <lvgl/lvgl.h>
26-
26+
2727
#include "Symbols.h"
2828

2929
namespace Pinetime {
@@ -37,6 +37,7 @@ namespace Pinetime {
3737
public:
3838
Calendar(Controllers::DateTime& dateTimeController);
3939
~Calendar() override;
40+
4041
private:
4142
bool OnTouchEvent(TouchEvents event);
4243
Controllers::DateTime& dateTimeController;

0 commit comments

Comments
 (0)