feat: reveal.js presentations are viewable in editor

I have gotten reveal.js presentations to be viewable. I'll still need
to work with how to present them, and fix the presenter piece as well,
but for now, it works.
This commit is contained in:
Chris Cochrun 2023-04-29 07:13:04 -05:00
parent dd1ea7454e
commit b05af23ffa
5 changed files with 47 additions and 15 deletions

View file

@ -315,16 +315,20 @@ Item {
function addPres(url) {
console.log(pdf.status);
pdf.source = url;
while (pdf.status != 2) {
console.log(pdf.status);
console.log("PAGECOUNT: " + pdf.pageCount);
let pageCount = 1;
if (url.endsWith(".pdf")) {
pdf.source = url;
while (pdf.status != 2) {
console.log(pdf.status);
console.log("PAGECOUNT: " + pdf.pageCount);
pageCount = pdf.pageCount;
}
}
presProxyModel.presentationModel.newPresentation(url, pdf.pageCount);
presProxyModel.presentationModel.newItem(url, pageCount);
selectedLibrary = "presentation";
presentationLibraryList.currentIndex = presProxyModel.presentationModel.rowCount();
console.log(presProxyModel.presentationModel.getPresentation(presentationLibraryList.currentIndex));
const presentation = presProxyModel.presentationModel.getImage(presentationLibraryList.currentIndex);
presentationLibrary.libraryList.currentIndex = presProxyModel.presentationModel.count();
console.log(presProxyModel.getPresentation(presentationLibrary.libraryList.currentIndex));
const presentation = presProxyModel.getPresentation(presentationLibrary.libraryList.currentIndex);
showPassiveNotification("newest image: " + presentation.title);
if (!editMode)
editMode = true;

View file

@ -121,7 +121,7 @@ FocusScope {
anchors.centerIn: parent
itemType: SlideObject.ty
imageSource: SlideObject.imageBackground
webSource: SlideObject.html
webSource: SlideObject.imageBackground.endsWith(".html") ? SlideObject.imageBackground : ""
videoSource: SlideObject.videoBackground
audioSource: SlideObject.audio
chosenFont: SlideObject.font

View file

@ -2,6 +2,7 @@ import QtQuick 2.15
import QtQuick.Controls 2.15 as Controls
import QtQuick.Dialogs 1.3
import QtQuick.Layouts 1.15
import QtWebEngine 1.10
import org.kde.kirigami 2.13 as Kirigami
import "./" as Presenter
@ -10,6 +11,7 @@ Item {
property string type: "presentation"
property var presentation
property bool isHtml: presentation.filePath.endsWith(".html")
GridLayout {
id: mainLayout
@ -112,11 +114,20 @@ Item {
Layout.preferredHeight: Layout.preferredWidth / 16 * 9
Layout.alignment: Qt.AlignCenter
fillMode: Image.PreserveAspectFit
source: presentation.filePath
source: isHtml ? "" : presentation.filePath
Component.onCompleted: {
updatePageCount(frameCount);
showPassiveNotification(presentation.pageCount);
}
visible: !isHtml
}
WebEngineView {
id: webPresentationPreview
Layout.preferredWidth: root.width - Kirigami.Units.largeSpacing
Layout.preferredHeight: Layout.preferredWidth / 16 * 9
Layout.alignment: Qt.AlignCenter
url: isHtml ? presentation.filePath : ""
visible: isHtml
}
RowLayout {
Layout.fillWidth: true;
@ -127,7 +138,12 @@ Item {
id: leftArrow
text: "Back"
icon.name: "back"
onClicked: presentationPreview.currentFrame = presentationPreview.currentFrame - 1
onClicked: {
if (isHtml) {
webPresentationPreview.runJavaScript("Reveal.navigatePrev()");
} else
presentationPreview.currentFrame = presentationPreview.currentFrame - 1
}
}
Item {
Layout.fillWidth: true
@ -136,7 +152,12 @@ Item {
id: rightArrow
text: "Next"
icon.name: "next"
onClicked: presentationPreview.currentFrame = presentationPreview.currentFrame + 1
onClicked: {
if (isHtml) {
webPresentationPreview.runJavaScript("Reveal.navigateNext()");
} else
presentationPreview.currentFrame = presentationPreview.currentFrame + 1
}
}
}
Item {