From 211f40ddf3b68fd02f66f9fbca0255b3e8600a7d Mon Sep 17 00:00:00 2001 From: gullradriel <3157857+gullradriel@users.noreply.github.com> Date: Mon, 30 Oct 2023 22:54:37 +0100 Subject: [PATCH] Recon: fix output when typing name (#1538) * Changed some buttons name and fixed blank output if typed * code format --------- Co-authored-by: Gull Ra Driel Co-authored-by: gullradriel --- .../application/apps/ui_recon_settings.cpp | 29 +++++++++---------- .../application/apps/ui_recon_settings.hpp | 7 +++-- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/firmware/application/apps/ui_recon_settings.cpp b/firmware/application/apps/ui_recon_settings.cpp index b4ef2b94..00a44998 100644 --- a/firmware/application/apps/ui_recon_settings.cpp +++ b/firmware/application/apps/ui_recon_settings.cpp @@ -39,10 +39,10 @@ namespace ui { ReconSetupViewMain::ReconSetupViewMain(NavigationView& nav, Rect parent_rect, std::string input_file, std::string output_file) : View(parent_rect), _input_file{input_file}, _output_file{output_file} { hidden(true); - add_children({&button_load_freqs, + add_children({&button_input_file, &text_input_file, - &button_save_freqs, - &button_output_file, + &button_choose_output_file, + &button_choose_output_name, &checkbox_autosave_freqs, &checkbox_autostart_recon, &checkbox_clear_output}); @@ -52,9 +52,9 @@ ReconSetupViewMain::ReconSetupViewMain(NavigationView& nav, Rect parent_rect, st checkbox_clear_output.set_value(persistent_memory::recon_clear_output()); text_input_file.set(_input_file); - button_output_file.set_text(_output_file); + button_choose_output_name.set_text(_output_file); - button_load_freqs.on_select = [this, &nav](Button&) { + button_input_file.on_select = [this, &nav](Button&) { auto open_view = nav.push(".TXT"); open_view->push_dir(freqman_dir); open_view->on_changed = [this, &nav](std::filesystem::path new_file_path) { @@ -67,25 +67,24 @@ ReconSetupViewMain::ReconSetupViewMain(NavigationView& nav, Rect parent_rect, st }; }; - button_save_freqs.on_select = [this, &nav](Button&) { + button_choose_output_file.on_select = [this, &nav](Button&) { auto open_view = nav.push(".TXT"); open_view->push_dir(freqman_dir); open_view->on_changed = [this, &nav](std::filesystem::path new_file_path) { if (new_file_path.native().find(freqman_dir.native()) == 0) { _output_file = new_file_path.stem().string(); - button_output_file.set_text(_output_file); + button_choose_output_name.set_text(_output_file); } else { - nav.display_modal("LOAD ERROR", "A valid file from\nFREQMAN directory is\nrequired."); + nav.display_modal("SAVE ERROR", "A valid file from\nFREQMAN directory is\nrequired."); } }; }; - button_output_file.on_select = [this, &nav](Button&) { - text_prompt(nav, _output_file, 28, - [this](std::string& buffer) { - _output_file = std::move(buffer); - button_output_file.set_text(_output_file); - }); + button_choose_output_name.on_select = [this, &nav](Button&) { + text_prompt(nav, _output_file, 28, [this](std::string& buffer) { + _output_file = buffer; + button_choose_output_name.set_text(_output_file); + }); }; }; @@ -105,7 +104,7 @@ void ReconSetupViewMore::save() { }; void ReconSetupViewMain::focus() { - button_load_freqs.focus(); + button_input_file.focus(); } ReconSetupViewMore::ReconSetupViewMore(NavigationView& nav, Rect parent_rect) diff --git a/firmware/application/apps/ui_recon_settings.hpp b/firmware/application/apps/ui_recon_settings.hpp index 3a95f05b..27bd7ab4 100644 --- a/firmware/application/apps/ui_recon_settings.hpp +++ b/firmware/application/apps/ui_recon_settings.hpp @@ -73,17 +73,18 @@ class ReconSetupViewMain : public View { std::string _input_file{"RECON"}; std::string _output_file{"RECON_RESULTS"}; - Button button_load_freqs{ + Button button_input_file{ {1 * 8, 12, 18 * 8, 22}, "select input file"}; Text text_input_file{ {1 * 8, 4 + 2 * 16, 18 * 8, 22}, "RECON"}; - Button button_save_freqs{ + Button button_choose_output_file{ {1 * 8, 4 * 16 - 8, 18 * 8, 22}, "select output file"}; - Button button_output_file{ + + Button button_choose_output_name{ {1 * 8, 5 * 16 - 2, 18 * 8, 22}, "RECON_RESULTS"};