From 28d2a7cca91a32253b8ea32a9e85e22cdbf166f9 Mon Sep 17 00:00:00 2001 From: Bel LaPointe Date: Mon, 27 Mar 2023 16:00:40 -0600 Subject: [PATCH] drop unused press prefix+suffix and release suffix --- src/config.rs | 18 ++---------------- src/gui.rs | 16 +++++----------- 2 files changed, 7 insertions(+), 27 deletions(-) diff --git a/src/config.rs b/src/config.rs index 3df8996..5133621 100644 --- a/src/config.rs +++ b/src/config.rs @@ -37,8 +37,7 @@ pub struct Device { #[derive(Serialize, Deserialize, Debug)] pub struct GUI { pub buttons: Buttons, - pub press: PreSufFix, - pub release: PreSufFix, + pub release_prefix: String, pub format: Option, pub user: String, pub feedback: GUIFeedback, @@ -49,12 +48,6 @@ pub struct GUIFeedback { pub url: Option, } -#[derive(Serialize, Deserialize, Debug)] -pub struct PreSufFix { - pub prefix: String, - pub suffix: String, -} - #[derive(Serialize, Deserialize, Debug)] pub struct Buttons { pub up: String, @@ -128,14 +121,7 @@ fn build_config_std() -> Config { l: env::var("INPUT_GUI_BUTTON_L").unwrap_or(String::from("q")), r: env::var("INPUT_GUI_BUTTON_R").unwrap_or(String::from("e")), }, - press: PreSufFix{ - prefix: env::var("INPUT_GUI_PRESS_PREFIX").unwrap_or(String::from("")), - suffix: env::var("INPUT_GUI_PRESS_SUFFIX").unwrap_or(String::from("")), - }, - release: PreSufFix{ - prefix: env::var("INPUT_GUI_RELEASE_PREFIX").unwrap_or(String::from("")), - suffix: env::var("INPUT_GUI_RELEASE_SUFFIX").unwrap_or(String::from("")), - }, + release_prefix: env::var("INPUT_GUI_RELEASE_PREFIX").unwrap_or(String::from("")), user: env::var("INPUT_GUI_USER").unwrap_or(String::from("me")), format: match env::var("INPUT_GUI_FORMAT") { Ok(x) => Some(x), diff --git a/src/gui.rs b/src/gui.rs index 70c4def..155089b 100644 --- a/src/gui.rs +++ b/src/gui.rs @@ -113,6 +113,9 @@ impl Main { } } + fn send_say(&mut self, text: String) { + } + fn exchange(&mut self) { self.exchange_send(); self.exchange_recv(); @@ -134,15 +137,9 @@ impl Main { for key_code in self.keys_newly_down.iter() { match self.key_code_to_string(key_code) { Some(x) => { - for c in self.flags.cfg.press.prefix.chars() { - s.push(c); - } for c in x.chars() { s.push(c); } - for c in self.flags.cfg.press.suffix.chars() { - s.push(c); - } self.keys_already_down.push(*key_code); }, None => {}, @@ -154,13 +151,10 @@ impl Main { match self.key_code_to_string(key_code) { Some(x) => { for c in x.chars() { - for c in self.flags.cfg.release.prefix.chars() { + for c in self.flags.cfg.release_prefix.chars() { t.push(c); } t.push(c); - for c in self.flags.cfg.release.suffix.chars() { - t.push(c); - } } }, None => {}, @@ -249,8 +243,8 @@ impl Application for Main { self.input_text_entry_value = payload; }, Message::InputTextEntrySubmitSay => { + self.send_say(self.input_text_entry_value.clone()); self.input_text_entry_value = String::from(""); - eprintln!("TODO"); }, Message::InputTextEntrySubmitSend => { self.input_text_entry_value = String::from("");