updates to try to connect obs to service items

This commit is contained in:
Chris Cochrun 2023-10-30 12:59:20 -05:00
parent 039b116498
commit 4cb57b0b96
2 changed files with 8 additions and 4 deletions

View file

@ -3,19 +3,18 @@ use std::error::Error;
use obws::Client; use obws::Client;
use obws::responses::scenes::Scenes; use obws::responses::scenes::Scenes;
use tracing::debug; use tracing::debug;
pub struct Obs { pub struct Obs {
scenes: Scenes, scenes: Scenes,
client: Client, client: Client,
} }
impl Obs { impl Obs {
pub async fn setup(mut self) -> Result<(), Box<dyn Error>> { pub async fn new() -> Result<Self, Box<dyn Error>> {
let client = Client::connect("localhost", 4455, Some("")).await?; let client = Client::connect("localhost", 4455, Some("")).await?;
let scene_list = client.scenes().list().await?; let scene_list = client.scenes().list().await?;
debug!(?scene_list); debug!(?scene_list);
self.scenes = scene_list; Ok(Self{scenes: scene_list, client})
self.client = client;
Ok(())
} }
pub fn get_list(self) -> Result<Vec<String>, Box<dyn Error>> { pub fn get_list(self) -> Result<Vec<String>, Box<dyn Error>> {

View file

@ -87,6 +87,7 @@ mod service_item_model {
pub struct ServiceItemMod { pub struct ServiceItemMod {
id: i32, id: i32,
service_items: Vec<ServiceItm>, service_items: Vec<ServiceItm>,
obs: Obs,
} }
#[cxx_qt::qsignals(ServiceItemMod)] #[cxx_qt::qsignals(ServiceItemMod)]
@ -153,6 +154,10 @@ mod service_item_model {
use crate::obs::Obs; use crate::obs::Obs;
impl qobject::ServiceItemMod { impl qobject::ServiceItemMod {
pub fn setup(mut self: Pin<&mut Self>) {
todo!()
}
#[qinvokable] #[qinvokable]
pub fn clear(mut self: Pin<&mut Self>) { pub fn clear(mut self: Pin<&mut Self>) {
println!("CLEARING ALL ITEMS"); println!("CLEARING ALL ITEMS");