mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2024-12-14 04:04:34 +00:00
Frequency save and naming bugfix
This commit is contained in:
parent
84be3a363c
commit
3fca8be317
@ -31,24 +31,23 @@ using namespace portapack;
|
|||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
void FrequencySaveView::on_save_name(NavigationView& nav) {
|
void FrequencySaveView::on_save_name(char * name) {
|
||||||
// TODO: Here be a bug.
|
database.entries.push_back({ value_, "", name, (int32_t)options_category.selected_index_value() });
|
||||||
textentry(nav, desc_buffer, 28);
|
nav_.pop();
|
||||||
database.entries.push_back({ value_, "", desc_buffer, (int32_t)options_category.selected_index_value() });
|
|
||||||
nav.pop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrequencySaveView::on_save_timestamp(NavigationView& nav) {
|
void FrequencySaveView::on_save_timestamp() {
|
||||||
database.entries.push_back({ value_, "", str_timestamp, (int32_t)options_category.selected_index_value() });
|
database.entries.push_back({ value_, "", str_timestamp, (int32_t)options_category.selected_index_value() });
|
||||||
nav.pop();
|
nav_.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrequencySaveView::focus() {
|
void FrequencySaveView::focus() {
|
||||||
if (error == ERROR_ACCESS) {
|
if (error == ERROR_ACCESS) {
|
||||||
nav_.display_modal("Error", "File acces error", ABORT, nullptr);
|
nav_.display_modal("Error", "File acces error", ABORT, nullptr);
|
||||||
|
} else if (error == ERROR_DUPLICATE) {
|
||||||
|
nav_.display_modal("Error", "Frequency already saved", INFO, nullptr);
|
||||||
|
error = NO_ERROR;
|
||||||
} else {
|
} else {
|
||||||
if (error == ERROR_DUPLICATE)
|
|
||||||
nav_.display_modal("Error", "Frequency already saved", INFO, nullptr);
|
|
||||||
button_save_timestamp.focus();
|
button_save_timestamp.focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,10 +119,12 @@ FrequencySaveView::FrequencySaveView(
|
|||||||
big_display.set(value);
|
big_display.set(value);
|
||||||
|
|
||||||
button_save_name.on_select = [this, &nav](Button&) {
|
button_save_name.on_select = [this, &nav](Button&) {
|
||||||
on_save_name(nav);
|
textentry(nav, desc_buffer, 28, [this](char * buffer) {
|
||||||
|
on_save_name(buffer);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
button_save_timestamp.on_select = [this, &nav](Button&) {
|
button_save_timestamp.on_select = [this, &nav](Button&) {
|
||||||
on_save_timestamp(nav);
|
on_save_timestamp();
|
||||||
};
|
};
|
||||||
|
|
||||||
button_cancel.on_select = [this, &nav](Button&) {
|
button_cancel.on_select = [this, &nav](Button&) {
|
||||||
@ -216,6 +217,7 @@ void FreqManView::on_edit_desc(NavigationView& nav) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FreqManView::on_delete() {
|
void FreqManView::on_delete() {
|
||||||
|
size_t n;
|
||||||
database.entries.erase(database.entries.begin() + menu_view.highlighted());
|
database.entries.erase(database.entries.begin() + menu_view.highlighted());
|
||||||
setup_list();
|
setup_list();
|
||||||
}
|
}
|
||||||
@ -240,7 +242,7 @@ void FreqManView::setup_list() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
menu_view.set_highlighted(menu_view.highlighted()); // Refresh
|
menu_view.set_highlighted(0); // Refresh
|
||||||
}
|
}
|
||||||
|
|
||||||
void FreqManView::focus() {
|
void FreqManView::focus() {
|
||||||
|
@ -50,8 +50,8 @@ private:
|
|||||||
std::string str_timestamp { };
|
std::string str_timestamp { };
|
||||||
//int32_t category_id_ { -1 };
|
//int32_t category_id_ { -1 };
|
||||||
|
|
||||||
void on_save_name(NavigationView& nav);
|
void on_save_name(char * name);
|
||||||
void on_save_timestamp(NavigationView& nav);
|
void on_save_timestamp();
|
||||||
void on_tick_second();
|
void on_tick_second();
|
||||||
|
|
||||||
freqman_db database { };
|
freqman_db database { };
|
||||||
|
@ -111,7 +111,11 @@ MenuView::MenuView(
|
|||||||
}
|
}
|
||||||
|
|
||||||
MenuView::~MenuView() {
|
MenuView::~MenuView() {
|
||||||
clear();
|
for (auto child : children_) {
|
||||||
|
if (!child->id) {
|
||||||
|
delete child;
|
||||||
|
}
|
||||||
|
}
|
||||||
rtc_time::signal_tick_second -= signal_token_tick_second;
|
rtc_time::signal_tick_second -= signal_token_tick_second;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +133,7 @@ void MenuView::on_tick_second() {
|
|||||||
void MenuView::clear() {
|
void MenuView::clear() {
|
||||||
for (auto child : children_) {
|
for (auto child : children_) {
|
||||||
if (!child->id) {
|
if (!child->id) {
|
||||||
delete child;
|
remove_child(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user