post rebase fixes
This commit is contained in:
parent
319dfd23e7
commit
917e46c684
|
@ -98,10 +98,6 @@ namespace Pinetime {
|
||||||
appMenu = menu;
|
appMenu = menu;
|
||||||
};
|
};
|
||||||
|
|
||||||
uint8_t GetAppMenu() const {
|
|
||||||
return appMenu;
|
|
||||||
};
|
|
||||||
|
|
||||||
void SetWatchfacesMenu(uint8_t menu) {
|
void SetWatchfacesMenu(uint8_t menu) {
|
||||||
watchFacesMenu = menu;
|
watchFacesMenu = menu;
|
||||||
};
|
};
|
||||||
|
@ -110,6 +106,11 @@ namespace Pinetime {
|
||||||
return watchFacesMenu;
|
return watchFacesMenu;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t GetAppMenu() const {
|
||||||
|
return appMenu;
|
||||||
|
};
|
||||||
|
|
||||||
void SetSettingsMenu(uint8_t menu) {
|
void SetSettingsMenu(uint8_t menu) {
|
||||||
settingsMenu = menu;
|
settingsMenu = menu;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
set(FONTS jetbrains_mono_42 jetbrains_mono_76 jetbrains_mono_bold_20
|
set(FONTS jetbrains_mono_42 jetbrains_mono_76 jetbrains_mono_bold_20
|
||||||
jetbrains_mono_extrabold_compressed lv_font_navi_80 lv_font_sys_48
|
jetbrains_mono_extrabold_compressed lv_font_navi_80 lv_font_sys_48
|
||||||
open_sans_light)
|
open_sans_light lv_font_dots_40 lv_font_7segment_40 lv_font_7segment_115)
|
||||||
find_program(LV_FONT_CONV "lv_font_conv" NO_CACHE REQUIRED
|
find_program(LV_FONT_CONV "lv_font_conv" NO_CACHE REQUIRED
|
||||||
HINTS "${CMAKE_SOURCE_DIR}/node_modules/.bin")
|
HINTS "${CMAKE_SOURCE_DIR}/node_modules/.bin")
|
||||||
message(STATUS "Using ${LV_FONT_CONV} to generate font files")
|
message(STATUS "Using ${LV_FONT_CONV} to generate font files")
|
||||||
|
|
|
@ -74,5 +74,35 @@
|
||||||
"bpp": 2,
|
"bpp": 2,
|
||||||
"size": 80,
|
"size": 80,
|
||||||
"compress": true
|
"compress": true
|
||||||
|
},
|
||||||
|
"lv_font_dots_40": {
|
||||||
|
"sources": [
|
||||||
|
{
|
||||||
|
"file": "repetitionscrolling.ttf",
|
||||||
|
"symbols": "0123456789-MONTUEWEDTHUFRISATSUN WK"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"bpp": 1,
|
||||||
|
"size": 40
|
||||||
|
},
|
||||||
|
"lv_font_7segment_40": {
|
||||||
|
"sources": [
|
||||||
|
{
|
||||||
|
"file": "7segment.woff",
|
||||||
|
"symbols": "0123456789: -"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"bpp": 1,
|
||||||
|
"size": 40
|
||||||
|
},
|
||||||
|
"lv_font_7segment_115": {
|
||||||
|
"sources": [
|
||||||
|
{
|
||||||
|
"file": "7segment.woff",
|
||||||
|
"symbols": "0123456789: -"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"bpp": 1,
|
||||||
|
"size": 115
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -15,7 +15,6 @@
|
||||||
#include "components/settings/Settings.h"
|
#include "components/settings/Settings.h"
|
||||||
using namespace Pinetime::Applications::Screens;
|
using namespace Pinetime::Applications::Screens;
|
||||||
|
|
||||||
|
|
||||||
WatchFaceCasioStyleG7710::WatchFaceCasioStyleG7710(DisplayApp* app,
|
WatchFaceCasioStyleG7710::WatchFaceCasioStyleG7710(DisplayApp* app,
|
||||||
Controllers::DateTime& dateTimeController,
|
Controllers::DateTime& dateTimeController,
|
||||||
Controllers::Battery& batteryController,
|
Controllers::Battery& batteryController,
|
||||||
|
@ -34,15 +33,21 @@ WatchFaceCasioStyleG7710::WatchFaceCasioStyleG7710(DisplayApp* app,
|
||||||
heartRateController {heartRateController},
|
heartRateController {heartRateController},
|
||||||
motionController {motionController} {
|
motionController {motionController} {
|
||||||
|
|
||||||
batteryIcon = lv_label_create(lv_scr_act(), nullptr);
|
|
||||||
lv_label_set_text_static(batteryIcon, Symbols::batteryFull);
|
label_battery_vallue = lv_label_create(lv_scr_act(), nullptr);
|
||||||
lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x98B69A));
|
lv_obj_align(label_battery_vallue, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, 0, 0);
|
||||||
lv_obj_align(batteryIcon, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, -5, 0);
|
lv_obj_set_style_local_text_color(label_battery_vallue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x98B69A));
|
||||||
|
lv_label_set_text_static(label_battery_vallue, "00%");
|
||||||
|
|
||||||
|
|
||||||
|
batteryIcon.Create(lv_scr_act());
|
||||||
|
batteryIcon.SetColor(lv_color_hex(0x98B69A));
|
||||||
|
lv_obj_align(batteryIcon.GetObject(), label_battery_vallue, LV_ALIGN_OUT_LEFT_MID, -5, 0);
|
||||||
|
|
||||||
batteryPlug = lv_label_create(lv_scr_act(), nullptr);
|
batteryPlug = lv_label_create(lv_scr_act(), nullptr);
|
||||||
lv_obj_set_style_local_text_color(batteryPlug, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x98B69A));
|
lv_obj_set_style_local_text_color(batteryPlug, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x98B69A));
|
||||||
lv_label_set_text_static(batteryPlug, Symbols::plug);
|
lv_label_set_text_static(batteryPlug, Symbols::plug);
|
||||||
lv_obj_align(batteryPlug, batteryIcon, LV_ALIGN_OUT_LEFT_MID, -5, 0);
|
lv_obj_align(batteryPlug, batteryIcon.GetObject(), LV_ALIGN_OUT_LEFT_MID, -5, 0);
|
||||||
|
|
||||||
bleIcon = lv_label_create(lv_scr_act(), nullptr);
|
bleIcon = lv_label_create(lv_scr_act(), nullptr);
|
||||||
lv_obj_set_style_local_text_color(bleIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x98B69A));
|
lv_obj_set_style_local_text_color(bleIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x98B69A));
|
||||||
|
@ -52,7 +57,7 @@ WatchFaceCasioStyleG7710::WatchFaceCasioStyleG7710(DisplayApp* app,
|
||||||
notificationIcon = lv_label_create(lv_scr_act(), nullptr);
|
notificationIcon = lv_label_create(lv_scr_act(), nullptr);
|
||||||
lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x98B69A));
|
lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x98B69A));
|
||||||
lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(false));
|
lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(false));
|
||||||
lv_obj_align(notificationIcon, nullptr, LV_ALIGN_IN_TOP_LEFT, 5, 0);
|
lv_obj_align(notificationIcon, bleIcon, LV_ALIGN_OUT_LEFT_MID, -5, 0);
|
||||||
|
|
||||||
|
|
||||||
label_day_of_week = lv_label_create(lv_scr_act(), nullptr);
|
label_day_of_week = lv_label_create(lv_scr_act(), nullptr);
|
||||||
|
@ -62,13 +67,13 @@ WatchFaceCasioStyleG7710::WatchFaceCasioStyleG7710(DisplayApp* app,
|
||||||
lv_label_set_text_static(label_day_of_week, "SUN");
|
lv_label_set_text_static(label_day_of_week, "SUN");
|
||||||
|
|
||||||
label_week_number = lv_label_create(lv_scr_act(), nullptr);
|
label_week_number = lv_label_create(lv_scr_act(), nullptr);
|
||||||
lv_obj_align(label_week_number, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 5, 34);
|
lv_obj_align(label_week_number, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 5, 22);
|
||||||
lv_obj_set_style_local_text_color(label_week_number, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x98B69A));
|
lv_obj_set_style_local_text_color(label_week_number, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x98B69A));
|
||||||
lv_obj_set_style_local_text_font(label_week_number, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_dots_40);
|
lv_obj_set_style_local_text_font(label_week_number, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_dots_40);
|
||||||
lv_label_set_text_static(label_week_number, "WK26");
|
lv_label_set_text_static(label_week_number, "WK26");
|
||||||
|
|
||||||
label_day_of_year = lv_label_create(lv_scr_act(), nullptr);
|
label_day_of_year = lv_label_create(lv_scr_act(), nullptr);
|
||||||
lv_obj_align(label_day_of_year, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 100, 25);
|
lv_obj_align(label_day_of_year, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 100, 30);
|
||||||
lv_obj_set_style_local_text_color(label_day_of_year, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x98B69A));
|
lv_obj_set_style_local_text_color(label_day_of_year, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x98B69A));
|
||||||
lv_obj_set_style_local_text_font(label_day_of_year, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_7segment_40);
|
lv_obj_set_style_local_text_font(label_day_of_year, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_7segment_40);
|
||||||
lv_label_set_text_static(label_day_of_year, "181-184");
|
lv_label_set_text_static(label_day_of_year, "181-184");
|
||||||
|
@ -85,20 +90,26 @@ WatchFaceCasioStyleG7710::WatchFaceCasioStyleG7710(DisplayApp* app,
|
||||||
lv_style_set_line_color(&style_border, LV_STATE_DEFAULT, lv_color_hex(0x98B69A));
|
lv_style_set_line_color(&style_border, LV_STATE_DEFAULT, lv_color_hex(0x98B69A));
|
||||||
lv_style_set_line_rounded(&style_border, LV_STATE_DEFAULT, true);
|
lv_style_set_line_rounded(&style_border, LV_STATE_DEFAULT, true);
|
||||||
|
|
||||||
|
line_icons = lv_line_create(lv_scr_act(), nullptr);
|
||||||
|
static lv_point_t line_icons_points[] = {{0, 5}, {117, 5}, {122, 0}};
|
||||||
|
lv_line_set_points(line_icons, line_icons_points, 3);
|
||||||
|
lv_obj_add_style(line_icons, LV_LINE_PART_MAIN, &style_line);
|
||||||
|
lv_obj_align(line_icons, NULL, LV_ALIGN_IN_TOP_RIGHT, -10, 18);
|
||||||
|
|
||||||
line_day_of_week_number = lv_line_create(lv_scr_act(), nullptr);
|
line_day_of_week_number = lv_line_create(lv_scr_act(), nullptr);
|
||||||
static lv_point_t line_day_of_week_number_points[] = {{0, 0}, {100, 0}, {94, 70}, {0, 70}};
|
static lv_point_t line_day_of_week_number_points[] = {{0, 0}, {100, 0}, {95, 95}, {0, 95}};
|
||||||
lv_line_set_points(line_day_of_week_number, line_day_of_week_number_points, 4);
|
lv_line_set_points(line_day_of_week_number, line_day_of_week_number_points, 4);
|
||||||
lv_obj_add_style(line_day_of_week_number, LV_LINE_PART_MAIN, &style_border);
|
lv_obj_add_style(line_day_of_week_number, LV_LINE_PART_MAIN, &style_border);
|
||||||
lv_obj_align(line_day_of_week_number, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 28);
|
lv_obj_align(line_day_of_week_number, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 8);
|
||||||
|
|
||||||
line_day_of_year = lv_line_create(lv_scr_act(), nullptr);
|
line_day_of_year = lv_line_create(lv_scr_act(), nullptr);
|
||||||
static lv_point_t line_day_of_year_points[] = {{0, 5}, {130, 5}, {135, 0}};
|
static lv_point_t line_day_of_year_points[] = {{0, 5}, {130, 5}, {135, 0}};
|
||||||
lv_line_set_points(line_day_of_year, line_day_of_year_points, 3);
|
lv_line_set_points(line_day_of_year, line_day_of_year_points, 3);
|
||||||
lv_obj_add_style(line_day_of_year, LV_LINE_PART_MAIN, &style_line);
|
lv_obj_add_style(line_day_of_year, LV_LINE_PART_MAIN, &style_line);
|
||||||
lv_obj_align(line_day_of_year, NULL, LV_ALIGN_IN_TOP_RIGHT, 0, 55);
|
lv_obj_align(line_day_of_year, NULL, LV_ALIGN_IN_TOP_RIGHT, 0, 60);
|
||||||
|
|
||||||
label_date = lv_label_create(lv_scr_act(), nullptr);
|
label_date = lv_label_create(lv_scr_act(), nullptr);
|
||||||
lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 100, 65);
|
lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 100, 70);
|
||||||
lv_obj_set_style_local_text_color(label_date, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x98B69A));
|
lv_obj_set_style_local_text_color(label_date, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x98B69A));
|
||||||
lv_obj_set_style_local_text_font(label_date, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_7segment_40);
|
lv_obj_set_style_local_text_font(label_date, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_7segment_40);
|
||||||
lv_label_set_text_static(label_date, "6-30");
|
lv_label_set_text_static(label_date, "6-30");
|
||||||
|
@ -107,18 +118,18 @@ WatchFaceCasioStyleG7710::WatchFaceCasioStyleG7710(DisplayApp* app,
|
||||||
static lv_point_t line_date_points[] = {{0, 5}, {135, 5}, {140, 0}};
|
static lv_point_t line_date_points[] = {{0, 5}, {135, 5}, {140, 0}};
|
||||||
lv_line_set_points(line_date, line_date_points, 3);
|
lv_line_set_points(line_date, line_date_points, 3);
|
||||||
lv_obj_add_style(line_date, LV_LINE_PART_MAIN, &style_line);
|
lv_obj_add_style(line_date, LV_LINE_PART_MAIN, &style_line);
|
||||||
lv_obj_align(line_date, NULL, LV_ALIGN_IN_TOP_RIGHT, 0, 95);
|
lv_obj_align(line_date, NULL, LV_ALIGN_IN_TOP_RIGHT, 0, 100);
|
||||||
|
|
||||||
label_time = lv_label_create(lv_scr_act(), nullptr);
|
label_time = lv_label_create(lv_scr_act(), nullptr);
|
||||||
lv_obj_set_style_local_text_color(label_time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x98B69A));
|
lv_obj_set_style_local_text_color(label_time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x98B69A));
|
||||||
lv_obj_set_style_local_text_font(label_time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_7segment_115);
|
lv_obj_set_style_local_text_font(label_time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_7segment_115);
|
||||||
lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
|
lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_CENTER, 0, 40);
|
||||||
|
|
||||||
line_time = lv_line_create(lv_scr_act(), nullptr);
|
line_time = lv_line_create(lv_scr_act(), nullptr);
|
||||||
static lv_point_t line_time_points[] = {{0, 0}, {230, 0}, {235, 5}};
|
static lv_point_t line_time_points[] = {{0, 0}, {230, 0}, {235, 5}};
|
||||||
lv_line_set_points(line_time, line_time_points, 3);
|
lv_line_set_points(line_time, line_time_points, 3);
|
||||||
lv_obj_add_style(line_time, LV_LINE_PART_MAIN, &style_line);
|
lv_obj_add_style(line_time, LV_LINE_PART_MAIN, &style_line);
|
||||||
lv_obj_align(line_time, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, 0, -35);
|
lv_obj_align(line_time, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, 0, -25);
|
||||||
|
|
||||||
label_time_ampm = lv_label_create(lv_scr_act(), nullptr);
|
label_time_ampm = lv_label_create(lv_scr_act(), nullptr);
|
||||||
lv_obj_set_style_local_text_color(label_time_ampm, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x98B69A));
|
lv_obj_set_style_local_text_color(label_time_ampm, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x98B69A));
|
||||||
|
@ -170,7 +181,8 @@ void WatchFaceCasioStyleG7710::Refresh() {
|
||||||
batteryPercentRemaining = batteryController.PercentRemaining();
|
batteryPercentRemaining = batteryController.PercentRemaining();
|
||||||
if (batteryPercentRemaining.IsUpdated()) {
|
if (batteryPercentRemaining.IsUpdated()) {
|
||||||
auto batteryPercent = batteryPercentRemaining.Get();
|
auto batteryPercent = batteryPercentRemaining.Get();
|
||||||
lv_label_set_text_static(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent));
|
batteryIcon.SetBatteryPercentage(batteryPercent);
|
||||||
|
lv_label_set_text_fmt(label_battery_vallue, "%d%%", batteryPercent);
|
||||||
}
|
}
|
||||||
|
|
||||||
bleState = bleController.IsConnected();
|
bleState = bleController.IsConnected();
|
||||||
|
@ -178,8 +190,11 @@ void WatchFaceCasioStyleG7710::Refresh() {
|
||||||
if (bleState.IsUpdated() || bleRadioEnabled.IsUpdated()) {
|
if (bleState.IsUpdated() || bleRadioEnabled.IsUpdated()) {
|
||||||
lv_label_set_text_static(bleIcon, BleIcon::GetIcon(bleState.Get()));
|
lv_label_set_text_static(bleIcon, BleIcon::GetIcon(bleState.Get()));
|
||||||
}
|
}
|
||||||
|
lv_obj_realign(label_battery_vallue);
|
||||||
|
lv_obj_realign(batteryIcon.GetObject());
|
||||||
lv_obj_realign(batteryPlug);
|
lv_obj_realign(batteryPlug);
|
||||||
lv_obj_realign(bleIcon);
|
lv_obj_realign(bleIcon);
|
||||||
|
lv_obj_realign(notificationIcon);
|
||||||
|
|
||||||
notificationState = notificatioManager.AreNewNotificationsAvailable();
|
notificationState = notificatioManager.AreNewNotificationsAvailable();
|
||||||
if (notificationState.IsUpdated()) {
|
if (notificationState.IsUpdated()) {
|
||||||
|
@ -220,10 +235,10 @@ void WatchFaceCasioStyleG7710::Refresh() {
|
||||||
}
|
}
|
||||||
lv_label_set_text(label_time_ampm, ampmChar);
|
lv_label_set_text(label_time_ampm, ampmChar);
|
||||||
lv_label_set_text_fmt(label_time, "%2d:%02d", hour, minute);
|
lv_label_set_text_fmt(label_time, "%2d:%02d", hour, minute);
|
||||||
lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_CENTER, 0, 30);
|
lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_CENTER, 0, 40);
|
||||||
} else {
|
} else {
|
||||||
lv_label_set_text_fmt(label_time, "%02d:%02d", hour, minute);
|
lv_label_set_text_fmt(label_time, "%02d:%02d", hour, minute);
|
||||||
lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_CENTER, 0, 30);
|
lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_CENTER, 0, 40);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,12 +69,15 @@ namespace Pinetime {
|
||||||
lv_obj_t* backgroundLabel;
|
lv_obj_t* backgroundLabel;
|
||||||
lv_obj_t* bleIcon;
|
lv_obj_t* bleIcon;
|
||||||
lv_obj_t* batteryPlug;
|
lv_obj_t* batteryPlug;
|
||||||
|
lv_obj_t* label_battery_vallue;
|
||||||
lv_obj_t* heartbeatIcon;
|
lv_obj_t* heartbeatIcon;
|
||||||
lv_obj_t* heartbeatValue;
|
lv_obj_t* heartbeatValue;
|
||||||
lv_obj_t* stepIcon;
|
lv_obj_t* stepIcon;
|
||||||
lv_obj_t* stepValue;
|
lv_obj_t* stepValue;
|
||||||
lv_obj_t* notificationIcon;
|
lv_obj_t* notificationIcon;
|
||||||
lv_obj_t* batteryIcon;
|
lv_obj_t* line_icons;
|
||||||
|
|
||||||
|
BatteryIcon batteryIcon;
|
||||||
|
|
||||||
Controllers::DateTime& dateTimeController;
|
Controllers::DateTime& dateTimeController;
|
||||||
Controllers::Battery& batteryController;
|
Controllers::Battery& batteryController;
|
||||||
|
|
|
@ -1,59 +1,31 @@
|
||||||
#include "displayapp/screens/settings/SettingWatchFace.h"
|
#include "displayapp/screens/settings/SettingWatchFace.h"
|
||||||
#include <lvgl/lvgl.h>
|
#include <lvgl/lvgl.h>
|
||||||
#include "displayapp/DisplayApp.h"
|
#include "displayapp/DisplayApp.h"
|
||||||
|
#include "displayapp/screens/CheckboxList.h"
|
||||||
#include "displayapp/screens/Screen.h"
|
#include "displayapp/screens/Screen.h"
|
||||||
#include "displayapp/screens/Styles.h"
|
#include "displayapp/screens/Styles.h"
|
||||||
#include "displayapp/screens/Symbols.h"
|
#include "displayapp/screens/Symbols.h"
|
||||||
|
#include "components/settings/Settings.h"
|
||||||
|
|
||||||
using namespace Pinetime::Applications::Screens;
|
using namespace Pinetime::Applications::Screens;
|
||||||
|
|
||||||
namespace {
|
constexpr const char* SettingWatchFace::title;
|
||||||
void event_handler(lv_obj_t* obj, lv_event_t event) {
|
constexpr const char* SettingWatchFace::symbol;
|
||||||
auto* screen = static_cast<SettingWatchFace*>(obj->user_data);
|
|
||||||
screen->UpdateSelected(obj, event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr std::array<const char*, 4> SettingWatchFace::options;
|
|
||||||
|
|
||||||
SettingWatchFace::SettingWatchFace(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
|
SettingWatchFace::SettingWatchFace(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
|
||||||
: Screen(app), settingsController {settingsController} {
|
: Screen(app),
|
||||||
|
settingsController {settingsController},
|
||||||
lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr);
|
screens {app,
|
||||||
|
settingsController.GetWatchfacesMenu(),
|
||||||
// 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);
|
[this]() -> std::unique_ptr<Screen> {
|
||||||
lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10);
|
return CreateScreen1();
|
||||||
lv_obj_set_style_local_pad_inner(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 5);
|
},
|
||||||
lv_obj_set_style_local_border_width(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 0);
|
[this]() -> std::unique_ptr<Screen> {
|
||||||
|
return CreateScreen2();
|
||||||
lv_obj_set_pos(container1, 10, 60);
|
|
||||||
lv_obj_set_width(container1, LV_HOR_RES - 20);
|
|
||||||
lv_obj_set_height(container1, LV_VER_RES - 50);
|
|
||||||
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, "Watch face");
|
|
||||||
lv_label_set_align(title, LV_LABEL_ALIGN_CENTER);
|
|
||||||
lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 10, 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::home);
|
|
||||||
lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER);
|
|
||||||
lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0);
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < options.size(); i++) {
|
|
||||||
cbOption[i] = lv_checkbox_create(container1, nullptr);
|
|
||||||
lv_checkbox_set_text(cbOption[i], options[i]);
|
|
||||||
cbOption[i]->user_data = this;
|
|
||||||
lv_obj_set_event_cb(cbOption[i], event_handler);
|
|
||||||
SetRadioButtonStyle(cbOption[i]);
|
|
||||||
|
|
||||||
if (settingsController.GetClockFace() == i) {
|
|
||||||
lv_checkbox_set_checked(cbOption[i], true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
Screens::ScreenListModes::UpDown} {
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingWatchFace::~SettingWatchFace() {
|
SettingWatchFace::~SettingWatchFace() {
|
||||||
|
@ -61,15 +33,22 @@ SettingWatchFace::~SettingWatchFace() {
|
||||||
settingsController.SaveSettings();
|
settingsController.SaveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingWatchFace::UpdateSelected(lv_obj_t* object, lv_event_t event) {
|
bool SettingWatchFace::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
||||||
if (event == LV_EVENT_VALUE_CHANGED) {
|
return screens.OnTouchEvent(event);
|
||||||
for (unsigned int i = 0; i < options.size(); i++) {
|
|
||||||
if (object == cbOption[i]) {
|
|
||||||
lv_checkbox_set_checked(cbOption[i], true);
|
|
||||||
settingsController.SetClockFace(i);
|
|
||||||
} else {
|
|
||||||
lv_checkbox_set_checked(cbOption[i], false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<Screen> SettingWatchFace::CreateScreen1() {
|
||||||
|
std::array<const char*, 4> watchfaces {" Digital face", " Analog face", " PineTimeStyle", " Terminal"};
|
||||||
|
return std::make_unique<Screens::CheckboxList>(0, 2, app, settingsController, title,
|
||||||
|
symbol, &Controllers::Settings::SetClockFace,
|
||||||
|
&Controllers::Settings::GetClockFace,
|
||||||
|
watchfaces);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<Screen> SettingWatchFace::CreateScreen2() {
|
||||||
|
std::array<const char*, 4> watchfaces {" Casio G7710", "", "", ""};
|
||||||
|
return std::make_unique<Screens::CheckboxList>(1, 2, app, settingsController, title,
|
||||||
|
symbol, &Controllers::Settings::SetClockFace,
|
||||||
|
&Controllers::Settings::GetClockFace,
|
||||||
|
watchfaces);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue