making obs an option so that incase of errors we can set to None
This is really effective since it means we can still launch the app without obs running too. Now I'll still need to figure out why it's having problems though.
This commit is contained in:
parent
b1eef88c8a
commit
7bf4341819
1 changed files with 26 additions and 21 deletions
|
@ -84,30 +84,33 @@ mod service_item_model {
|
|||
}
|
||||
|
||||
#[cxx_qt::qobject(base = "QAbstractListModel")]
|
||||
#[derive(Debug, Default)]
|
||||
#[derive(Debug)]
|
||||
pub struct ServiceItemMod {
|
||||
id: i32,
|
||||
service_items: Vec<ServiceItm>,
|
||||
// obs: Obs,
|
||||
obs: Option<Obs>,
|
||||
}
|
||||
|
||||
// impl Default for ServiceItemMod {
|
||||
// fn default() -> Self {
|
||||
// let obs = tokio::runtime::Runtime::new()
|
||||
// .unwrap()
|
||||
// .block_on(async {
|
||||
// match Obs::new().await {
|
||||
// Ok(o) => o,
|
||||
// Err(e) => error!(e),
|
||||
// }
|
||||
// });
|
||||
// Self {
|
||||
// id: 0,
|
||||
// service_items: Vec::new(),
|
||||
// obs,
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
impl Default for ServiceItemMod {
|
||||
fn default() -> Self {
|
||||
let obs = tokio::runtime::Runtime::new()
|
||||
.unwrap()
|
||||
.block_on(async {
|
||||
match Obs::new().await {
|
||||
Ok(o) => Some(o),
|
||||
Err(e) => {
|
||||
error!(e);
|
||||
None
|
||||
},
|
||||
}
|
||||
});
|
||||
Self {
|
||||
id: 0,
|
||||
service_items: Vec::new(),
|
||||
obs,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cxx_qt::qsignals(ServiceItemMod)]
|
||||
pub enum Signals<'a> {
|
||||
|
@ -605,7 +608,7 @@ mod service_item_model {
|
|||
// println!("service_item is deactivating {:?}", i);
|
||||
service_item.active = false;
|
||||
}
|
||||
// let obs = self.as_mut().obs_mut().clone();
|
||||
let obs = self.as_mut().obs_mut().clone();
|
||||
|
||||
if let Some(service_item) = self
|
||||
.as_mut()
|
||||
|
@ -617,7 +620,9 @@ mod service_item_model {
|
|||
background = ?service_item.background,
|
||||
background_type = ?service_item.background_type);
|
||||
service_item.active = true;
|
||||
// obs.set_scene(service_item.obs_scene.to_string());
|
||||
if let Some(obs) = obs {
|
||||
obs.set_scene(service_item.obs_scene.to_string());
|
||||
}
|
||||
self.as_mut().emit_data_changed(
|
||||
tl,
|
||||
br,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue