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::responses::scenes::Scenes;
use tracing::debug;
pub struct Obs {
scenes: Scenes,
client: Client,
}
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 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<Vec<String>, Box<dyn Error>> {

View file

@ -87,6 +87,7 @@ mod service_item_model {
pub struct ServiceItemMod {
id: i32,
service_items: Vec<ServiceItm>,
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");