Skip to content

Commit

Permalink
Fix Cancel button in Settings->Autostart (#2087)
Browse files Browse the repository at this point in the history
  • Loading branch information
NotherNgineer committed Apr 5, 2024
1 parent 689224f commit a602abf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
19 changes: 9 additions & 10 deletions firmware/application/apps/ui_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -840,15 +840,21 @@ void SetMenuColorView::focus() {
button_save.focus();
}

/* SetAutostartView*/
/* SetAutoStartView ************************************/

SetAutostartView::SetAutostartView(NavigationView& nav) {
add_children({&labels,
&button_save,
&button_cancel,
&options});

button_save.on_select = [&nav, this](Button&) {
nav_setting.save();
autostart_app = "";
if (selected != 0) {
auto it = full_app_list.find(selected);
if (it != full_app_list.end())
autostart_app = it->second;
}
nav.pop();
};

Expand Down Expand Up @@ -879,14 +885,7 @@ SetAutostartView::SetAutostartView(NavigationView& nav) {

options.set_options(opts);
options.on_change = [this](size_t, OptionsField::value_t v) {
if (v == 0) {
autostart_app = "";
return;
}
auto it = full_app_list.find(v);
if (it != full_app_list.end()) {
autostart_app = it->second;
}
selected = v;
};
options.set_selected_index(selected);
}
Expand Down
5 changes: 3 additions & 2 deletions firmware/application/apps/ui_settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -817,14 +817,15 @@ class SetAutostartView : public View {
"nav"sv,
{{"autostart_app"sv, &autostart_app}}};
Labels labels{
{{1 * 8, 1 * 16}, "Select app to start on boot", Color::light_grey()}};
{{1 * 8, 1 * 16}, "Select app to start on boot", Color::light_grey()},
{{2 * 8, 2 * 16}, "(an SD Card is required)", Color::light_grey()}};

Button button_save{
{2 * 8, 16 * 16, 12 * 8, 32},
"Save"};

OptionsField options{
{0 * 8, 3 * 16},
{8 * 8, 4 * 16},
30,
{}};

Expand Down

0 comments on commit a602abf

Please sign in to comment.