From e2ca5393a693de12afc74c8ddfc96314aa1d00eb Mon Sep 17 00:00:00 2001 From: Eve C Date: Wed, 2 Oct 2024 15:35:10 +0200 Subject: [PATCH] corrections --- src/displayapp/DisplayApp.cpp | 1 - src/displayapp/screens/Calendar.cpp | 96 -------------------- src/displayapp/screens/Calendar.h | 59 ------------ src/displayapp/screens/WatchFaceInfineat.cpp | 6 +- 4 files changed, 3 insertions(+), 159 deletions(-) delete mode 100644 src/displayapp/screens/Calendar.cpp delete mode 100644 src/displayapp/screens/Calendar.h diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index 17f268ff..3fd34b3a 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -19,7 +19,6 @@ #include "displayapp/screens/Metronome.h" #include "displayapp/screens/Music.h" #include "displayapp/screens/Navigation.h" -#include "displayapp/screens/Calendar.h" #include "displayapp/screens/Notifications.h" #include "displayapp/screens/SystemInfo.h" #include "displayapp/screens/Tile.h" diff --git a/src/displayapp/screens/Calendar.cpp b/src/displayapp/screens/Calendar.cpp deleted file mode 100644 index d51126c7..00000000 --- a/src/displayapp/screens/Calendar.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* Copyright (C) 2024 thnikk, Boteium, JustScott - - This file is part of InfiniTime. - - InfiniTime 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, either version 3 of the License, or - (at your option) any later version. - - InfiniTime 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 . -*/ - -#include "displayapp/screens/Calendar.h" -#include "components/datetime/DateTimeController.h" -#include "displayapp/InfiniTimeTheme.h" - -using namespace Pinetime::Applications::Screens; - -Calendar::Calendar(Controllers::DateTime& dateTimeController) : dateTimeController {dateTimeController} { - - // Create calendar object - calendar = lv_calendar_create(lv_scr_act(), NULL); - // Set size - lv_obj_set_size(calendar, LV_HOR_RES, LV_VER_RES); - // Set alignment - lv_obj_align(calendar, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, -5); - // Disable clicks - lv_obj_set_click(calendar, false); - - // Set style of today's date - lv_obj_set_style_local_text_color(calendar, LV_CALENDAR_PART_DATE, LV_STATE_FOCUSED, Colors::deepOrange); - - // Set style of inactive month's days - lv_obj_set_style_local_text_color(calendar, LV_CALENDAR_PART_DATE, LV_STATE_DISABLED, Colors::gray); - - // Get today's date - current.year = static_cast(dateTimeController.Year()); - current.month = static_cast(dateTimeController.Month()); - current.day = static_cast(dateTimeController.Day()); - - // Set today's date - lv_calendar_set_today_date(calendar, ¤t); - lv_calendar_set_showed_date(calendar, ¤t); -} - -bool Calendar::OnTouchEvent(Pinetime::Applications::TouchEvents event) { - switch (event) { - case TouchEvents::SwipeLeft: { - if (current.month == 12) { - current.month = 1; - current.year++; - } else { - current.month++; - } - - lv_calendar_set_showed_date(calendar, ¤t); - return true; - } - case TouchEvents::SwipeRight: { - if (current.month == 1) { - current.month = 12; - current.year--; - } else { - current.month--; - } - - lv_calendar_set_showed_date(calendar, ¤t); - return true; - } - /* - case TouchEvents::SwipeUp: { - current.year++; - lv_calendar_set_showed_date(calendar, ¤t); - return true; - } - case TouchEvents::SwipeDown: { - current.year--; - lv_calendar_set_showed_date(calendar, ¤t); - return true; - } - */ - default: { - return false; - } - } -} - -Calendar::~Calendar() { - lv_obj_clean(lv_scr_act()); -} diff --git a/src/displayapp/screens/Calendar.h b/src/displayapp/screens/Calendar.h deleted file mode 100644 index bbdc8322..00000000 --- a/src/displayapp/screens/Calendar.h +++ /dev/null @@ -1,59 +0,0 @@ -/* Copyright (C) 2024 thnikk, Boteium, JustScott - - This file is part of InfiniTime. - - InfiniTime 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, either version 3 of the License, or - (at your option) any later version. - - InfiniTime 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 . -*/ - -#pragma once - -#include "displayapp/apps/Apps.h" -#include "displayapp/Controllers.h" -#include "displayapp/screens/Screen.h" -#include "components/datetime/DateTimeController.h" -#include - -#include "Symbols.h" - -namespace Pinetime { - namespace Controllers { - class Settings; - } - - namespace Applications { - namespace Screens { - class Calendar : public Screen { - public: - Calendar(Controllers::DateTime& dateTimeController); - ~Calendar() override; - - private: - bool OnTouchEvent(TouchEvents event); - Controllers::DateTime& dateTimeController; - lv_obj_t* calendar; - lv_calendar_date_t current; - }; - } - - template <> - struct AppTraits { - static constexpr Apps app = Apps::Calendar; - static constexpr const char* icon = Screens::Symbols::calendar; - - static Screens::Screen* Create(AppControllers& controllers) { - return new Screens::Calendar(controllers.dateTimeController); - }; - }; - } -} diff --git a/src/displayapp/screens/WatchFaceInfineat.cpp b/src/displayapp/screens/WatchFaceInfineat.cpp index 3223d5f1..19de1fba 100644 --- a/src/displayapp/screens/WatchFaceInfineat.cpp +++ b/src/displayapp/screens/WatchFaceInfineat.cpp @@ -509,11 +509,11 @@ void WatchFaceInfineat::Refresh() { } if (settingsController.GetInfineatShowAlarmStatus()) { - alarmState = alarmController.State()==Pinetime::Controllers::AlarmController::AlarmState::Set; + isAlarmSet = alarmController.State()==Pinetime::Controllers::AlarmController::AlarmState::Set; // sets the icon as bell or barred bell - lv_label_set_text_static(alarmIcon, AlarmIcon::GetIcon(alarmState)); + lv_label_set_text_static(alarmIcon, AlarmIcon::GetIcon(isAlarmSet.Get())); //displays the time of the alarm or nothing if the alarm is not set - if (alarmState) { + if (isAlarmSet.Get()) { uint8_t alarmHours = alarmController.Hours(); uint8_t alarmMinutes = alarmController.Minutes(); //handles the am pm format.