25
25
title: Utils.getNameOfFile(file.path);
27
// Disable header auto-hide
27
// Disable header auto-hide.
28
// TODO: Show/hide header if a user taps the page
30
property string currentPage: i18n.tr("Page %1 of %2").arg(pdfView.currentIndex + 1).arg(pdfView.count)
31
property string currentPage: i18n.tr("Page %1 of %2").arg(pdfView.currentPageIndex + 1).arg(pdfView.count)
32
// TODO: Restore zooming
35
35
objectName:"pdfView"
39
leftMargin: units.gu(1)
40
rightMargin: units.gu(1)
42
38
spacing: units.gu(2)
46
41
boundsBehavior: Flickable.StopAtBounds
50
highlightFollowsCurrentItem: false
51
keyNavigationWraps: false
53
header: Item { width: parent.width; height: units.gu(2) }
54
footer: Item { width: parent.width; height: units.gu(2) }
59
/* FIXME: Don't set 'path' property directly, but set it through onCompleted signal.
60
By doing otherwise, PDF pages are loaded two times, but only
61
the first delegates are working. Asking to the image provider
62
to get the second ones, makes the app instable.
63
(e.g. We have a PDF document with 10 pages. The plugin loads
64
them twice - 2x10 = 20 pages - but only the first 10 are shown.
65
While trying to get the 11th, the app crashes). */
66
Component.onCompleted: path = file.path
69
activity.running = false;
71
pdfView.currentIndex = 0
73
var title = getDocumentInfo("Title")
79
delegate: PdfViewDelegate {}
82
/* On resizing window, pages size changes but contentY is still the same.
83
For that reason, it shows the wrong page (which is settled at the same contentY).
84
We need to force flickable to show the current page. */
85
//pdfView.positionViewAtIndex(currentIndex, ListView.Contain)
89
// FIXME: On wheeling up, ListView automatically center currentItem to the view.
90
// This causes some strange "jump" of ~200px in contentY
91
var i = pdfView.indexAt(pdfView.width * 0.5, contentY + (pdfView.height * 0.5))
94
// returned index could be -1 when the delegate spacing is shown at the center of the view (e.g. while scrolling pages)
95
i = pdfView.indexAt(pdfView.width * 0.5, contentY + (pdfView.height * 0.5) + units.gu(4))
99
currentPage = i18n.tr("Page %1 of %2").arg(i + 1).arg(pdfView.count)
101
if (!pdfView.flickingVertically) {
102
pdfView.currentIndex = i
110
anchors.centerIn: parent
43
cacheBuffer: height * poppler.providersNumber * _zoomHelper.scale * 0.5
45
flickDeceleration: 1500 * units.gridUnit / 8
46
maximumFlickVelocity: 2500 * units.gridUnit / 8
49
delegate: PdfViewDelegate {
50
onWidthChanged: QQuickView.releaseResources()
51
Component.onDestruction: QQuickView.releaseResources()
54
contentWidth: parent.width * _zoomHelper.scale
65
onPinchStarted: pdfView.interactive = false;
67
// FIXME: On zooming, keep the same content position.
71
pdfView.interactive = true;
72
pdfView.returnToBounds();
76
Item { id: _zoomHelper }
82
property bool isLoading: true
84
Component.onCompleted: path = file.path
88
var title = getDocumentInfo("Title")