Adds enum class for chimes option
This commit is contained in:
parent
7a0f72ed8b
commit
15c3807a76
|
@ -11,6 +11,7 @@ namespace Pinetime {
|
|||
public:
|
||||
enum class ClockType : uint8_t { H24, H12 };
|
||||
enum class Notification : uint8_t { ON, OFF };
|
||||
enum class ChimesOption : uint8_t { None, Hours, HalfHours };
|
||||
enum class WakeUpMode : uint8_t {
|
||||
SingleTap = 0,
|
||||
DoubleTap = 1,
|
||||
|
@ -40,14 +41,14 @@ namespace Pinetime {
|
|||
return settings.clockFace;
|
||||
};
|
||||
|
||||
void SetChimesState(uint8_t state) {
|
||||
if (state != settings.chimesState) {
|
||||
void SetChimeOption(ChimesOption chimeOption) {
|
||||
if (chimeOption != settings.chimesOption) {
|
||||
settingsChanged = true;
|
||||
}
|
||||
settings.chimesState = state;
|
||||
settings.chimesOption = chimeOption;
|
||||
};
|
||||
uint8_t GetChimesState() const {
|
||||
return settings.chimesState;
|
||||
ChimesOption GetChimeOption() const {
|
||||
return settings.chimesOption;
|
||||
};
|
||||
|
||||
void SetPTSColorTime(Colors colorTime) {
|
||||
|
@ -182,7 +183,7 @@ namespace Pinetime {
|
|||
Notification notificationStatus = Notification::ON;
|
||||
|
||||
uint8_t clockFace = 0;
|
||||
uint8_t chimesState = 0;
|
||||
ChimesOption chimesOption = ChimesOption::None;
|
||||
|
||||
PineTimeStyle PTS;
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ SettingChimes::SettingChimes(Pinetime::Applications::DisplayApp* app, Pinetime::
|
|||
lv_checkbox_set_text_static(cbOption[optionsTotal], " Off");
|
||||
cbOption[optionsTotal]->user_data = this;
|
||||
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
|
||||
if (settingsController.GetChimesState() == 0) {
|
||||
if (settingsController.GetChimeOption() == Controllers::Settings::ChimesOption::None) {
|
||||
lv_checkbox_set_checked(cbOption[optionsTotal], true);
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ SettingChimes::SettingChimes(Pinetime::Applications::DisplayApp* app, Pinetime::
|
|||
lv_checkbox_set_text_static(cbOption[optionsTotal], " Every hour");
|
||||
cbOption[optionsTotal]->user_data = this;
|
||||
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
|
||||
if (settingsController.GetChimesState() == 1) {
|
||||
if (settingsController.GetChimeOption() == Controllers::Settings::ChimesOption::Hours) {
|
||||
lv_checkbox_set_checked(cbOption[optionsTotal], true);
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ SettingChimes::SettingChimes(Pinetime::Applications::DisplayApp* app, Pinetime::
|
|||
lv_checkbox_set_text_static(cbOption[optionsTotal], " Every 30 mins");
|
||||
cbOption[optionsTotal]->user_data = this;
|
||||
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
|
||||
if (settingsController.GetChimesState() == 2) {
|
||||
if (settingsController.GetChimeOption() == Controllers::Settings::ChimesOption::HalfHours) {
|
||||
lv_checkbox_set_checked(cbOption[optionsTotal], true);
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,15 @@ void SettingChimes::UpdateSelected(lv_obj_t* object, lv_event_t event) {
|
|||
for (uint8_t i = 0; i < optionsTotal; i++) {
|
||||
if (object == cbOption[i]) {
|
||||
lv_checkbox_set_checked(cbOption[i], true);
|
||||
settingsController.SetChimesState(i);
|
||||
if (i == 0) {
|
||||
settingsController.SetChimeOption(Controllers::Settings::ChimesOption::None);
|
||||
}
|
||||
if (i == 1) {
|
||||
settingsController.SetChimeOption(Controllers::Settings::ChimesOption::Hours);
|
||||
}
|
||||
if (i == 2) {
|
||||
settingsController.SetChimeOption(Controllers::Settings::ChimesOption::HalfHours);
|
||||
}
|
||||
} else {
|
||||
lv_checkbox_set_checked(cbOption[i], false);
|
||||
}
|
||||
|
|
|
@ -405,7 +405,7 @@ void SystemTask::Work() {
|
|||
break;
|
||||
case Messages::OnNewHour:
|
||||
using Pinetime::Controllers::AlarmController;
|
||||
if (settingsController.GetChimesState() == 1 && alarmController.State() != AlarmController::AlarmState::Alerting) {
|
||||
if (settingsController.GetChimeOption() == Controllers::Settings::ChimesOption::Hours && alarmController.State() != AlarmController::AlarmState::Alerting) {
|
||||
if (isSleeping && !isWakingUp) {
|
||||
GoToRunning();
|
||||
displayApp.PushMessage(Pinetime::Applications::Display::Messages::Clock);
|
||||
|
@ -415,7 +415,7 @@ void SystemTask::Work() {
|
|||
break;
|
||||
case Messages::OnNewHalfHour:
|
||||
using Pinetime::Controllers::AlarmController;
|
||||
if (settingsController.GetChimesState() == 2 && alarmController.State() != AlarmController::AlarmState::Alerting) {
|
||||
if (settingsController.GetChimeOption() == Controllers::Settings::ChimesOption::HalfHours && alarmController.State() != AlarmController::AlarmState::Alerting) {
|
||||
if (isSleeping && !isWakingUp) {
|
||||
GoToRunning();
|
||||
displayApp.PushMessage(Pinetime::Applications::Display::Messages::Clock);
|
||||
|
|
Loading…
Reference in a new issue