fixing html slides not working through nextSlideAction()

This commit is contained in:
Chris Cochrun 2024-03-29 07:30:07 -05:00
parent 428386a25b
commit 15c657b81e
3 changed files with 32 additions and 11 deletions

View file

@ -150,6 +150,7 @@ FocusScope {
} }
RowLayout { RowLayout {
id: videoControls
spacing: 2 spacing: 2
width: previewSlide.width width: previewSlide.width
/* Layout.alignment: Qt.AlignHCenter, Qt.AlignTop */ /* Layout.alignment: Qt.AlignHCenter, Qt.AlignTop */
@ -188,6 +189,23 @@ FocusScope {
} }
} }
RowLayout {
id: htmlControls
spacing: 2
width: previewSlide.width
/* Layout.alignment: Qt.AlignHCenter, Qt.AlignTop */
anchors.top: previewSlide.bottom
anchors.topMargin: 10
anchors.horizontalCenter: previewSlide.horizontalCenter
/* Layout.columnSpan: 3 */
visible: SlideObject.imageBackground.startsWith("html");
Controls.Label {
Layout.fillWidth: true
Layout.preferredHeight: 25
text: SlideObject.innerSlideIndex + "/" + SlideObject.slideSize
}
}
} }
Presenter.SlidesListView { Presenter.SlidesListView {

View file

@ -41,7 +41,7 @@ mod slide_object {
#[qml_element] #[qml_element]
#[qproperty(i32, slide_index)] #[qproperty(i32, slide_index)]
#[qproperty(i32, slide_size)] #[qproperty(i32, slide_size)]
#[qproperty(i32, image_count)] #[qproperty(i32, inner_slide_index)]
#[qproperty(bool, is_playing)] #[qproperty(bool, is_playing)]
#[qproperty(bool, looping)] #[qproperty(bool, looping)]
#[qproperty(QString, text)] #[qproperty(QString, text)]
@ -96,7 +96,7 @@ use self::slide_object::QMap_QString_QVariant;
pub struct SlideObjectRust { pub struct SlideObjectRust {
slide_index: i32, slide_index: i32,
slide_size: i32, slide_size: i32,
image_count: i32, inner_slide_index: i32,
is_playing: bool, is_playing: bool,
looping: bool, looping: bool,
text: QString, text: QString,
@ -131,7 +131,7 @@ impl Default for SlideObjectRust {
htext_alignment: QString::from(""), htext_alignment: QString::from(""),
font: QString::from(""), font: QString::from(""),
font_size: 50, font_size: 50,
image_count: 0, inner_slide_index: 0,
video_start_time: 0.0, video_start_time: 0.0,
video_end_time: 0.0, video_end_time: 0.0,
// slide_model: std::ptr::null_mut(), // slide_model: std::ptr::null_mut(),
@ -300,7 +300,7 @@ impl slide_object::SlideObject {
println!("looping: empty") println!("looping: empty")
} }
let slide_size = item let slide_size = item
.get(&QString::from("slide_size")) .get(&QString::from("imageCount"))
.unwrap_or(QVariant::from(&1)); .unwrap_or(QVariant::from(&1));
if let Some(slide_size) = slide_size.value::<i32>() { if let Some(slide_size) = slide_size.value::<i32>() {
if &slide_size != self.as_ref().slide_size() { if &slide_size != self.as_ref().slide_size() {
@ -322,7 +322,7 @@ impl slide_object::SlideObject {
); );
self.as_mut().set_html(html); self.as_mut().set_html(html);
self.as_mut().set_image_count(count); self.as_mut().set_inner_slide_index(0);
self.as_mut().set_slide_index(slide_index); self.as_mut().set_slide_index(slide_index);
@ -356,15 +356,16 @@ impl slide_object::SlideObject {
if html { if html {
// Check to see if current slide is at the end // Check to see if current slide is at the end
// if not, advance to the next one. // if not, advance to the next one.
let new_inner = self.as_ref().inner_slide_index + 1;
debug!( debug!(
currentIndex = self.as_ref().slide_index, currentIndex = self.as_ref().slide_index,
newIndex = new_id, newIndex = new_id,
slide_count = self.as_ref().image_count inner_slide_index = new_inner,
slide_size = self.as_ref().slide_size
); );
if self.as_ref().slide_index if self.as_ref().slide_size > new_inner {
< self.as_ref().image_count - 1
{
// self.as_mut().set_slide_index(new_id); // self.as_mut().set_slide_index(new_id);
self.as_mut().set_inner_slide_index(new_inner);
self.as_mut().reveal_next(); self.as_mut().reveal_next();
debug!("returning false"); debug!("returning false");
return false; return false;
@ -395,8 +396,9 @@ impl slide_object::SlideObject {
if html { if html {
// Check to see if current slide is at the beginning // Check to see if current slide is at the beginning
// if not, go back to the previous one. // if not, go back to the previous one.
if self.as_ref().slide_index > 0 { let new_inner = self.as_ref().inner_slide_index - 1;
self.as_mut().set_slide_index(new_id); if self.as_ref().inner_slide_index > 0 {
self.as_mut().set_inner_slide_index(new_inner);
self.as_mut().reveal_prev(); self.as_mut().reveal_prev();
return false; return false;
} }

View file

@ -602,6 +602,7 @@ impl song_model::SongModel {
{ {
debug!(?song, audio = updated_audio.to_string()); debug!(?song, audio = updated_audio.to_string());
song.audio = updated_audio.to_string(); song.audio = updated_audio.to_string();
debug!(?song);
self.as_mut().data_changed( self.as_mut().data_changed(
&model_index, &model_index,
&model_index, &model_index,