CheckboxList : fix formatting.

This commit is contained in:
Jean-François Milants 2022-10-11 21:11:23 +02:00 committed by JF
parent 4ec49bde8a
commit 8c7be1fbb1
3 changed files with 28 additions and 29 deletions

View file

@ -17,12 +17,9 @@ CheckboxList::CheckboxList(const uint8_t screenID,
const char* optionsTitle, const char* optionsTitle,
const char* optionsSymbol, const char* optionsSymbol,
uint32_t originalValue, uint32_t originalValue,
std::function<void(uint32_t)>OnValueChanged, std::function<void(uint32_t)> OnValueChanged,
std::array<const char*, MaxItems> options) std::array<const char*, MaxItems> options)
: Screen(app), : Screen(app), screenID {screenID}, OnValueChanged {std::move(OnValueChanged)}, options {options}, value {originalValue} {
screenID {screenID},
OnValueChanged{std::move(OnValueChanged)},
options {options}, value {originalValue} {
// Set the background to Black // Set the background to Black
lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);

View file

@ -20,14 +20,14 @@ namespace Pinetime {
const char* optionsTitle, const char* optionsTitle,
const char* optionsSymbol, const char* optionsSymbol,
uint32_t originalValue, uint32_t originalValue,
std::function<void(uint32_t)>OnValueChanged, std::function<void(uint32_t)> OnValueChanged,
std::array<const char*, MaxItems> options); std::array<const char*, MaxItems> options);
~CheckboxList() override; ~CheckboxList() override;
void UpdateSelected(lv_obj_t* object, lv_event_t event); void UpdateSelected(lv_obj_t* object, lv_event_t event);
private: private:
const uint8_t screenID; const uint8_t screenID;
std::function<void(uint32_t)>OnValueChanged; std::function<void(uint32_t)> OnValueChanged;
std::array<const char*, MaxItems> options; std::array<const char*, MaxItems> options;
std::array<lv_obj_t*, MaxItems> cbOption; std::array<lv_obj_t*, MaxItems> cbOption;
std::array<lv_point_t, 2> pageIndicatorBasePoints; std::array<lv_point_t, 2> pageIndicatorBasePoints;

View file

@ -34,30 +34,32 @@ bool SettingWatchFace::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
std::unique_ptr<Screen> SettingWatchFace::CreateScreen1() { std::unique_ptr<Screen> SettingWatchFace::CreateScreen1() {
std::array<const char*, 4> watchfaces {"Digital face", "Analog face", "PineTimeStyle", "Terminal"}; std::array<const char*, 4> watchfaces {"Digital face", "Analog face", "PineTimeStyle", "Terminal"};
return std::make_unique<Screens::CheckboxList>(0, return std::make_unique<Screens::CheckboxList>(
2, 0,
app, 2,
title, app,
symbol, title,
settingsController.GetClockFace(), symbol,
[&settings = settingsController](uint32_t clockFace) { settingsController.GetClockFace(),
settings.SetClockFace(clockFace); [&settings = settingsController](uint32_t clockFace) {
settings.SaveSettings(); settings.SetClockFace(clockFace);
}, settings.SaveSettings();
watchfaces); },
watchfaces);
} }
std::unique_ptr<Screen> SettingWatchFace::CreateScreen2() { std::unique_ptr<Screen> SettingWatchFace::CreateScreen2() {
std::array<const char*, 4> watchfaces {"Infineat face", "Casio G7710", "", ""}; std::array<const char*, 4> watchfaces {"Infineat face", "Casio G7710", "", ""};
return std::make_unique<Screens::CheckboxList>(1, return std::make_unique<Screens::CheckboxList>(
2, 1,
app, 2,
title, app,
symbol, title,
settingsController.GetClockFace(), symbol,
[&settings = settingsController](uint32_t clockFace) { settingsController.GetClockFace(),
settings.SetClockFace(clockFace); [&settings = settingsController](uint32_t clockFace) {
settings.SaveSettings(); settings.SetClockFace(clockFace);
}, settings.SaveSettings();
watchfaces); },
watchfaces);
} }