adding id to the service_item_model of the corresponding model
This commit is contained in:
parent
a00f1b081a
commit
74f5596946
4 changed files with 31 additions and 9 deletions
|
@ -209,7 +209,7 @@ int main(int argc, char *argv[])
|
|||
serviceItemModel.get()->addItem("Black", "image",
|
||||
"qrc:/assets/black.jpg",
|
||||
"image", QStringList(""),
|
||||
"", "", 0, 1, false, 0, 0);
|
||||
"", "", 0, 1, false, 0, 0, 0);
|
||||
}
|
||||
|
||||
// apparently mpv needs this class set
|
||||
|
|
|
@ -189,6 +189,11 @@ Controls.Page {
|
|||
}
|
||||
}
|
||||
|
||||
/* Connections { */
|
||||
/* target: SlideModel */
|
||||
/* function */
|
||||
/* } */
|
||||
|
||||
function changeServiceItem(index) {
|
||||
console.log("change-service-item: " + index);
|
||||
const item = ServiceItemC.getRust(index, ServiceItemModel);
|
||||
|
|
|
@ -580,7 +580,7 @@ Item {
|
|||
ServiceItemModel.insertItem(index, image.title,
|
||||
"", type, image.filePath,
|
||||
"image", "",
|
||||
"", 0, 0, false, 0.0, 0.0);
|
||||
"", 0, 0, false, 0.0, 0.0, itemIndex);
|
||||
serviceItemList.forceLayout()
|
||||
return;
|
||||
}
|
||||
|
@ -590,7 +590,7 @@ Item {
|
|||
ServiceItemModel.insertItem(index, video.title,
|
||||
"", type, video.filePath,
|
||||
"video", "",
|
||||
"", 0, 0, video.loop, video.startTime, video.endTime);
|
||||
"", 0, 0, video.loop, video.startTime, video.endTime, itemIndex);
|
||||
serviceItemList.forceLayout()
|
||||
return;
|
||||
}
|
||||
|
@ -605,7 +605,7 @@ Item {
|
|||
lyrics, type, song.background,
|
||||
song.backgroundType,
|
||||
song.audio, song.font, song.fontSize,
|
||||
lyrics.length, true, 0.0, 0.0);
|
||||
lyrics.length, true, 0.0, 0.0, itemIndex);
|
||||
serviceItemList.forceLayout()
|
||||
return;
|
||||
}
|
||||
|
@ -617,7 +617,7 @@ Item {
|
|||
ServiceItemModel.insertItem(index, pres.title,
|
||||
"", type, pres.filePath,
|
||||
"image",
|
||||
"", "", 0, pres.pageCount, false, 0.0, 0.0);
|
||||
"", "", 0, pres.pageCount, false, 0.0, 0.0, itemIndex);
|
||||
serviceItemList.forceLayout()
|
||||
return;
|
||||
}
|
||||
|
@ -635,7 +635,7 @@ Item {
|
|||
ServiceItemModel.addItem(image.title,
|
||||
type, image.filePath,
|
||||
"image", "", "",
|
||||
"", 0, 0, false, 0.0, 0.0);
|
||||
"", 0, 0, false, 0.0, 0.0, itemIndex);
|
||||
serviceItemList.forceLayout()
|
||||
return;
|
||||
}
|
||||
|
@ -645,7 +645,7 @@ Item {
|
|||
ServiceItemModel.addItem(video.title,
|
||||
type, video.filePath,
|
||||
"video", "", "",
|
||||
"", 0, 0, video.loop, video.startTime, video.endTime);
|
||||
"", 0, 0, video.loop, video.startTime, video.endTime, itemIndex);
|
||||
serviceItemList.forceLayout()
|
||||
return;
|
||||
}
|
||||
|
@ -659,7 +659,7 @@ Item {
|
|||
type, song.background,
|
||||
song.backgroundType, lyrics,
|
||||
song.audio, song.font, song.fontSize,
|
||||
lyrics.length, true, 0.0, 0.0);
|
||||
lyrics.length, true, 0.0, 0.0, itemIndex);
|
||||
serviceItemList.forceLayout()
|
||||
return;
|
||||
}
|
||||
|
@ -672,7 +672,7 @@ Item {
|
|||
type, pres.filePath,
|
||||
"image", "",
|
||||
"", "", 0, pres.pageCount,
|
||||
false, 0.0, 0.0);
|
||||
false, 0.0, 0.0, itemIndex);
|
||||
serviceItemList.forceLayout()
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ mod service_item_model {
|
|||
Looping,
|
||||
VideoStartTime,
|
||||
VideoEndTime,
|
||||
Id,
|
||||
}
|
||||
|
||||
unsafe extern "RustQt" {
|
||||
|
@ -120,6 +121,7 @@ mod service_item_model {
|
|||
looping: bool,
|
||||
video_start_time: f32,
|
||||
video_end_time: f32,
|
||||
id: i32,
|
||||
);
|
||||
|
||||
#[qinvokable]
|
||||
|
@ -138,6 +140,7 @@ mod service_item_model {
|
|||
looping: bool,
|
||||
video_start_time: f32,
|
||||
video_end_time: f32,
|
||||
id: i32,
|
||||
);
|
||||
|
||||
#[qinvokable]
|
||||
|
@ -318,6 +321,7 @@ pub struct ServiceItem {
|
|||
video_start_time: f32,
|
||||
video_end_time: f32,
|
||||
obs_scene: QString,
|
||||
id: i32,
|
||||
}
|
||||
|
||||
impl ServiceItem {
|
||||
|
@ -344,6 +348,7 @@ impl Default for ServiceItem {
|
|||
video_start_time: 0.0,
|
||||
video_end_time: 0.0,
|
||||
obs_scene: QString::default(),
|
||||
id: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -427,6 +432,7 @@ impl service_item_model::ServiceItemModel {
|
|||
looping: bool,
|
||||
video_start_time: f32,
|
||||
video_end_time: f32,
|
||||
id: i32,
|
||||
) {
|
||||
let service_item = ServiceItem {
|
||||
name,
|
||||
|
@ -441,6 +447,7 @@ impl service_item_model::ServiceItemModel {
|
|||
looping,
|
||||
video_start_time,
|
||||
video_end_time,
|
||||
id,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
@ -484,6 +491,7 @@ impl service_item_model::ServiceItemModel {
|
|||
looping: bool,
|
||||
video_start_time: f32,
|
||||
video_end_time: f32,
|
||||
id: i32,
|
||||
) {
|
||||
let service_item = ServiceItem {
|
||||
name,
|
||||
|
@ -498,6 +506,7 @@ impl service_item_model::ServiceItemModel {
|
|||
looping,
|
||||
video_start_time,
|
||||
video_end_time,
|
||||
id,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
@ -1326,6 +1335,7 @@ impl service_item_model::ServiceItemModel {
|
|||
ServiceRoles::Looping => 11,
|
||||
ServiceRoles::VideoStartTime => 12,
|
||||
ServiceRoles::VideoEndTime => 13,
|
||||
ServiceRoles::Id => 14,
|
||||
_ => 0,
|
||||
}
|
||||
}
|
||||
|
@ -1381,6 +1391,9 @@ impl service_item_model::ServiceItemModel {
|
|||
ServiceRoles::VideoEndTime => {
|
||||
QVariant::from(&service_item.video_end_time)
|
||||
}
|
||||
ServiceRoles::Id => {
|
||||
QVariant::from(&service_item.id)
|
||||
}
|
||||
_ => QVariant::default(),
|
||||
};
|
||||
}
|
||||
|
@ -1448,6 +1461,10 @@ impl service_item_model::ServiceItemModel {
|
|||
ServiceRoles::VideoEndTime.repr,
|
||||
QByteArray::from("videoEndTime"),
|
||||
);
|
||||
roles.insert(
|
||||
ServiceRoles::Id.repr,
|
||||
QByteArray::from("id"),
|
||||
);
|
||||
roles
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue