summaryrefslogtreecommitdiff
path: root/src/displayapp/screens/settings
diff options
context:
space:
mode:
Diffstat (limited to 'src/displayapp/screens/settings')
-rw-r--r--src/displayapp/screens/settings/SettingBluetooth.cpp36
-rw-r--r--src/displayapp/screens/settings/SettingBluetooth.h4
-rw-r--r--src/displayapp/screens/settings/SettingChimes.cpp13
-rw-r--r--src/displayapp/screens/settings/SettingChimes.h2
-rw-r--r--src/displayapp/screens/settings/SettingWatchFace.cpp4
-rw-r--r--src/displayapp/screens/settings/SettingWatchFace.h2
6 files changed, 47 insertions, 14 deletions
diff --git a/src/displayapp/screens/settings/SettingBluetooth.cpp b/src/displayapp/screens/settings/SettingBluetooth.cpp
index c66be3e..09556c4 100644
--- a/src/displayapp/screens/settings/SettingBluetooth.cpp
+++ b/src/displayapp/screens/settings/SettingBluetooth.cpp
@@ -18,6 +18,11 @@ namespace {
auto* screen = static_cast<SettingBluetooth*>(obj->user_data);
screen->OnBluetoothEnabled(obj, event);
}
+
+ static void OnBluetoothPasskeyEnableToggleEvent(lv_obj_t* obj, lv_event_t event) {
+ auto* screen = static_cast<SettingBluetooth*>(obj->user_data);
+ screen->OnBluetoothPasskeyEnableToggle(obj, event);
+ }
}
SettingBluetooth::SettingBluetooth(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
@@ -46,17 +51,23 @@ SettingBluetooth::SettingBluetooth(Pinetime::Applications::DisplayApp* app, Pine
lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER);
lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0);
+ cbDisabled = lv_checkbox_create(container1, nullptr);
+ lv_checkbox_set_text(cbDisabled, " Disabled");
+ cbDisabled->user_data = this;
+ lv_obj_set_event_cb(cbDisabled, OnBluetoothDisabledEvent);
+ SetRadioButtonStyle(cbDisabled);
+
cbEnabled = lv_checkbox_create(container1, nullptr);
lv_checkbox_set_text(cbEnabled, " Enabled");
cbEnabled->user_data = this;
lv_obj_set_event_cb(cbEnabled, OnBluetoothEnabledEvent);
SetRadioButtonStyle(cbEnabled);
- cbDisabled = lv_checkbox_create(container1, nullptr);
- lv_checkbox_set_text(cbDisabled, " Disabled");
- cbDisabled->user_data = this;
- lv_obj_set_event_cb(cbDisabled, OnBluetoothDisabledEvent);
- SetRadioButtonStyle(cbDisabled);
+ cbPasskey = lv_checkbox_create(container1, nullptr);
+ lv_checkbox_set_text(cbPasskey, " Passkey");
+ cbPasskey->user_data = this;
+ lv_obj_set_event_cb(cbPasskey, OnBluetoothPasskeyEnableToggleEvent);
+ lv_checkbox_set_checked(cbPasskey, settingsController.GetBluetoothPasskeyEnabled());
if (settingsController.GetBleRadioEnabled()) {
lv_checkbox_set_checked(cbEnabled, true);
@@ -69,10 +80,6 @@ SettingBluetooth::SettingBluetooth(Pinetime::Applications::DisplayApp* app, Pine
SettingBluetooth::~SettingBluetooth() {
lv_obj_clean(lv_scr_act());
- // Do not call SaveSettings - see src/components/settings/Settings.h
- if (priorMode != settingsController.GetBleRadioEnabled()) {
- app->PushMessage(Pinetime::Applications::Display::Messages::BleRadioEnableToggle);
- }
}
void SettingBluetooth::OnBluetoothDisabled(lv_obj_t* object, lv_event_t event) {
@@ -80,6 +87,7 @@ void SettingBluetooth::OnBluetoothDisabled(lv_obj_t* object, lv_event_t event) {
lv_checkbox_set_checked(cbEnabled, false);
lv_checkbox_set_checked(cbDisabled, true);
settingsController.SetBleRadioEnabled(false);
+ app->PushMessage(Pinetime::Applications::Display::Messages::BleRadioEnableToggle);
}
}
@@ -88,5 +96,15 @@ void SettingBluetooth::OnBluetoothEnabled(lv_obj_t* object, lv_event_t event) {
lv_checkbox_set_checked(cbEnabled, true);
lv_checkbox_set_checked(cbDisabled, false);
settingsController.SetBleRadioEnabled(true);
+ app->PushMessage(Pinetime::Applications::Display::Messages::BleRadioEnableToggle);
+ }
+}
+
+void SettingBluetooth::OnBluetoothPasskeyEnableToggle(lv_obj_t* object, lv_event_t event) {
+ if (event == LV_EVENT_VALUE_CHANGED) {
+ bool enabled = !settingsController.GetBluetoothPasskeyEnabled();
+ settingsController.SetBluetoothPasskeyEnabled(enabled);
+ app->PushMessage(Pinetime::Applications::Display::Messages::BluetoothPasskeyEnableToggle);
+ lv_checkbox_set_checked(cbPasskey, enabled);
}
}
diff --git a/src/displayapp/screens/settings/SettingBluetooth.h b/src/displayapp/screens/settings/SettingBluetooth.h
index 12bb459..63cdd39 100644
--- a/src/displayapp/screens/settings/SettingBluetooth.h
+++ b/src/displayapp/screens/settings/SettingBluetooth.h
@@ -19,11 +19,13 @@ namespace Pinetime {
void OnBluetoothEnabled(lv_obj_t* object, lv_event_t event);
void OnBluetoothDisabled(lv_obj_t* object, lv_event_t event);
+ void OnBluetoothPasskeyEnableToggle(lv_obj_t* object, lv_event_t event);
private:
Controllers::Settings& settingsController;
- lv_obj_t* cbEnabled;
lv_obj_t* cbDisabled;
+ lv_obj_t* cbEnabled;
+ lv_obj_t* cbPasskey;
bool priorMode;
};
}
diff --git a/src/displayapp/screens/settings/SettingChimes.cpp b/src/displayapp/screens/settings/SettingChimes.cpp
index d53d4da..d07b0d4 100644
--- a/src/displayapp/screens/settings/SettingChimes.cpp
+++ b/src/displayapp/screens/settings/SettingChimes.cpp
@@ -71,6 +71,16 @@ SettingChimes::SettingChimes(Pinetime::Applications::DisplayApp* app, Pinetime::
}
optionsTotal++;
+ cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
+ lv_checkbox_set_text_static(cbOption[optionsTotal], " Every 5 mins");
+ cbOption[optionsTotal]->user_data = this;
+ lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
+ SetRadioButtonStyle(cbOption[optionsTotal]);
+ if (settingsController.GetChimeOption() == Controllers::Settings::ChimesOption::FiveMinutes) {
+ lv_checkbox_set_checked(cbOption[optionsTotal], true);
+ }
+
+ optionsTotal++;
}
SettingChimes::~SettingChimes() {
@@ -92,6 +102,9 @@ void SettingChimes::UpdateSelected(lv_obj_t* object, lv_event_t event) {
if (i == 2) {
settingsController.SetChimeOption(Controllers::Settings::ChimesOption::HalfHours);
}
+ if (i == 3) {
+ settingsController.SetChimeOption(Controllers::Settings::ChimesOption::FiveMinutes);
+ }
} else {
lv_checkbox_set_checked(cbOption[i], false);
}
diff --git a/src/displayapp/screens/settings/SettingChimes.h b/src/displayapp/screens/settings/SettingChimes.h
index a251e95..836edef 100644
--- a/src/displayapp/screens/settings/SettingChimes.h
+++ b/src/displayapp/screens/settings/SettingChimes.h
@@ -20,7 +20,7 @@ namespace Pinetime {
private:
Controllers::Settings& settingsController;
uint8_t optionsTotal;
- lv_obj_t* cbOption[3];
+ lv_obj_t* cbOption[4];
};
}
}
diff --git a/src/displayapp/screens/settings/SettingWatchFace.cpp b/src/displayapp/screens/settings/SettingWatchFace.cpp
index 3cb2a36..e6f940a 100644
--- a/src/displayapp/screens/settings/SettingWatchFace.cpp
+++ b/src/displayapp/screens/settings/SettingWatchFace.cpp
@@ -14,7 +14,7 @@ namespace {
}
}
-constexpr std::array<const char*, 4> SettingWatchFace::options;
+constexpr std::array<const char*, 5> SettingWatchFace::options;
SettingWatchFace::SettingWatchFace(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
: Screen(app), settingsController {settingsController} {
@@ -27,7 +27,7 @@ SettingWatchFace::SettingWatchFace(Pinetime::Applications::DisplayApp* app, Pine
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);
- lv_obj_set_pos(container1, 10, 60);
+ lv_obj_set_pos(container1, 10, 50);
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);
diff --git a/src/displayapp/screens/settings/SettingWatchFace.h b/src/displayapp/screens/settings/SettingWatchFace.h
index 62427b4..37ea62b 100644
--- a/src/displayapp/screens/settings/SettingWatchFace.h
+++ b/src/displayapp/screens/settings/SettingWatchFace.h
@@ -20,7 +20,7 @@ namespace Pinetime {
void UpdateSelected(lv_obj_t* object, lv_event_t event);
private:
- static constexpr std::array<const char*, 4> options = {" Digital face", " Analog face", " PineTimeStyle", " Terminal"};
+ static constexpr std::array<const char*, 5> options = {" Digital face", " Analog face", " 24H Analog", " PineTimeStyle", " Terminal"};
Controllers::Settings& settingsController;
lv_obj_t* cbOption[options.size()];