From ebab21e22dea7931a8a7db05ff26d60cec4f5b5b Mon Sep 17 00:00:00 2001 From: yum Date: Wed, 24 May 2023 22:34:55 -0700 Subject: Add UI toggle for uwu filter UI now has a checkbox for the uwu filter. Does not materially affect resource usage or latency when enabled. --- GUI/GUI/GUI/Config.cpp | 3 +++ GUI/GUI/GUI/Config.h | 1 + GUI/GUI/GUI/Frame.cpp | 14 ++++++++++++++ GUI/GUI/GUI/Frame.h | 1 + GUI/GUI/GUI/PythonWrapper.cpp | 1 + 5 files changed, 20 insertions(+) (limited to 'GUI') diff --git a/GUI/GUI/GUI/Config.cpp b/GUI/GUI/GUI/Config.cpp index 0cf6d9d..0443278 100644 --- a/GUI/GUI/GUI/Config.cpp +++ b/GUI/GUI/GUI/Config.cpp @@ -71,6 +71,7 @@ AppConfig::AppConfig(wxTextCtrl* out) enable_local_beep(true), use_cpu(false), use_builtin(false), + enable_uwu_filter(false), gpu_idx(0), keybind("ctrl+x"), @@ -115,6 +116,7 @@ bool AppConfig::Serialize(const std::filesystem::path& path) { cm.Set("enable_local_beep", enable_local_beep); cm.Set("use_cpu", use_cpu); cm.Set("use_builtin", use_builtin); + cm.Set("enable_uwu_filter", enable_uwu_filter); cm.Set("gpu_idx", gpu_idx); cm.Set("keybind", keybind); @@ -172,6 +174,7 @@ bool AppConfig::Deserialize(const std::filesystem::path& path) { cm.Get("enable_local_beep", c.enable_local_beep); cm.Get("use_cpu", c.use_cpu); cm.Get("use_builtin", c.use_builtin); + cm.Get("enable_uwu_filter", c.enable_uwu_filter); cm.Get("gpu_idx", c.gpu_idx); cm.Get("keybind", c.keybind); diff --git a/GUI/GUI/GUI/Config.h b/GUI/GUI/GUI/Config.h index f53b700..be036ea 100644 --- a/GUI/GUI/GUI/Config.h +++ b/GUI/GUI/GUI/Config.h @@ -57,6 +57,7 @@ public: bool enable_local_beep; bool use_cpu; bool use_builtin; + bool enable_uwu_filter; int gpu_idx; std::string keybind; diff --git a/GUI/GUI/GUI/Frame.cpp b/GUI/GUI/GUI/Frame.cpp index 74a0233..f3895bc 100644 --- a/GUI/GUI/GUI/Frame.cpp +++ b/GUI/GUI/GUI/Frame.cpp @@ -39,6 +39,7 @@ namespace { ID_PY_APP_ENABLE_LOCAL_BEEP, ID_PY_APP_USE_CPU, ID_PY_APP_USE_BUILTIN, + ID_PY_APP_ENABLE_UWU_FILTER, ID_PY_APP_ROWS, ID_PY_APP_COLS, ID_PY_APP_WINDOW_DURATION, @@ -593,6 +594,15 @@ Frame::Frame() ); py_app_use_builtin_ = py_app_use_builtin; + auto* py_app_enable_uwu_filter = new wxCheckBox(py_config_panel, + ID_PY_APP_ENABLE_UWU_FILTER, "Enable uwu filter :3"); + py_app_enable_uwu_filter->SetValue(app_c_->enable_uwu_filter); + py_app_enable_uwu_filter->SetToolTip( + "If checked, transcribed text will be passed through an " + "uwu filter." + ); + py_app_enable_uwu_filter_ = py_app_enable_uwu_filter; + // Hack: Add newlines before and after the button text to make // the buttons bigger, and easier to click from inside VR. auto* py_app_start_button = new wxButton(py_config_panel, @@ -612,6 +622,8 @@ Frame::Frame() /*flags=*/wxEXPAND); sizer->Add(py_app_use_builtin, /*proportion=*/0, /*flags=*/wxEXPAND); + sizer->Add(py_app_enable_uwu_filter, /*proportion=*/0, + /*flags=*/wxEXPAND); sizer->Add(py_app_start_button, /*proportion=*/0, /*flags=*/wxEXPAND); sizer->Add(py_app_stop_button, /*proportion=*/0, @@ -1638,6 +1650,7 @@ void Frame::OnAppStart(wxCommandEvent& event) { const bool enable_local_beep = py_app_enable_local_beep_->GetValue(); const bool use_cpu = py_app_use_cpu_->GetValue(); const bool use_builtin = py_app_use_builtin_->GetValue(); + const bool enable_uwu_filter = py_app_enable_uwu_filter_->GetValue(); std::string rows_str = py_app_rows_->GetValue().ToStdString(); std::string cols_str = py_app_cols_->GetValue().ToStdString(); std::string chars_per_sync_str = @@ -1706,6 +1719,7 @@ void Frame::OnAppStart(wxCommandEvent& event) { app_c_->enable_local_beep = enable_local_beep; app_c_->use_cpu = use_cpu; app_c_->use_builtin = use_builtin; + app_c_->enable_uwu_filter = enable_uwu_filter; app_c_->gpu_idx = gpu_idx; app_c_->keybind = keybind; app_c_->Serialize(AppConfig::kConfigPath); diff --git a/GUI/GUI/GUI/Frame.h b/GUI/GUI/GUI/Frame.h index 082172e..130a716 100644 --- a/GUI/GUI/GUI/Frame.h +++ b/GUI/GUI/GUI/Frame.h @@ -80,6 +80,7 @@ private: wxCheckBox* py_app_enable_local_beep_; wxCheckBox* py_app_use_cpu_; wxCheckBox* py_app_use_builtin_; + wxCheckBox* py_app_enable_uwu_filter_; wxCheckBox* unity_clear_osc_; wxCheckBox* whisper_enable_local_beep_; wxCheckBox* whisper_use_cpu_; diff --git a/GUI/GUI/GUI/PythonWrapper.cpp b/GUI/GUI/GUI/PythonWrapper.cpp index 2347248..98a0c3e 100644 --- a/GUI/GUI/GUI/PythonWrapper.cpp +++ b/GUI/GUI/GUI/PythonWrapper.cpp @@ -473,6 +473,7 @@ std::future PythonWrapper::StartApp( "--window_duration_s", config.window_duration, "--cpu", config.use_cpu ? "1" : "0", "--use_builtin", config.use_builtin ? "1" : "0", + "--enable_uwu_filter", config.enable_uwu_filter ? "1" : "0", "--emotes_pickle", kEmotesPickle, "--gpu_idx", std::to_string(config.gpu_idx), "--keybind", Quote(config.keybind), -- cgit v1.2.3