diff --git a/src/rust/obs.rs b/src/rust/obs.rs index 5472cf6..00da796 100644 --- a/src/rust/obs.rs +++ b/src/rust/obs.rs @@ -3,19 +3,18 @@ use std::error::Error; use obws::Client; use obws::responses::scenes::Scenes; use tracing::debug; + pub struct Obs { scenes: Scenes, client: Client, } impl Obs { - pub async fn setup(mut self) -> Result<(), Box> { + pub async fn new() -> Result> { let client = Client::connect("localhost", 4455, Some("")).await?; let scene_list = client.scenes().list().await?; debug!(?scene_list); - self.scenes = scene_list; - self.client = client; - Ok(()) + Ok(Self{scenes: scene_list, client}) } pub fn get_list(self) -> Result, Box> { diff --git a/src/rust/service_item_model.rs b/src/rust/service_item_model.rs index 508222c..d36e69f 100644 --- a/src/rust/service_item_model.rs +++ b/src/rust/service_item_model.rs @@ -87,6 +87,7 @@ mod service_item_model { pub struct ServiceItemMod { id: i32, service_items: Vec, + obs: Obs, } #[cxx_qt::qsignals(ServiceItemMod)] @@ -153,6 +154,10 @@ mod service_item_model { use crate::obs::Obs; impl qobject::ServiceItemMod { + pub fn setup(mut self: Pin<&mut Self>) { + todo!() + } + #[qinvokable] pub fn clear(mut self: Pin<&mut Self>) { println!("CLEARING ALL ITEMS");