mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-12-25 07:19:28 -05:00
Added cancel button in UI settings.
This commit is contained in:
parent
1f27af660d
commit
8c1593fab9
@ -43,7 +43,7 @@ namespace ui {
|
|||||||
SetDateTimeView::SetDateTimeView(
|
SetDateTimeView::SetDateTimeView(
|
||||||
NavigationView& nav
|
NavigationView& nav
|
||||||
) {
|
) {
|
||||||
button_done.on_select = [&nav, this](Button&){
|
button_save.on_select = [&nav, this](Button&){
|
||||||
const auto model = this->form_collect();
|
const auto model = this->form_collect();
|
||||||
const rtc::RTC new_datetime {
|
const rtc::RTC new_datetime {
|
||||||
model.year, model.month, model.day,
|
model.year, model.month, model.day,
|
||||||
@ -65,7 +65,7 @@ SetDateTimeView::SetDateTimeView(
|
|||||||
&field_hour,
|
&field_hour,
|
||||||
&field_minute,
|
&field_minute,
|
||||||
&field_second,
|
&field_second,
|
||||||
&button_done,
|
&button_save,
|
||||||
&button_cancel,
|
&button_cancel,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ SetRadioView::SetRadioView(
|
|||||||
&value_freq_step,
|
&value_freq_step,
|
||||||
&labels_bias,
|
&labels_bias,
|
||||||
&check_bias,
|
&check_bias,
|
||||||
&button_done,
|
&button_save,
|
||||||
&button_cancel
|
&button_cancel
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -200,7 +200,7 @@ SetRadioView::SetRadioView(
|
|||||||
EventDispatcher::send_message(message);
|
EventDispatcher::send_message(message);
|
||||||
};
|
};
|
||||||
|
|
||||||
button_done.on_select = [this, &nav](Button&){
|
button_save.on_select = [this, &nav](Button&){
|
||||||
const auto model = this->form_collect();
|
const auto model = this->form_collect();
|
||||||
portapack::persistent_memory::set_correction_ppb(model.ppm * 1000);
|
portapack::persistent_memory::set_correction_ppb(model.ppm * 1000);
|
||||||
portapack::persistent_memory::set_clkout_freq(model.freq);
|
portapack::persistent_memory::set_clkout_freq(model.freq);
|
||||||
@ -210,7 +210,7 @@ SetRadioView::SetRadioView(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SetRadioView::focus() {
|
void SetRadioView::focus() {
|
||||||
button_done.focus();
|
button_save.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetRadioView::form_init(const SetFrequencyCorrectionModel& model) {
|
void SetRadioView::form_init(const SetFrequencyCorrectionModel& model) {
|
||||||
@ -227,7 +227,6 @@ SetFrequencyCorrectionModel SetRadioView::form_collect() {
|
|||||||
|
|
||||||
SetUIView::SetUIView(NavigationView& nav) {
|
SetUIView::SetUIView(NavigationView& nav) {
|
||||||
add_children({
|
add_children({
|
||||||
//&checkbox_login,
|
|
||||||
&checkbox_disable_touchscreen,
|
&checkbox_disable_touchscreen,
|
||||||
&checkbox_speaker,
|
&checkbox_speaker,
|
||||||
&checkbox_bloff,
|
&checkbox_bloff,
|
||||||
@ -235,7 +234,8 @@ SetUIView::SetUIView(NavigationView& nav) {
|
|||||||
&checkbox_showsplash,
|
&checkbox_showsplash,
|
||||||
&checkbox_showclock,
|
&checkbox_showclock,
|
||||||
&options_clockformat,
|
&options_clockformat,
|
||||||
&button_ok
|
&button_save,
|
||||||
|
&button_cancel
|
||||||
});
|
});
|
||||||
|
|
||||||
checkbox_disable_touchscreen.set_value(persistent_memory::disable_touchscreen());
|
checkbox_disable_touchscreen.set_value(persistent_memory::disable_touchscreen());
|
||||||
@ -257,16 +257,14 @@ SetUIView::SetUIView(NavigationView& nav) {
|
|||||||
options_clockformat.set_selected_index(0);
|
options_clockformat.set_selected_index(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
checkbox_speaker.on_select = [this](Checkbox&, bool v) {
|
//checkbox_speaker.on_select = [this](Checkbox&, bool v) {
|
||||||
if (v) audio::output::speaker_mute(); //Just mute audio if speaker is disabled
|
// if (v) audio::output::speaker_mute(); //Just mute audio if speaker is disabled
|
||||||
|
// persistent_memory::set_config_speaker(v); //Store Speaker status
|
||||||
|
// StatusRefreshMessage message { }; //Refresh status bar with/out speaker
|
||||||
|
// EventDispatcher::send_message(message);
|
||||||
|
//};
|
||||||
|
|
||||||
persistent_memory::set_config_speaker(v); //Store Speaker status
|
button_save.on_select = [&nav, this](Button&) {
|
||||||
|
|
||||||
StatusRefreshMessage message { }; //Refresh status bar with/out speaker
|
|
||||||
EventDispatcher::send_message(message);
|
|
||||||
};
|
|
||||||
|
|
||||||
button_ok.on_select = [&nav, this](Button&) {
|
|
||||||
if (checkbox_bloff.value())
|
if (checkbox_bloff.value())
|
||||||
persistent_memory::set_config_backlight_timer(options_bloff.selected_index() + 1);
|
persistent_memory::set_config_backlight_timer(options_bloff.selected_index() + 1);
|
||||||
else
|
else
|
||||||
@ -278,16 +276,24 @@ SetUIView::SetUIView(NavigationView& nav) {
|
|||||||
else
|
else
|
||||||
persistent_memory::set_clock_with_date(false);
|
persistent_memory::set_clock_with_date(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (checkbox_speaker.value()) audio::output::speaker_mute(); //Just mute audio if speaker is disabled
|
||||||
|
persistent_memory::set_config_speaker(checkbox_speaker.value()); //Store Speaker status
|
||||||
|
StatusRefreshMessage message { }; //Refresh status bar with/out speaker
|
||||||
|
EventDispatcher::send_message(message);
|
||||||
|
|
||||||
persistent_memory::set_config_splash(checkbox_showsplash.value());
|
persistent_memory::set_config_splash(checkbox_showsplash.value());
|
||||||
persistent_memory::set_clock_hidden(!checkbox_showclock.value());
|
persistent_memory::set_clock_hidden(!checkbox_showclock.value());
|
||||||
persistent_memory::set_disable_touchscreen(checkbox_disable_touchscreen.value());
|
persistent_memory::set_disable_touchscreen(checkbox_disable_touchscreen.value());
|
||||||
//persistent_memory::set_config_login(checkbox_login.value());
|
nav.pop();
|
||||||
|
};
|
||||||
|
button_cancel.on_select = [&nav, this](Button&) {
|
||||||
nav.pop();
|
nav.pop();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetUIView::focus() {
|
void SetUIView::focus() {
|
||||||
button_ok.focus();
|
button_save.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
SetAudioView::SetAudioView(NavigationView& nav) {
|
SetAudioView::SetAudioView(NavigationView& nav) {
|
||||||
|
@ -99,7 +99,7 @@ private:
|
|||||||
'0',
|
'0',
|
||||||
};
|
};
|
||||||
|
|
||||||
Button button_done {
|
Button button_save {
|
||||||
{ 2 * 8, 16 * 16, 12 * 8, 32 },
|
{ 2 * 8, 16 * 16, 12 * 8, 32 },
|
||||||
"Save"
|
"Save"
|
||||||
};
|
};
|
||||||
@ -197,7 +197,7 @@ private:
|
|||||||
"Turn on bias voltage"
|
"Turn on bias voltage"
|
||||||
};
|
};
|
||||||
|
|
||||||
Button button_done {
|
Button button_save {
|
||||||
{ 2 * 8, 16 * 16, 12 * 8, 32 },
|
{ 2 * 8, 16 * 16, 12 * 8, 32 },
|
||||||
"Save"
|
"Save"
|
||||||
};
|
};
|
||||||
@ -272,10 +272,15 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Button button_ok {
|
Button button_save {
|
||||||
{ 2 * 8, 16 * 16, 12 * 8, 32 },
|
{ 2 * 8, 16 * 16, 12 * 8, 32 },
|
||||||
"Save"
|
"Save"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Button button_cancel {
|
||||||
|
{ 16 * 8, 16 * 16, 12 * 8, 32 },
|
||||||
|
"Cancel",
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class SetAudioView : public View {
|
class SetAudioView : public View {
|
||||||
@ -317,7 +322,7 @@ public:
|
|||||||
|
|
||||||
void focus() override;
|
void focus() override;
|
||||||
|
|
||||||
std::string title() const override { return "QR code settings"; };
|
std::string title() const override { return "QR code"; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Checkbox checkbox_bigger_qr {
|
Checkbox checkbox_bigger_qr {
|
||||||
|
Loading…
Reference in New Issue
Block a user