adding video_start_time and video_end_time

Both of these properties will be used to track when a video needs to
start and end during the slide show.
This commit is contained in:
Chris Cochrun 2023-04-17 21:27:50 -05:00
parent 90f551edff
commit a93aa37d53
2 changed files with 166 additions and 148 deletions

View file

@ -59,6 +59,10 @@ mod slide_model {
looping: bool, looping: bool,
#[qproperty] #[qproperty]
video_thumbnail: QString, video_thumbnail: QString,
#[qproperty]
video_start_time: f32,
#[qproperty]
video_end_time: f32,
} }
impl Default for Slidey { impl Default for Slidey {
@ -80,6 +84,8 @@ mod slide_model {
selected: false, selected: false,
looping: false, looping: false,
video_thumbnail: QString::default(), video_thumbnail: QString::default(),
video_start_time: 0.0,
video_end_time: 0.0,
} }
} }
} }
@ -112,6 +118,8 @@ mod slide_model {
LoopingRole, LoopingRole,
TextRole, TextRole,
VideoThumbnailRole, VideoThumbnailRole,
VideoStartTimeRole,
VideoEndTimeRole,
} }
// use crate::video_thumbnail; // use crate::video_thumbnail;
@ -263,80 +271,80 @@ mod slide_model {
let text_vec = Vec::<QString>::from(&QList_QString::from(&textlist)); let text_vec = Vec::<QString>::from(&QList_QString::from(&textlist));
// let vec_slize: &[usize] = &text_vec; // let vec_slize: &[usize] = &text_vec;
let mut slide = Slidey { let mut slide = Slidey::default();
ty: service_item
.get(&QString::from("type")) slide.ty = service_item
.unwrap_or(QVariant::from(&QString::from(""))) .get(&QString::from("type"))
.value() .unwrap_or(QVariant::from(&QString::from("")))
.unwrap_or(QString::from("")), .value()
text: service_item .unwrap_or(QString::from(""));
.get(&QString::from("text")) slide.text = service_item
.unwrap_or(QVariant::from(&QString::from(""))) .get(&QString::from("text"))
.value() .unwrap_or(QVariant::from(&QString::from("")))
.unwrap_or(QString::from("")), .value()
image_background: service_item .unwrap_or(QString::from(""));
.get(&QString::from("imageBackground")) slide.image_background = service_item
.unwrap_or(QVariant::from(&QString::from(""))) .get(&QString::from("imageBackground"))
.value() .unwrap_or(QVariant::from(&QString::from("")))
.unwrap_or(QString::from("")), .value()
video_background: service_item .unwrap_or(QString::from(""));
.get(&QString::from("videoBackground")) slide.video_background = service_item
.unwrap_or(QVariant::from(&QString::from(""))) .get(&QString::from("videoBackground"))
.value() .unwrap_or(QVariant::from(&QString::from("")))
.unwrap_or(QString::from("")), .value()
audio: service_item .unwrap_or(QString::from(""));
.get(&QString::from("audio")) slide.audio = service_item
.unwrap_or(QVariant::from(&QString::from(""))) .get(&QString::from("audio"))
.value() .unwrap_or(QVariant::from(&QString::from("")))
.unwrap_or(QString::from("")), .value()
font: service_item .unwrap_or(QString::from(""));
.get(&QString::from("font")) slide.font = service_item
.unwrap_or(QVariant::from(&QString::from(""))) .get(&QString::from("font"))
.value() .unwrap_or(QVariant::from(&QString::from("")))
.unwrap_or(QString::from("")), .value()
font_size: service_item .unwrap_or(QString::from(""));
.get(&QString::from("fontSize")) slide.font_size = service_item
.unwrap_or(QVariant::from(&50)) .get(&QString::from("fontSize"))
.value() .unwrap_or(QVariant::from(&50))
.unwrap_or(50), .value()
htext_alignment: service_item .unwrap_or(50);
.get(&QString::from("vtextAlignment")) slide.htext_alignment = service_item
.unwrap_or(QVariant::from(&QString::from("center"))) .get(&QString::from("vtextAlignment"))
.value() .unwrap_or(QVariant::from(&QString::from("center")))
.unwrap_or(QString::from("center")), .value()
vtext_alignment: service_item .unwrap_or(QString::from("center"));
.get(&QString::from("vtextAlignment")) slide.vtext_alignment = service_item
.unwrap_or(QVariant::from(&QString::from("center"))) .get(&QString::from("vtextAlignment"))
.value() .unwrap_or(QVariant::from(&QString::from("center")))
.unwrap_or(QString::from("center")), .value()
service_item_id: index, .unwrap_or(QString::from("center"));
slide_index: service_item slide.service_item_id = index;
.get(&QString::from("slideNumber")) slide.slide_index = service_item
.unwrap_or(QVariant::from(&0)) .get(&QString::from("slideNumber"))
.value() .unwrap_or(QVariant::from(&0))
.unwrap_or(0), .value()
slide_count: service_item .unwrap_or(0);
.get(&QString::from("slideNumber")) slide.slide_count = service_item
.unwrap_or(QVariant::from(&1)) .get(&QString::from("slideNumber"))
.value() .unwrap_or(QVariant::from(&1))
.unwrap_or(1), .value()
looping: service_item .unwrap_or(1);
.get(&QString::from("loop")) slide.looping = service_item
.unwrap_or(QVariant::from(&false)) .get(&QString::from("loop"))
.value() .unwrap_or(QVariant::from(&false))
.unwrap_or(false), .value()
active: service_item .unwrap_or(false);
.get(&QString::from("active")) slide.active = service_item
.unwrap_or(QVariant::from(&false)) .get(&QString::from("active"))
.value() .unwrap_or(QVariant::from(&false))
.unwrap_or(false), .value()
selected: service_item .unwrap_or(false);
.get(&QString::from("selected")) slide.selected = service_item
.unwrap_or(QVariant::from(&false)) .get(&QString::from("selected"))
.value() .unwrap_or(QVariant::from(&false))
.unwrap_or(false), .value()
video_thumbnail: QString::from(""), .unwrap_or(false);
}; slide.video_thumbnail = QString::from("");
// We need to move all the current slides service_item_id's up by one. // We need to move all the current slides service_item_id's up by one.
let slides_len = self.as_mut().slides_mut().len() as i32; let slides_len = self.as_mut().slides_mut().len() as i32;
@ -427,80 +435,80 @@ mod slide_model {
let text_vec = Vec::<QString>::from(&QList_QString::from(&textlist)); let text_vec = Vec::<QString>::from(&QList_QString::from(&textlist));
// let vec_slize: &[usize] = &text_vec; // let vec_slize: &[usize] = &text_vec;
let mut slide = Slidey { let mut slide = Slidey::default();
ty: service_item
.get(&QString::from("type")) slide.ty = service_item
.unwrap_or(QVariant::from(&QString::from(""))) .get(&QString::from("type"))
.value() .unwrap_or(QVariant::from(&QString::from("")))
.unwrap_or(QString::from("")), .value()
text: service_item .unwrap_or(QString::from(""));
.get(&QString::from("text")) slide.text = service_item
.unwrap_or(QVariant::from(&QString::from(""))) .get(&QString::from("text"))
.value() .unwrap_or(QVariant::from(&QString::from("")))
.unwrap_or(QString::from("")), .value()
image_background: service_item .unwrap_or(QString::from(""));
.get(&QString::from("imageBackground")) slide.image_background = service_item
.unwrap_or(QVariant::from(&QString::from(""))) .get(&QString::from("imageBackground"))
.value() .unwrap_or(QVariant::from(&QString::from("")))
.unwrap_or(QString::from("")), .value()
video_background: service_item .unwrap_or(QString::from(""));
.get(&QString::from("videoBackground")) slide.video_background = service_item
.unwrap_or(QVariant::from(&QString::from(""))) .get(&QString::from("videoBackground"))
.value() .unwrap_or(QVariant::from(&QString::from("")))
.unwrap_or(QString::from("")), .value()
audio: service_item .unwrap_or(QString::from(""));
.get(&QString::from("audio")) slide.audio = service_item
.unwrap_or(QVariant::from(&QString::from(""))) .get(&QString::from("audio"))
.value() .unwrap_or(QVariant::from(&QString::from("")))
.unwrap_or(QString::from("")), .value()
font: service_item .unwrap_or(QString::from(""));
.get(&QString::from("font")) slide.font = service_item
.unwrap_or(QVariant::from(&QString::from(""))) .get(&QString::from("font"))
.value() .unwrap_or(QVariant::from(&QString::from("")))
.unwrap_or(QString::from("")), .value()
font_size: service_item .unwrap_or(QString::from(""));
.get(&QString::from("fontSize")) slide.font_size = service_item
.unwrap_or(QVariant::from(&50)) .get(&QString::from("fontSize"))
.value() .unwrap_or(QVariant::from(&50))
.unwrap_or(50), .value()
htext_alignment: service_item .unwrap_or(50);
.get(&QString::from("vtextAlignment")) slide.htext_alignment = service_item
.unwrap_or(QVariant::from(&QString::from("center"))) .get(&QString::from("vtextAlignment"))
.value() .unwrap_or(QVariant::from(&QString::from("center")))
.unwrap_or(QString::from("center")), .value()
vtext_alignment: service_item .unwrap_or(QString::from("center"));
.get(&QString::from("vtextAlignment")) slide.vtext_alignment = service_item
.unwrap_or(QVariant::from(&QString::from("center"))) .get(&QString::from("vtextAlignment"))
.value() .unwrap_or(QVariant::from(&QString::from("center")))
.unwrap_or(QString::from("center")), .value()
service_item_id: index, .unwrap_or(QString::from("center"));
slide_index: service_item slide.service_item_id = index;
.get(&QString::from("slideNumber")) slide.slide_index = service_item
.unwrap_or(QVariant::from(&0)) .get(&QString::from("slideNumber"))
.value() .unwrap_or(QVariant::from(&0))
.unwrap_or(0), .value()
slide_count: service_item .unwrap_or(0);
.get(&QString::from("imageCount")) slide.slide_count = service_item
.unwrap_or(QVariant::from(&1)) .get(&QString::from("imageCount"))
.value() .unwrap_or(QVariant::from(&1))
.unwrap_or(1), .value()
looping: service_item .unwrap_or(1);
.get(&QString::from("loop")) slide.looping = service_item
.unwrap_or(QVariant::from(&false)) .get(&QString::from("loop"))
.value() .unwrap_or(QVariant::from(&false))
.unwrap_or(false), .value()
active: service_item .unwrap_or(false);
.get(&QString::from("active")) slide.active = service_item
.unwrap_or(QVariant::from(&false)) .get(&QString::from("active"))
.value() .unwrap_or(QVariant::from(&false))
.unwrap_or(false), .value()
selected: service_item .unwrap_or(false);
.get(&QString::from("selected")) slide.selected = service_item
.unwrap_or(QVariant::from(&false)) .get(&QString::from("selected"))
.value() .unwrap_or(QVariant::from(&false))
.unwrap_or(false), .value()
video_thumbnail: QString::from(""), .unwrap_or(false);
}; slide.video_thumbnail = QString::from("");
match ty { match ty {
Some(ty) if ty == QString::from("image") => { Some(ty) if ty == QString::from("image") => {
@ -785,6 +793,8 @@ mod slide_model {
Role::SelectedRole => 13, Role::SelectedRole => 13,
Role::LoopingRole => 14, Role::LoopingRole => 14,
Role::VideoThumbnailRole => 15, Role::VideoThumbnailRole => 15,
Role::VideoStartTimeRole => 16,
Role::VideoEndTimeRole => 17,
_ => 0, _ => 0,
} }
} }
@ -880,6 +890,8 @@ mod slide_model {
roles.insert(13, cxx_qt_lib::QByteArray::from("selected")); roles.insert(13, cxx_qt_lib::QByteArray::from("selected"));
roles.insert(14, cxx_qt_lib::QByteArray::from("looping")); roles.insert(14, cxx_qt_lib::QByteArray::from("looping"));
roles.insert(15, cxx_qt_lib::QByteArray::from("videoThumbnail")); roles.insert(15, cxx_qt_lib::QByteArray::from("videoThumbnail"));
roles.insert(16, cxx_qt_lib::QByteArray::from("videoStartTime"));
roles.insert(17, cxx_qt_lib::QByteArray::from("videoEndTime"));
roles roles
} }

View file

@ -53,6 +53,10 @@ mod slide_obj {
font: QString, font: QString,
#[qproperty] #[qproperty]
font_size: i32, font_size: i32,
#[qproperty]
video_start_time: f32,
#[qproperty]
video_end_time: f32,
} }
impl Default for SlideObj { impl Default for SlideObj {
@ -72,6 +76,8 @@ mod slide_obj {
font: QString::from(""), font: QString::from(""),
font_size: 50, font_size: 50,
image_count: 0, image_count: 0,
video_start_time: 0.0,
video_end_time: 0.0,
} }
} }
} }