revealJS presentations work sorta

I still have lots of bugs, but the groundwork is there. At least a
proof of concept.
This commit is contained in:
Chris Cochrun 2023-11-14 21:39:30 -06:00
parent 7d79c38c2a
commit e30066b101
6 changed files with 71 additions and 4 deletions

View file

@ -208,10 +208,27 @@ Controls.Page {
function changeSlide(index) { function changeSlide(index) {
console.log("index grabbed: " + index); console.log("index grabbed: " + index);
const item = SlideModel.getItemRust(index, SlideMod); const item = SlideModel.getItemRust(index, SlideMod);
const isMoveDown = currentSlide < index;
currentSlide = index; currentSlide = index;
currentServiceItem = item.serviceItemId; currentServiceItem = item.serviceItemId;
console.log("index grabbed: " + index); console.log("index grabbed: " + index);
console.log(item); console.log("html?: " + item.html);
console.log("type: " + item.type);
console.log("text: " + item.text);
console.log("slide_index: " + item.slideIndex);
console.log("slide_count: " + item.imageCount);
if (item.html) {
let index = item.slideIndex;
let count = item.imageCount;
if (index > 0 && index < count - 1) {
console.log("I should advance revealy");
if (isMoveDown)
presentation.revealNext()
else
presentation.revealPrev()
return
}
}
/* presentation.stopVideo(); */ /* presentation.stopVideo(); */
/* pWindow.stopVideo(); */ /* pWindow.stopVideo(); */

View file

@ -413,4 +413,11 @@ FocusScope {
function playAudio() { function playAudio() {
} }
function revealNext() {
previewSlide.revealNext();
}
function revealPrev() {
previewSlide.revealPrev();
}
} }

View file

@ -30,17 +30,38 @@ Item {
Controls.TextField { Controls.TextField {
id: presentationTitleField id: presentationTitleField
Layout.preferredWidth: 300 implicitWidth: 300
placeholderText: "Title..." placeholderText: "Title..."
text: presentation.title text: presentation.title
padding: 10 padding: 10
onEditingFinished: updateTitle(text); onEditingFinished: updateTitle(text);
background: Presenter.TextBackground {
control: fontBox
}
} }
Controls.ComboBox { Controls.ComboBox {
model: ["PRESENTATIONS", "Center", "Right", "Justify"] model: ["PRESENTATIONS", "Center", "Right", "Justify"]
implicitWidth: 100 implicitWidth: 100
hoverEnabled: true hoverEnabled: true
background: Presenter.TextBackground {
control: fontBox
}
indicator: Kirigami.Icon {
anchors {right: parent.right
verticalCenter: parent.verticalCenter
rightMargin: 2}
source: "arrow-down"
rotation: fontBox.down ? 180 : 0
color: fontBox.pressed ? Kirigami.Theme.focusColor : Kirigami.Theme.textColor
Behavior on rotation {
NumberAnimation {
easing.type: Easing.OutCubic
duration: 300
}
}
}
} }
Controls.ToolSeparator {} Controls.ToolSeparator {}
Item { Layout.fillWidth: true } Item { Layout.fillWidth: true }

View file

@ -107,4 +107,12 @@ Item {
function loopVideo() { function loopVideo() {
presentationSlide.loopVideo(); presentationSlide.loopVideo();
} }
function revealNext() {
presentationSlide.revealNext();
}
function revealPrev() {
presentationSlide.revealPrev();
}
} }

View file

@ -177,6 +177,7 @@ Item {
anchors.fill: parent anchors.fill: parent
url: webSource url: webSource
visible: htmlVisible visible: htmlVisible
zoomFactor: preview ? 0.25 : 1.0
onLoadingChanged: { onLoadingChanged: {
if (loadRequest.status == 2) if (loadRequest.status == 2)
showPassiveNotification("yahoo?"); showPassiveNotification("yahoo?");
@ -247,10 +248,10 @@ Item {
} }
function revealNext() { function revealNext() {
web.runJavascript("Reveal.next()") web.runJavaScript("Reveal.next()")
} }
function revealPrev() { function revealPrev() {
web.runJavascript("Reveal.prev()") web.runJavaScript("Reveal.prev()")
} }
} }

View file

@ -1,5 +1,6 @@
#[cxx_qt::bridge] #[cxx_qt::bridge]
mod slide_model { mod slide_model {
use cxx_qt_lib::CaseSensitivity;
use tracing::{debug, debug_span, error, info, instrument}; use tracing::{debug, debug_span, error, info, instrument};
unsafe extern "C++" { unsafe extern "C++" {
include!(< QAbstractListModel >); include!(< QAbstractListModel >);
@ -48,6 +49,7 @@ mod slide_model {
video_thumbnail: QString, video_thumbnail: QString,
video_start_time: f32, video_start_time: f32,
video_end_time: f32, video_end_time: f32,
html: bool,
} }
impl Default for Slidey { impl Default for Slidey {
@ -71,6 +73,7 @@ mod slide_model {
video_thumbnail: QString::default(), video_thumbnail: QString::default(),
video_start_time: 0.0, video_start_time: 0.0,
video_end_time: 0.0, video_end_time: 0.0,
html: false,
} }
} }
} }
@ -437,6 +440,12 @@ mod slide_model {
Some(ty) if ty == QString::from("presentation") => { Some(ty) if ty == QString::from("presentation") => {
for i in 0..slide.slide_count { for i in 0..slide.slide_count {
slide.ty = ty.clone(); slide.ty = ty.clone();
if background.ends_with(
&QString::from(".html"),
CaseSensitivity::CaseInsensitive,
) {
slide.html = true;
}
slide.image_background = background.clone(); slide.image_background = background.clone();
slide.video_background = QString::from(""); slide.video_background = QString::from("");
slide.slide_index = i; slide.slide_index = i;
@ -978,6 +987,9 @@ mod slide_model {
13 => QVariant::from(&slide.selected), 13 => QVariant::from(&slide.selected),
14 => QVariant::from(&slide.looping), 14 => QVariant::from(&slide.looping),
15 => QVariant::from(&slide.video_thumbnail), 15 => QVariant::from(&slide.video_thumbnail),
16 => QVariant::from(&slide.video_start_time),
17 => QVariant::from(&slide.video_end_time),
18 => QVariant::from(&slide.html),
_ => QVariant::default(), _ => QVariant::default(),
}; };
} }
@ -1043,6 +1055,7 @@ mod slide_model {
17, 17,
cxx_qt_lib::QByteArray::from("videoEndTime"), cxx_qt_lib::QByteArray::from("videoEndTime"),
); );
roles.insert(18, cxx_qt_lib::QByteArray::from("html"));
roles roles
} }