better ui for the obs list
This commit is contained in:
parent
259e7201d7
commit
9bcddfe69d
2 changed files with 17 additions and 11 deletions
|
@ -4,6 +4,7 @@ import QtQuick.Controls 2.12 as Controls
|
|||
/* import QtQuick.Window 2.15 */
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQuick.Shapes 1.15
|
||||
import QtQml.Models 2.15
|
||||
/* import QtQml.Models 2.12 */
|
||||
/* import QtMultimedia 5.15 */
|
||||
/* import QtAudioEngine 1.15 */
|
||||
|
@ -292,19 +293,20 @@ Item {
|
|||
|
||||
Controls.MenuSeparator {}
|
||||
|
||||
|
||||
Controls.Menu {
|
||||
id: obsMenu
|
||||
title: "Obs Scenes"
|
||||
|
||||
ListView {
|
||||
width: parent.width
|
||||
height: 200
|
||||
Instantiator {
|
||||
model: ObsModel.scenes
|
||||
delegate: Controls.ToolButton {
|
||||
width: parent.width
|
||||
Kirigami.Action {
|
||||
text: modelData
|
||||
onClicked: ObsModel.setScene(modelData)
|
||||
onTriggered: {
|
||||
showPassiveNotification("setting: " + modelData)
|
||||
}
|
||||
}
|
||||
onObjectAdded: obsMenu.insertAction(index, object)
|
||||
onObjectRemoved: obsMenu.removeAction(object)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -675,4 +677,5 @@ Item {
|
|||
}
|
||||
serviceItemList.forceLayout()
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -72,13 +72,13 @@ impl Obs {
|
|||
if self.client.is_some() {
|
||||
debug!("Starting to set");
|
||||
let runtime = tokio::runtime::Runtime::new().unwrap();
|
||||
tokio::spawn(async move {
|
||||
runtime.block_on(async move {
|
||||
debug!(scene, "working in thread");
|
||||
self.client
|
||||
.unwrap()
|
||||
.scenes()
|
||||
.set_current_program_scene(scene.as_str()).await
|
||||
});
|
||||
})?;
|
||||
Ok(())
|
||||
} else {
|
||||
Err("There is no client".to_owned())?
|
||||
|
@ -126,7 +126,7 @@ mod obs_model {
|
|||
let mut scenes_list = QList_QString::default();
|
||||
if let Some(obs) = self.obs() {
|
||||
debug!("found obs");
|
||||
for scene in obs.scenes.scenes.iter() {
|
||||
for scene in obs.scenes.scenes.iter().rev() {
|
||||
debug!(?scene);
|
||||
scenes_list.append(QString::from(&scene.name));
|
||||
}
|
||||
|
@ -151,7 +151,10 @@ mod obs_model {
|
|||
self.as_mut().set_obs(Some(o));
|
||||
self.as_mut().update_scenes();
|
||||
},
|
||||
Err(e) => error!(e)
|
||||
Err(e) => {
|
||||
error!(e);
|
||||
self.as_mut().set_connected(false);
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue