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
12
flake.lock
generated
12
flake.lock
generated
|
@ -38,11 +38,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1682566018,
|
||||
"narHash": "sha256-HPzPRFiy2o/7k7mtnwfM1E6NVZHiFbPdmYCMoIpkHO4=",
|
||||
"lastModified": 1682779028,
|
||||
"narHash": "sha256-tFfSbwSLobpHRznAa35KEU3R+fsFWTlmpFhTUdXq8RE=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "8e3b64db39f2aaa14b35ee5376bd6a2e707cadc2",
|
||||
"rev": "54abe781c482f51ff4ff534ebaba77db5bd97442",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -52,11 +52,11 @@
|
|||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1682526928,
|
||||
"narHash": "sha256-2cKh4O6t1rQ8Ok+v16URynmb0rV7oZPEbXkU0owNLQs=",
|
||||
"lastModified": 1682692304,
|
||||
"narHash": "sha256-9/lyXN2BpHw+1xE+D2ySBSLMCHWqiWu5tPHBMRDib8M=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d6b863fd9b7bb962e6f9fdf292419a775e772891",
|
||||
"rev": "937a9d1ee7b1351d8c55fff6611a8edf6e7c1c37",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -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,14 +319,12 @@ 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;
|
||||
}
|
||||
}
|
||||
presProxyModel.presentationModel.newItem(url, pageCount);
|
||||
selectedLibrary = "presentation";
|
||||
presentationLibrary.libraryList.currentIndex = presProxyModel.presentationModel.count();
|
||||
|
@ -360,6 +361,9 @@ Item {
|
|||
}
|
||||
if (presexts.includes(extension))
|
||||
{
|
||||
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,7 +154,7 @@ Item {
|
|||
icon.name: "next"
|
||||
onClicked: {
|
||||
if (isHtml) {
|
||||
webPresentationPreview.runJavaScript("Reveal.navigateNext()");
|
||||
webPresentationPreview.runJavaScript("Reveal.next()");
|
||||
} else
|
||||
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!!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ mod presentation_model {
|
|||
PathRole,
|
||||
TitleRole,
|
||||
HtmlRole,
|
||||
PageCountRole,
|
||||
}
|
||||
|
||||
// use crate::entities::{presentations, prelude::Presentations};
|
||||
|
@ -100,9 +101,9 @@ mod presentation_model {
|
|||
let pres = self::Presentation {
|
||||
id: presentation.id,
|
||||
title: QString::from(&presentation.title),
|
||||
html: false,
|
||||
html: presentation.path.ends_with(".html"),
|
||||
path: QString::from(&presentation.path),
|
||||
page_count: 1,
|
||||
page_count: presentation.page_count.unwrap(),
|
||||
};
|
||||
|
||||
self.as_mut().add_presentation(pres);
|
||||
|
@ -201,6 +202,7 @@ mod presentation_model {
|
|||
title.eq(&presentation_title.to_string()),
|
||||
path.eq(&presentation_path.to_string()),
|
||||
html.eq(&presentation_html),
|
||||
page_count.eq(&presentation.page_count),
|
||||
))
|
||||
.execute(db);
|
||||
println!("{:?}", result);
|
||||
|
@ -256,6 +258,7 @@ mod presentation_model {
|
|||
Role::TitleRole => 1,
|
||||
Role::PathRole => 2,
|
||||
Role::HtmlRole => 3,
|
||||
Role::PageCountRole => 4,
|
||||
_ => 0,
|
||||
}
|
||||
}
|
||||
|
@ -307,6 +310,7 @@ mod presentation_model {
|
|||
1 => QVariant::from(&presentation.title),
|
||||
2 => QVariant::from(&presentation.path),
|
||||
3 => QVariant::from(&presentation.html),
|
||||
4 => QVariant::from(&presentation.page_count),
|
||||
_ => QVariant::default(),
|
||||
};
|
||||
}
|
||||
|
@ -327,6 +331,7 @@ mod presentation_model {
|
|||
roles.insert(1, cxx_qt_lib::QByteArray::from("title"));
|
||||
roles.insert(2, cxx_qt_lib::QByteArray::from("filePath"));
|
||||
roles.insert(3, cxx_qt_lib::QByteArray::from("html"));
|
||||
roles.insert(4, cxx_qt_lib::QByteArray::from("pageCount"));
|
||||
roles
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue