basic implementation of having reveal.js slides working
There is still a lot of work needed to be done here, but the basics are laid out.
This commit is contained in:
parent
b05af23ffa
commit
c33b5af588
8 changed files with 88 additions and 24 deletions
|
@ -4,6 +4,7 @@ import QtQuick.Layouts 1.15
|
|||
import Qt.labs.platform 1.1 as Labs
|
||||
import QtQuick.Pdf 5.15
|
||||
import QtQml.Models 2.15
|
||||
import QtWebEngine 1.10
|
||||
import org.kde.kirigami 2.13 as Kirigami
|
||||
import "./" as Presenter
|
||||
import org.presenter 1.0
|
||||
|
@ -17,6 +18,8 @@ Item {
|
|||
property var imgexts: ["jpg", "png", "gif", "jpeg", "JPG", "PNG", "webp", "gif"]
|
||||
property var presexts: ["pdf", "PDF", "odp", "pptx", "html"]
|
||||
|
||||
property bool htmlLoaded: false
|
||||
|
||||
Kirigami.Theme.colorSet: Kirigami.Theme.View
|
||||
|
||||
Rectangle {
|
||||
|
@ -316,13 +319,11 @@ Item {
|
|||
function addPres(url) {
|
||||
console.log(pdf.status);
|
||||
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;
|
||||
}
|
||||
pdf.source = url;
|
||||
while (pdf.status != 2) {
|
||||
console.log(pdf.status);
|
||||
console.log("PAGECOUNT: " + pdf.pageCount);
|
||||
pageCount = pdf.pageCount;
|
||||
}
|
||||
presProxyModel.presentationModel.newItem(url, pageCount);
|
||||
selectedLibrary = "presentation";
|
||||
|
@ -360,7 +361,10 @@ Item {
|
|||
}
|
||||
if (presexts.includes(extension))
|
||||
{
|
||||
addPres(file);
|
||||
if (file.endsWith(".html")) {
|
||||
web.url = file;
|
||||
} else
|
||||
addPres(file);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -400,5 +404,38 @@ Item {
|
|||
PdfDocument {
|
||||
id: pdf
|
||||
}
|
||||
|
||||
WebEngineView {
|
||||
id: web
|
||||
height: 0
|
||||
width: 0
|
||||
onLoadingChanged: {
|
||||
if (loadRequest.status == 2)
|
||||
addHtml(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function addHtml(url) {
|
||||
console.log("adding an html");
|
||||
var pageCount = 1;
|
||||
web.runJavaScript("Reveal.getSlides()", function(result) {
|
||||
let str = '';
|
||||
for (const [p, val] of Object.entries(result[0])) {
|
||||
str += `${p}::${val}\n`;
|
||||
}
|
||||
console.log(str);
|
||||
pageCount = result.length;
|
||||
console.log(pageCount);
|
||||
presProxyModel.presentationModel.newItem(url, pageCount);
|
||||
selectedLibrary = "presentation";
|
||||
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;
|
||||
editSwitch("presentation", presentation);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -192,7 +192,7 @@ Controls.Page {
|
|||
slideHelper.chngSlide(item, index, SlideObject);
|
||||
/* SlideMod.activate(index); */
|
||||
presentation.textIndex = 0;
|
||||
console.log("Slide changed to: " + index);
|
||||
console.log("Slide changed to: ", item.imageBackground);
|
||||
activeServiceItem = ServiceItemModel.getItem(currentServiceItem).name;
|
||||
}
|
||||
|
||||
|
|
|
@ -120,8 +120,9 @@ FocusScope {
|
|||
implicitHeight: width / 16 * 9
|
||||
anchors.centerIn: parent
|
||||
itemType: SlideObject.ty
|
||||
imageSource: SlideObject.imageBackground
|
||||
imageSource: SlideObject.imageBackground.endsWith(".html") ? "" : SlideObject.imageBackground
|
||||
webSource: SlideObject.imageBackground.endsWith(".html") ? SlideObject.imageBackground : ""
|
||||
htmlVisible: SlideObject.imageBackground.endsWith(".html")
|
||||
videoSource: SlideObject.videoBackground
|
||||
audioSource: SlideObject.audio
|
||||
chosenFont: SlideObject.font
|
||||
|
|
|
@ -140,7 +140,7 @@ Item {
|
|||
icon.name: "back"
|
||||
onClicked: {
|
||||
if (isHtml) {
|
||||
webPresentationPreview.runJavaScript("Reveal.navigatePrev()");
|
||||
webPresentationPreview.runJavaScript("Reveal.prev()");
|
||||
} else
|
||||
presentationPreview.currentFrame = presentationPreview.currentFrame - 1
|
||||
}
|
||||
|
@ -154,9 +154,9 @@ Item {
|
|||
icon.name: "next"
|
||||
onClicked: {
|
||||
if (isHtml) {
|
||||
webPresentationPreview.runJavaScript("Reveal.navigateNext()");
|
||||
webPresentationPreview.runJavaScript("Reveal.next()");
|
||||
} else
|
||||
presentationPreview.currentFrame = presentationPreview.currentFrame + 1
|
||||
presentationPreview.currentFrame = presentationPreview.currentFrame + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15 as Controls
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtWebEngine 1.10
|
||||
import org.kde.kirigami 2.13 as Kirigami
|
||||
import "./" as Presenter
|
||||
import org.presenter 1.0
|
||||
|
@ -36,12 +37,27 @@ Item {
|
|||
implicitHeight: parent.height - Kirigami.Units.smallSpacing * 2
|
||||
textSize: model.fontSize
|
||||
itemType: model.type
|
||||
imageSource: model.videoBackground != "" ? model.videoThumbnail : model.imageBackground
|
||||
imageSource: {
|
||||
if (model.videoBackground != "") {
|
||||
return model.videoThumbnail;
|
||||
} else if (model.imageBackground.endsWith(".html")) {
|
||||
return "";
|
||||
} else
|
||||
return model.imageBackground;
|
||||
}
|
||||
chosenFont: model.font
|
||||
text: model.text
|
||||
pdfIndex: model.slideIndex
|
||||
|
||||
}
|
||||
WebEngineView {
|
||||
id: web
|
||||
anchors.centerIn: parent
|
||||
implicitWidth: height / 9 * 16
|
||||
implicitHeight: parent.height - Kirigami.Units.smallSpacing * 2
|
||||
url: model.imageBackground.endsWith(".html") ? model.imageBackground : ""
|
||||
visible: model.imageBackground.endsWith(".html")
|
||||
}
|
||||
}
|
||||
|
||||
Controls.Label {
|
||||
|
|
|
@ -20,6 +20,7 @@ Item {
|
|||
property bool dropShadow: false
|
||||
property url imageSource
|
||||
property url webSource
|
||||
property bool htmlVisible: false
|
||||
property url videoSource
|
||||
property url audioSource
|
||||
property bool vidLoop
|
||||
|
@ -128,7 +129,7 @@ Item {
|
|||
source: imageSource
|
||||
fillMode: itemType == "song" ? Image.PreserveAspectCrop : Image.PreserveAspectFit
|
||||
clip: true
|
||||
visible: true
|
||||
visible: webSource.length == 0
|
||||
currentFrame: pdfIndex
|
||||
}
|
||||
|
||||
|
@ -172,7 +173,11 @@ Item {
|
|||
id: web
|
||||
anchors.fill: parent
|
||||
url: webSource
|
||||
visible: false
|
||||
visible: htmlVisible
|
||||
onLoadingChanged: {
|
||||
if (loadRequest.status == 2)
|
||||
showPassiveNotification("YAHOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO!!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue