add video_thumbnail additional
The actual code to generate thumbnails is still in C++ but I've added a helper method to Rust now. It still needs connected.
This commit is contained in:
parent
6a15f9a652
commit
995f9ffc03
2 changed files with 22 additions and 13 deletions
|
@ -36,10 +36,10 @@ Item {
|
||||||
implicitHeight: parent.height - Kirigami.Units.smallSpacing * 2
|
implicitHeight: parent.height - Kirigami.Units.smallSpacing * 2
|
||||||
textSize: model.fontSize
|
textSize: model.fontSize
|
||||||
itemType: model.type
|
itemType: model.type
|
||||||
imageSource: model.videoBackground != "" ? model.vidThumbnail : model.imageBackground
|
imageSource: model.videoBackground != "" ? model.videoThumbnail : model.imageBackground
|
||||||
chosenFont: model.font
|
chosenFont: model.font
|
||||||
text: model.text
|
text: model.text
|
||||||
pdfIndex: slideIndex
|
pdfIndex: model.slideId
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,19 +111,9 @@ mod slide_model {
|
||||||
SelectedRole,
|
SelectedRole,
|
||||||
LoopingRole,
|
LoopingRole,
|
||||||
TextRole,
|
TextRole,
|
||||||
|
VideoThumbnailRole,
|
||||||
}
|
}
|
||||||
|
|
||||||
// impl Role {
|
|
||||||
// pub fn get_role(&self) -> i32 {
|
|
||||||
// match self {
|
|
||||||
// Role::ActiveRole => 12,
|
|
||||||
// Role::SelectedRole => 13,
|
|
||||||
// Role::LoopingRole => 14,
|
|
||||||
// Role::TextRole => 1,
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
impl qobject::SlideyMod {
|
impl qobject::SlideyMod {
|
||||||
// #[qinvokable]
|
// #[qinvokable]
|
||||||
// pub fn add(self: Pin<&mut Self>) {
|
// pub fn add(self: Pin<&mut Self>) {
|
||||||
|
@ -177,6 +167,24 @@ mod slide_model {
|
||||||
QString::default()
|
QString::default()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[qinvokable]
|
||||||
|
pub fn add_video_thumbnail(
|
||||||
|
mut self: Pin<&mut Self>,
|
||||||
|
video: QString,
|
||||||
|
service_item_id: i32,
|
||||||
|
index: i32,
|
||||||
|
) {
|
||||||
|
let model_index = &self.as_ref().index(index, 0, &QModelIndex::default());
|
||||||
|
let mut vector_roles = QVector_i32::default();
|
||||||
|
vector_roles.append(self.get_role(Role::VideoThumbnailRole));
|
||||||
|
if let Some(slide) = self.as_mut().slides_mut().get_mut(index as usize) {
|
||||||
|
slide.video_thumbnail = video;
|
||||||
|
}
|
||||||
|
self.as_mut()
|
||||||
|
.emit_data_changed(model_index, model_index, &vector_roles);
|
||||||
|
println!("AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH");
|
||||||
|
}
|
||||||
|
|
||||||
#[qinvokable]
|
#[qinvokable]
|
||||||
pub fn clear(mut self: Pin<&mut Self>) {
|
pub fn clear(mut self: Pin<&mut Self>) {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -694,6 +702,7 @@ mod slide_model {
|
||||||
Role::SelectedRole => 13,
|
Role::SelectedRole => 13,
|
||||||
Role::LoopingRole => 14,
|
Role::LoopingRole => 14,
|
||||||
Role::TextRole => 1,
|
Role::TextRole => 1,
|
||||||
|
Role::VideoThumbnailRole => 15,
|
||||||
_ => 0,
|
_ => 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue