Tidying/formatting fixes

This commit is contained in:
Kieran Cawthray 2021-05-19 11:03:33 +02:00
parent 108bbc3642
commit 5daaa5cf75

View File

@ -15,6 +15,21 @@
#include "../DisplayApp.h"
/*
* This file is part of the Infinitime distribution (https://github.com/JF002/Infinitime).
* Copyright (c) 2021 Kieran Cawthray.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* PineTimeStyle watchface for Infinitime created by Kieran Cawthray
* Based on WatchFaceDigital
* Style/layout copied from TimeStyle for Pebble by Dan Tilden (github.com/tilden)
@ -38,7 +53,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app,
settingsController {settingsController},
heartRateController {heartRateController} {
/* This sets the watchface number to return to after leaving the menu*/
/* This sets the watchface number to return to after leaving the menu */
settingsController.SetClockFace(2);
displayedChar[0] = 0;
@ -47,7 +62,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app,
displayedChar[3] = 0;
displayedChar[4] = 0;
/*Create a 200px wide background rectangle*/
/* Create a 200px wide background rectangle */
timebar = lv_obj_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
@ -55,7 +70,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app,
lv_obj_set_size(timebar, 200, 240);
lv_obj_align(timebar, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 5, 0);
/*Display the time*/
/* Display the time */
timeDD1 = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_font(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &open_sans_light);
@ -69,7 +84,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app,
lv_label_set_text(timeDD2, "34");
lv_obj_align(timeDD2, timebar, LV_ALIGN_IN_BOTTOM_MID, 5, -5);
/*Create a 40px wide bar down the right side of the screen*/
/* Create a 40px wide bar down the right side of the screen */
sidebar = lv_obj_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x008080));
@ -77,7 +92,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app,
lv_obj_set_size(sidebar, 40, 240);
lv_obj_align(sidebar, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, 0, 0);
/*Display icons*/
/* Display icons */
batteryIcon = 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(0x000000));
@ -86,17 +101,14 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app,
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(0x000000));
//lv_label_set_text(batteryPlug, Symbols::plug);
lv_obj_align(batteryPlug, sidebar, LV_ALIGN_IN_TOP_MID, 0, 2);
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(0x000000));
//lv_label_set_text(bleIcon, BleIcon::GetIcon(false));
lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25);
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(0x000000));
//lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false));
lv_obj_align(notificationIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 40);
/* Calendar icon */
@ -137,7 +149,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app,
lv_obj_set_size(calendarCrossBar2, 8, 3);
lv_obj_align(calendarCrossBar2, calendarBar2, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
/*Display date*/
/* Display date */
dateDayOfWeek = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(dateDayOfWeek, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
@ -154,7 +166,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app,
lv_label_set_text(dateMonth, "MAR");
lv_obj_align(dateMonth, sidebar, LV_ALIGN_CENTER, 0, 32);
/*Display heartrate info*/
/* Display heartrate info */
heartbeatIcon = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
@ -208,10 +220,8 @@ bool PineTimeStyle::Refresh() {
if (notificationState.Get() == true) {
lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(true));
lv_obj_realign(notificationIcon);
//lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, -8, 25);
} else {
lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false));
//lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25);
}
}
@ -248,7 +258,7 @@ bool PineTimeStyle::Refresh() {
char hourStr[3];
char minStr[3];
/*Display the time as 2 pairs of digits*/
/* Display the time as 2 pairs of digits */
sprintf(hourStr, "%c%c", hoursChar[0], hoursChar[1]);
lv_label_set_text(timeDD1, hourStr);