From 3dd5e839449f5056ca9493c0eab6a3e02fe1e86e Mon Sep 17 00:00:00 2001 From: yum Date: Wed, 24 May 2023 22:44:34 -0700 Subject: All transcription panel fields now persist across app restart I forgor to put them into ApplyConfigToInputFields. The reason this is necessary: we need to create the text field where we log things before we can deserialize the config. To keep the code structure "clean" I just wrote another function to apply the config (ApplyConfigToInputFields). However I have to remember to update it when I add new fields. --- GUI/GUI/GUI/Frame.cpp | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'GUI') diff --git a/GUI/GUI/GUI/Frame.cpp b/GUI/GUI/GUI/Frame.cpp index f3895bc..221c59c 100644 --- a/GUI/GUI/GUI/Frame.cpp +++ b/GUI/GUI/GUI/Frame.cpp @@ -1056,11 +1056,6 @@ void Frame::ApplyConfigToInputFields() kNumModelChoices, app_c_->model, kModelDefault); py_app_model->SetSelection(model_idx); - auto* py_app_button = static_cast(FindWindowById(ID_PY_APP_BUTTON)); - int button_idx = GetDropdownChoiceIndex(kButton, - kNumButtons, app_c_->button, kButtonDefault); - py_app_button->SetSelection(button_idx); - auto* py_app_chars_per_sync = static_cast(FindWindowById(ID_PY_APP_CHARS_PER_SYNC)); int chars_idx = GetDropdownChoiceIndex(kCharsPerSync, kNumCharsPerSync, std::to_string(app_c_->chars_per_sync), @@ -1073,6 +1068,15 @@ void Frame::ApplyConfigToInputFields() kBytesDefault); py_app_bytes_per_char->SetSelection(bytes_idx); + auto* py_app_button = static_cast(FindWindowById(ID_PY_APP_BUTTON)); + int button_idx = GetDropdownChoiceIndex(kButton, + kNumButtons, app_c_->button, kButtonDefault); + py_app_button->SetSelection(button_idx); + + auto* py_app_desktop_keybind = static_cast(FindWindowById(ID_PY_APP_KEYBIND)); + py_app_desktop_keybind->Clear(); + py_app_desktop_keybind->AppendText(app_c_->keybind); + auto* py_app_rows = static_cast(FindWindowById(ID_PY_APP_ROWS)); py_app_rows->Clear(); py_app_rows->AppendText(std::to_string(app_c_->rows)); @@ -1081,6 +1085,22 @@ void Frame::ApplyConfigToInputFields() py_app_cols->Clear(); py_app_cols->AppendText(std::to_string(app_c_->cols)); + auto* py_app_gpu_idx = static_cast(FindWindowById(ID_PY_APP_GPU_IDX)); + py_app_gpu_idx->Clear(); + py_app_gpu_idx->AppendText(std::to_string(app_c_->gpu_idx)); + + auto* py_app_enable_local_beep = static_cast(FindWindowById(ID_PY_APP_ENABLE_LOCAL_BEEP)); + py_app_enable_local_beep->SetValue(app_c_->enable_local_beep); + + auto* py_app_use_cpu = static_cast(FindWindowById(ID_PY_APP_USE_CPU)); + py_app_use_cpu->SetValue(app_c_->use_cpu); + + auto* py_app_use_builtin = static_cast(FindWindowById(ID_PY_APP_USE_BUILTIN)); + py_app_use_builtin->SetValue(app_c_->use_builtin); + + auto* py_app_enable_uwu_filter = static_cast(FindWindowById(ID_PY_APP_ENABLE_UWU_FILTER)); + py_app_enable_uwu_filter->SetValue(app_c_->enable_uwu_filter); + // Unity panel auto* unity_chars_per_sync = static_cast(FindWindowById(ID_UNITY_CHARS_PER_SYNC)); unity_chars_per_sync->SetSelection(chars_idx); -- cgit v1.2.3