Merge pull request #1031 from mabuch/rename-PineTimeStyle-to-WatchFacePineTimeStyle

Rename PineTimeStyle to WatchFacePineTimeStyle
This commit is contained in:
Riku Isokoski 2022-04-18 19:40:54 +03:00 committed by GitHub
commit 943a48f189
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 23 deletions

View file

@ -456,7 +456,7 @@ list(APPEND SOURCE_FILES
displayapp/screens/WatchFaceAnalog.cpp
displayapp/screens/WatchFaceDigital.cpp
displayapp/screens/WatchFaceTerminal.cpp
displayapp/screens/PineTimeStyle.cpp
displayapp/screens/WatchFacePineTimeStyle.cpp
##

View file

@ -11,7 +11,7 @@
#include "displayapp/screens/WatchFaceDigital.h"
#include "displayapp/screens/WatchFaceTerminal.h"
#include "displayapp/screens/WatchFaceAnalog.h"
#include "displayapp/screens/PineTimeStyle.h"
#include "displayapp/screens/WatchFacePineTimeStyle.h"
using namespace Pinetime::Applications::Screens;
@ -40,7 +40,7 @@ Clock::Clock(DisplayApp* app,
return WatchFaceAnalogScreen();
break;
case 2:
return PineTimeStyleScreen();
return WatchFacePineTimeStyleScreen();
break;
case 3:
return WatchFaceTerminalScreen();
@ -79,8 +79,8 @@ std::unique_ptr<Screen> Clock::WatchFaceAnalogScreen() {
app, dateTimeController, batteryController, bleController, notificatioManager, settingsController);
}
std::unique_ptr<Screen> Clock::PineTimeStyleScreen() {
return std::make_unique<Screens::PineTimeStyle>(
std::unique_ptr<Screen> Clock::WatchFacePineTimeStyleScreen() {
return std::make_unique<Screens::WatchFacePineTimeStyle>(
app, dateTimeController, batteryController, bleController, notificatioManager, settingsController, motionController);
}

View file

@ -46,7 +46,7 @@ namespace Pinetime {
std::unique_ptr<Screen> screen;
std::unique_ptr<Screen> WatchFaceDigitalScreen();
std::unique_ptr<Screen> WatchFaceAnalogScreen();
std::unique_ptr<Screen> PineTimeStyleScreen();
std::unique_ptr<Screen> WatchFacePineTimeStyleScreen();
std::unique_ptr<Screen> WatchFaceTerminalScreen();
};
}

View file

@ -19,7 +19,7 @@
* Style/layout copied from TimeStyle for Pebble by Dan Tilden (github.com/tilden)
*/
#include "displayapp/screens/PineTimeStyle.h"
#include "displayapp/screens/WatchFacePineTimeStyle.h"
#include <date/date.h>
#include <lvgl/lvgl.h>
#include <cstdio>
@ -39,7 +39,7 @@ using namespace Pinetime::Applications::Screens;
namespace {
void event_handler(lv_obj_t* obj, lv_event_t event) {
auto* screen = static_cast<PineTimeStyle*>(obj->user_data);
auto* screen = static_cast<WatchFacePineTimeStyle*>(obj->user_data);
screen->UpdateSelected(obj, event);
}
@ -51,7 +51,7 @@ namespace {
}
}
PineTimeStyle::PineTimeStyle(DisplayApp* app,
WatchFacePineTimeStyle::WatchFacePineTimeStyle(DisplayApp* app,
Controllers::DateTime& dateTimeController,
Controllers::Battery& batteryController,
Controllers::Ble& bleController,
@ -300,12 +300,12 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app,
Refresh();
}
PineTimeStyle::~PineTimeStyle() {
WatchFacePineTimeStyle::~WatchFacePineTimeStyle() {
lv_task_del(taskRefresh);
lv_obj_clean(lv_scr_act());
}
bool PineTimeStyle::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
bool WatchFacePineTimeStyle::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
if ((event == Pinetime::Applications::TouchEvents::LongTap) && lv_obj_get_hidden(btnRandom)) {
lv_obj_set_hidden(btnSet, false);
savedTick = lv_tick_get();
@ -317,7 +317,7 @@ bool PineTimeStyle::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
return false;
}
void PineTimeStyle::CloseMenu() {
void WatchFacePineTimeStyle::CloseMenu() {
settingsController.SaveSettings();
lv_obj_set_hidden(btnNextTime, true);
lv_obj_set_hidden(btnPrevTime, true);
@ -330,7 +330,7 @@ void PineTimeStyle::CloseMenu() {
lv_obj_set_hidden(btnClose, true);
}
bool PineTimeStyle::OnButtonPushed() {
bool WatchFacePineTimeStyle::OnButtonPushed() {
if (!lv_obj_get_hidden(btnClose)) {
CloseMenu();
return true;
@ -338,13 +338,12 @@ bool PineTimeStyle::OnButtonPushed() {
return false;
}
void PineTimeStyle::SetBatteryIcon() {
void WatchFacePineTimeStyle::SetBatteryIcon() {
auto batteryPercent = batteryPercentRemaining.Get();
lv_label_set_text_static(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent));
}
void PineTimeStyle::AlignIcons() {
void WatchFacePineTimeStyle::AlignIcons() {
if (notificationState.Get() && bleState.Get()) {
lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 8, 25);
lv_obj_align(notificationIcon, sidebar, LV_ALIGN_IN_TOP_MID, -8, 25);
@ -355,7 +354,7 @@ void PineTimeStyle::AlignIcons() {
}
}
void PineTimeStyle::Refresh() {
void WatchFacePineTimeStyle::Refresh() {
isCharging = batteryController.IsCharging();
if (isCharging.IsUpdated()) {
if (isCharging.Get()) {
@ -455,7 +454,7 @@ void PineTimeStyle::Refresh() {
}
}
void PineTimeStyle::UpdateSelected(lv_obj_t* object, lv_event_t event) {
void WatchFacePineTimeStyle::UpdateSelected(lv_obj_t* object, lv_event_t event) {
auto valueTime = settingsController.GetPTSColorTime();
auto valueBar = settingsController.GetPTSColorBar();
auto valueBG = settingsController.GetPTSColorBG();
@ -576,7 +575,7 @@ void PineTimeStyle::UpdateSelected(lv_obj_t* object, lv_event_t event) {
}
}
Pinetime::Controllers::Settings::Colors PineTimeStyle::GetNext(Pinetime::Controllers::Settings::Colors color) {
Pinetime::Controllers::Settings::Colors WatchFacePineTimeStyle::GetNext(Pinetime::Controllers::Settings::Colors color) {
auto colorAsInt = static_cast<uint8_t>(color);
Pinetime::Controllers::Settings::Colors nextColor;
if (colorAsInt < 16) {
@ -587,7 +586,7 @@ Pinetime::Controllers::Settings::Colors PineTimeStyle::GetNext(Pinetime::Control
return nextColor;
}
Pinetime::Controllers::Settings::Colors PineTimeStyle::GetPrevious(Pinetime::Controllers::Settings::Colors color) {
Pinetime::Controllers::Settings::Colors WatchFacePineTimeStyle::GetPrevious(Pinetime::Controllers::Settings::Colors color) {
auto colorAsInt = static_cast<uint8_t>(color);
Pinetime::Controllers::Settings::Colors prevColor;

View file

@ -21,16 +21,16 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
class PineTimeStyle : public Screen {
class WatchFacePineTimeStyle : public Screen {
public:
PineTimeStyle(DisplayApp* app,
WatchFacePineTimeStyle(DisplayApp* app,
Controllers::DateTime& dateTimeController,
Controllers::Battery& batteryController,
Controllers::Ble& bleController,
Controllers::NotificationManager& notificatioManager,
Controllers::Settings& settingsController,
Controllers::MotionController& motionController);
~PineTimeStyle() override;
~WatchFacePineTimeStyle() override;
bool OnTouchEvent(TouchEvents event) override;
bool OnButtonPushed() override;