Adding reveal next and previous buttons

In order to make this work, I had to determine in rust which were html
and essentially not call the change_slide function and instead call
the reveal_next/previous functions and then tweak it from there.
This commit is contained in:
Chris Cochrun 2024-01-17 11:26:04 -06:00
parent b589cb2490
commit da258433d9
5 changed files with 35 additions and 17 deletions

View file

@ -120,9 +120,9 @@ FocusScope {
implicitHeight: width / 16 * 9
anchors.centerIn: parent
itemType: SlideObject.ty
imageSource: SlideObject.imageBackground.endsWith(".html") ? "" : SlideObject.imageBackground
webSource: SlideObject.imageBackground.endsWith(".html") ? SlideObject.imageBackground : ""
htmlVisible: SlideObject.imageBackground.endsWith(".html")
imageSource: SlideObject.html ? "" : SlideObject.imageBackground
webSource: SlideObject.html ? SlideObject.imageBackground : ""
htmlVisible: SlideObject.html
videoSource: SlideObject.videoBackground
audioSource: SlideObject.audio
chosenFont: SlideObject.font
@ -467,9 +467,8 @@ FocusScope {
keyHandler.forceActiveFocus();
const nextSlideIdx = currentSlide + 1;
const nextSlide = SlideModel.getItem(nextSlideIdx);
/* if (!SlideObject.imageBackground.endsWith(".html") && */
/* (nextSlideIdx > totalSlides || nextSlideIdx < 0)) */
/* return; */
if (nextSlideIdx > totalSlides || nextSlideIdx < 0)
return;
console.log("currentServiceItem " + currentServiceItem);
console.log("totalSlides " + totalSlides);
console.log("currentSlide " + currentSlide);
@ -491,12 +490,18 @@ FocusScope {
function previousSlideAction() {
keyHandler.forceActiveFocus();
const prevSlideIdx = currentSlide - 1;
const prevSlide = SlideModel.getItem(prevSlideIdx);
if (prevSlideIdx > totalSlides || prevSlideIdx < 0)
return;
console.log("currentServiceItem " + currentServiceItem);
console.log("totalSlides " + totalSlides);
console.log("currentSlide " + currentSlide);
console.log("prevSlideIdx " + prevSlideIdx);
changeSlide(prevSlideIdx);
/* changeSlide(prevSlideIdx); */
if (SlideObject.previous(prevSlide)) {
currentSlide = prevSlideIdx;
currentServiceItem = prevSlide.serviceItemId;
}
}
function previousSlide() {

View file

@ -49,9 +49,9 @@ Item {
Presenter.Slide {
id: presentationSlide
anchors.fill: parent
imageSource: SlideObj.imageBackground.endsWith(".html") ? "" : SlideObj.imageBackground
webSource: SlideObj.imageBackground.endsWith(".html") ? SlideObj.imageBackground : ""
htmlVisible: SlideObj.imageBackground.endsWith(".html")
imageSource: SlideObj.html ? "" : SlideObj.imageBackground
webSource: SlideObj.html ? SlideObj.imageBackground : ""
htmlVisible: SlideObj.html
videoSource: presentationWindow.visible ? SlideObj.videoBackground : ""
audioSource: SlideObj.audio
text: SlideObj.text

View file

@ -191,11 +191,14 @@ Item {
anchors.fill: parent
url: webSource
visible: htmlVisible
enabled: htmlVisible
zoomFactor: preview ? 0.25 : 1.0
onLoadingChanged: {
if (loadRequest.status == 2)
showPassiveNotification("yahoo?");
}
settings.playbackRequiresUserGesture: false
audioMuted: root.preview
/* function moveToSlideIndex(index) { */
/* web.runJavaScript(" */

View file

@ -592,9 +592,8 @@ impl slide_model::SlideModel {
slide.html = true;
slide.image_background = background.clone();
slide.video_background = QString::from("");
slide.slide_index = i;
self.as_mut()
.insert_slide(&slide, slide_index + i);
slide.slide_index = 0;
self.as_mut().insert_slide(&slide, slide_index);
} else {
for i in 0..slide.slide_count {
slide.ty = ty.clone();
@ -787,7 +786,7 @@ impl slide_model::SlideModel {
slide.html = true;
slide.image_background = background.clone();
slide.video_background = QString::from("");
slide.slide_index = i;
slide.slide_index = 0;
self.as_mut().add_slide(&slide);
} else {
for i in 0..slide.slide_count {

View file

@ -49,7 +49,7 @@ mod slide_object {
#[qproperty(QString, audio)]
#[qproperty(QString, image_background)]
#[qproperty(QString, video_background)]
#[qproperty(QString, html)]
#[qproperty(bool, html)]
#[qproperty(QString, vtext_alignment)]
#[qproperty(QString, htext_alignment)]
#[qproperty(QString, font)]
@ -104,7 +104,7 @@ pub struct SlideObjectRust {
audio: QString,
image_background: QString,
video_background: QString,
html: QString,
html: bool,
vtext_alignment: QString,
htext_alignment: QString,
font: QString,
@ -125,7 +125,7 @@ impl Default for SlideObjectRust {
ty: QString::from(""),
audio: QString::from(""),
image_background: QString::from(""),
html: QString::from(""),
html: false,
video_background: QString::from(""),
vtext_alignment: QString::from(""),
htext_alignment: QString::from(""),
@ -315,6 +315,13 @@ impl slide_object::SlideObject {
self.as_mut().set_video_start_time(int)
}
let html =
image_background.value_or_default::<QString>().ends_with(
&QString::from(".html"),
CaseSensitivity::CaseInsensitive,
);
self.as_mut().set_html(html);
self.as_mut().set_image_count(count);
self.as_mut().set_slide_index(slide_index);
@ -361,6 +368,8 @@ impl slide_object::SlideObject {
return false;
}
}
// reset to empty before change to ensure that the web source gets unloaded
self.as_mut().set_image_background(QString::from(""));
self.as_mut().change_slide(next_item, service_item);
debug!(service_item, "returning true");
true
@ -389,6 +398,8 @@ impl slide_object::SlideObject {
return false;
}
}
// reset to empty before change to ensure that the web source gets unloaded
self.as_mut().set_image_background(QString::from(""));
self.as_mut().change_slide(prev_item, new_id);
true
}