From 53bdda17bf0a4299b6fe7a3ce88d009f6f8caac1 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Fri, 13 Jan 2023 11:20:49 -0600 Subject: [PATCH] making the pdf system aware of number of pages without podofo --- src/qml/presenter/Library.qml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/qml/presenter/Library.qml b/src/qml/presenter/Library.qml index 36d65c3..1a81022 100644 --- a/src/qml/presenter/Library.qml +++ b/src/qml/presenter/Library.qml @@ -2,6 +2,7 @@ import QtQuick 2.13 import QtQuick.Controls 2.15 as Controls import QtQuick.Layouts 1.2 import Qt.labs.platform 1.1 as Labs +import QtQuick.Pdf 5.15 import org.kde.kirigami 2.13 as Kirigami import "./" as Presenter import org.presenter 1.0 @@ -1348,7 +1349,13 @@ Item { } function addPres(url) { - pressqlmodel.newPresentation(url); + print(pdf.status); + pdf.source = url; + while (pdf.status != 2) { + print(pdf.status); + print("PAGECOUNT: " + pdf.pageCount); + } + pressqlmodel.newPresentation(url, pdf.pageCount); selectedLibrary = "presentations"; presentationLibraryList.currentIndex = pressqlmodel.rowCount(); print(pressqlmodel.getPresentation(presentationLibraryList.currentIndex)); @@ -1357,6 +1364,7 @@ Item { if (!editMode) editMode = true; editSwitch("presentation", presentation); + pdf.source = ""; } function isDragFile(item) { @@ -1421,6 +1429,10 @@ Item { border.color: overlay ? Kirigami.Theme.hoverColor : "#00000000" } + PdfDocument { + id: pdf + } + MpvObject { id: thumbnailer useHwdec: true