mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-12-28 08:49:45 -05:00
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 <gull@NiloreaDevLaptop.home> Co-authored-by: gullradriel <gull@nomail.net>
This commit is contained in:
parent
01dd0c79ed
commit
211f40ddf3
@ -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<FileLoadView>(".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<FileLoadView>(".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)
|
||||
|
@ -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"};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user