diff options
| author | yum <yum.food.vr@gmail.com> | 2023-05-24 23:07:07 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2023-05-24 23:07:07 -0700 |
| commit | eed2e8915d83796679c0b7a3ea9121d329ceddab (patch) | |
| tree | 3a3e9d5fb009d651051bcc9cc9f8f22cc940cd8c /GUI | |
| parent | 3dd5e839449f5056ca9493c0eab6a3e02fe1e86e (diff) | |
Add more text filters
Add 3 filters:
* Remove trailing period
* Convert to uppercase
* Convert to lowercase
All may be composed. Upper/lower just overwrite each other so just use
one.
Diffstat (limited to 'GUI')
| -rw-r--r-- | GUI/GUI/GUI/Config.cpp | 9 | ||||
| -rw-r--r-- | GUI/GUI/GUI/Config.h | 3 | ||||
| -rw-r--r-- | GUI/GUI/GUI/Frame.cpp | 48 | ||||
| -rw-r--r-- | GUI/GUI/GUI/Frame.h | 3 | ||||
| -rw-r--r-- | GUI/GUI/GUI/PythonWrapper.cpp | 3 |
5 files changed, 66 insertions, 0 deletions
diff --git a/GUI/GUI/GUI/Config.cpp b/GUI/GUI/GUI/Config.cpp index 0443278..f0b5a1b 100644 --- a/GUI/GUI/GUI/Config.cpp +++ b/GUI/GUI/GUI/Config.cpp @@ -72,6 +72,9 @@ AppConfig::AppConfig(wxTextCtrl* out) use_cpu(false),
use_builtin(false),
enable_uwu_filter(false),
+ remove_trailing_period(false),
+ enable_uppercase_filter(false),
+ enable_lowercase_filter(false),
gpu_idx(0),
keybind("ctrl+x"),
@@ -117,6 +120,9 @@ bool AppConfig::Serialize(const std::filesystem::path& path) { cm.Set("use_cpu", use_cpu);
cm.Set("use_builtin", use_builtin);
cm.Set("enable_uwu_filter", enable_uwu_filter);
+ cm.Set("remove_trailing_period", remove_trailing_period);
+ cm.Set("enable_uppercase_filter", enable_uppercase_filter);
+ cm.Set("enable_lowercase_filter", enable_lowercase_filter);
cm.Set("gpu_idx", gpu_idx);
cm.Set("keybind", keybind);
@@ -175,6 +181,9 @@ bool AppConfig::Deserialize(const std::filesystem::path& path) { 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("remove_trailing_period", c.remove_trailing_period);
+ cm.Get("enable_uppercase_filter", c.enable_uppercase_filter);
+ cm.Get("enable_lowercase_filter", c.enable_lowercase_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 be036ea..01b0239 100644 --- a/GUI/GUI/GUI/Config.h +++ b/GUI/GUI/GUI/Config.h @@ -58,6 +58,9 @@ public: bool use_cpu;
bool use_builtin;
bool enable_uwu_filter;
+ bool remove_trailing_period;
+ bool enable_uppercase_filter;
+ bool enable_lowercase_filter;
int gpu_idx;
std::string keybind;
diff --git a/GUI/GUI/GUI/Frame.cpp b/GUI/GUI/GUI/Frame.cpp index 221c59c..7e965df 100644 --- a/GUI/GUI/GUI/Frame.cpp +++ b/GUI/GUI/GUI/Frame.cpp @@ -40,6 +40,9 @@ namespace { ID_PY_APP_USE_CPU,
ID_PY_APP_USE_BUILTIN,
ID_PY_APP_ENABLE_UWU_FILTER,
+ ID_PY_APP_REMOVE_TRAILING_PERIOD,
+ ID_PY_APP_ENABLE_UPPERCASE_FILTER,
+ ID_PY_APP_ENABLE_LOWERCASE_FILTER,
ID_PY_APP_ROWS,
ID_PY_APP_COLS,
ID_PY_APP_WINDOW_DURATION,
@@ -603,6 +606,30 @@ Frame::Frame() );
py_app_enable_uwu_filter_ = py_app_enable_uwu_filter;
+ auto* py_app_remove_trailing_period = new wxCheckBox(py_config_panel,
+ ID_PY_APP_REMOVE_TRAILING_PERIOD, "Remove trailing period");
+ py_app_remove_trailing_period->SetValue(app_c_->remove_trailing_period);
+ py_app_remove_trailing_period->SetToolTip(
+ "If checked, transcriptions will never end with a period."
+ );
+ py_app_remove_trailing_period_ = py_app_remove_trailing_period;
+
+ auto* py_app_enable_uppercase_filter = new wxCheckBox(py_config_panel,
+ ID_PY_APP_ENABLE_UPPERCASE_FILTER, "Enable uppercase filter");
+ py_app_enable_uppercase_filter->SetValue(app_c_->enable_uppercase_filter);
+ py_app_enable_uppercase_filter->SetToolTip(
+ "If checked, transcribed text will be converted to UPPERCASE."
+ );
+ py_app_enable_uppercase_filter_ = py_app_enable_uppercase_filter;
+
+ auto* py_app_enable_lowercase_filter = new wxCheckBox(py_config_panel,
+ ID_PY_APP_ENABLE_LOWERCASE_FILTER, "Enable lowercase filter");
+ py_app_enable_lowercase_filter->SetValue(app_c_->enable_lowercase_filter);
+ py_app_enable_lowercase_filter->SetToolTip(
+ "If checked, transcribed text will be converted to lowercase."
+ );
+ py_app_enable_lowercase_filter_ = py_app_enable_lowercase_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,
@@ -624,6 +651,12 @@ Frame::Frame() /*flags=*/wxEXPAND);
sizer->Add(py_app_enable_uwu_filter, /*proportion=*/0,
/*flags=*/wxEXPAND);
+ sizer->Add(py_app_remove_trailing_period, /*proportion=*/0,
+ /*flags=*/wxEXPAND);
+ sizer->Add(py_app_enable_uppercase_filter, /*proportion=*/0,
+ /*flags=*/wxEXPAND);
+ sizer->Add(py_app_enable_lowercase_filter, /*proportion=*/0,
+ /*flags=*/wxEXPAND);
sizer->Add(py_app_start_button, /*proportion=*/0,
/*flags=*/wxEXPAND);
sizer->Add(py_app_stop_button, /*proportion=*/0,
@@ -1101,6 +1134,15 @@ void Frame::ApplyConfigToInputFields() auto* py_app_enable_uwu_filter = static_cast<wxCheckBox*>(FindWindowById(ID_PY_APP_ENABLE_UWU_FILTER));
py_app_enable_uwu_filter->SetValue(app_c_->enable_uwu_filter);
+ auto* py_app_remove_trailing_period = static_cast<wxCheckBox*>(FindWindowById(ID_PY_APP_REMOVE_TRAILING_PERIOD));
+ py_app_remove_trailing_period->SetValue(app_c_->remove_trailing_period);
+
+ auto* py_app_enable_uppercase_filter = static_cast<wxCheckBox*>(FindWindowById(ID_PY_APP_ENABLE_UPPERCASE_FILTER));
+ py_app_enable_uppercase_filter->SetValue(app_c_->enable_uppercase_filter);
+
+ auto* py_app_enable_lowercase_filter = static_cast<wxCheckBox*>(FindWindowById(ID_PY_APP_ENABLE_LOWERCASE_FILTER));
+ py_app_enable_lowercase_filter->SetValue(app_c_->enable_lowercase_filter);
+
// Unity panel
auto* unity_chars_per_sync = static_cast<wxChoice*>(FindWindowById(ID_UNITY_CHARS_PER_SYNC));
unity_chars_per_sync->SetSelection(chars_idx);
@@ -1671,6 +1713,9 @@ void Frame::OnAppStart(wxCommandEvent& event) { 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();
+ const bool remove_trailing_period = py_app_remove_trailing_period_->GetValue();
+ const bool enable_uppercase_filter = py_app_enable_uppercase_filter_->GetValue();
+ const bool enable_lowercase_filter = py_app_enable_lowercase_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 =
@@ -1740,6 +1785,9 @@ void Frame::OnAppStart(wxCommandEvent& event) { app_c_->use_cpu = use_cpu;
app_c_->use_builtin = use_builtin;
app_c_->enable_uwu_filter = enable_uwu_filter;
+ app_c_->remove_trailing_period = remove_trailing_period;
+ app_c_->enable_uppercase_filter = enable_uppercase_filter;
+ app_c_->enable_lowercase_filter = enable_lowercase_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 130a716..f5a8cd9 100644 --- a/GUI/GUI/GUI/Frame.h +++ b/GUI/GUI/GUI/Frame.h @@ -81,6 +81,9 @@ private: wxCheckBox* py_app_use_cpu_;
wxCheckBox* py_app_use_builtin_;
wxCheckBox* py_app_enable_uwu_filter_;
+ wxCheckBox* py_app_remove_trailing_period_;
+ wxCheckBox* py_app_enable_uppercase_filter_;
+ wxCheckBox* py_app_enable_lowercase_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 98a0c3e..5df1dfa 100644 --- a/GUI/GUI/GUI/PythonWrapper.cpp +++ b/GUI/GUI/GUI/PythonWrapper.cpp @@ -474,6 +474,9 @@ std::future<bool> PythonWrapper::StartApp( "--cpu", config.use_cpu ? "1" : "0", "--use_builtin", config.use_builtin ? "1" : "0", "--enable_uwu_filter", config.enable_uwu_filter ? "1" : "0", + "--remove_trailing_period", config.remove_trailing_period ? "1" : "0", + "--enable_uppercase_filter", config.enable_uppercase_filter ? "1" : "0", + "--enable_lowercase_filter", config.enable_lowercase_filter ? "1" : "0", "--emotes_pickle", kEmotesPickle, "--gpu_idx", std::to_string(config.gpu_idx), "--keybind", Quote(config.keybind), |
