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