Changeset View
Changeset View
Standalone View
Standalone View
src/app/qml/Book.qml
Show All 22 Lines | |||||
23 | import QtQuick.Layouts 1.1 | 23 | import QtQuick.Layouts 1.1 | ||
24 | import QtQuick.Controls 2.2 as QtControls | 24 | import QtQuick.Controls 2.2 as QtControls | ||
25 | import QtQuick.Window 2.2 | 25 | import QtQuick.Window 2.2 | ||
26 | 26 | | |||
27 | import org.kde.kirigami 2.1 as Kirigami | 27 | import org.kde.kirigami 2.1 as Kirigami | ||
28 | import org.kde.peruse 0.1 as Peruse | 28 | import org.kde.peruse 0.1 as Peruse | ||
29 | 29 | | |||
30 | import "listcomponents" as ListComponents | 30 | import "listcomponents" as ListComponents | ||
31 | 31 | /** | |||
32 | * @brief Page that handles reading the book. | ||||
33 | * | ||||
34 | * | ||||
35 | */ | ||||
32 | Kirigami.Page { | 36 | Kirigami.Page { | ||
33 | id: root; | 37 | id: root; | ||
34 | objectName: "bookViewer"; | 38 | objectName: "bookViewer"; | ||
35 | clip: true; | 39 | clip: true; | ||
36 | 40 | | |||
37 | // Remove all the padding when we've hidden controls. Content is king! | 41 | // Remove all the padding when we've hidden controls. Content is king! | ||
38 | topPadding: applicationWindow().controlsVisible ? (applicationWindow() && applicationWindow().header ? applicationWindow().header.height : 0) : 0; | 42 | topPadding: applicationWindow().controlsVisible ? (applicationWindow() && applicationWindow().header ? applicationWindow().header.height : 0) : 0; | ||
39 | leftPadding: applicationWindow().controlsVisible ? Kirigami.Units.gridUnit : 0; | 43 | leftPadding: applicationWindow().controlsVisible ? Kirigami.Units.gridUnit : 0; | ||
▲ Show 20 Lines • Show All 238 Lines • ▼ Show 20 Line(s) | 281 | Kirigami.Action { | |||
278 | id: bookInfoAction; | 282 | id: bookInfoAction; | ||
279 | text: i18n("Closes the book information drawer", "Close"); | 283 | text: i18n("Closes the book information drawer", "Close"); | ||
280 | shortcut: bookInfo.sheetOpen ? "Esc" : ""; | 284 | shortcut: bookInfo.sheetOpen ? "Esc" : ""; | ||
281 | iconName: "dialog-cancel"; | 285 | iconName: "dialog-cancel"; | ||
282 | onTriggered: bookInfo.close(); | 286 | onTriggered: bookInfo.close(); | ||
283 | enabled: root.isCurrentPage; | 287 | enabled: root.isCurrentPage; | ||
284 | } | 288 | } | ||
285 | 289 | | |||
290 | /** | ||||
291 | * This holds an instance of ViewerBase, which can either be the | ||||
leinir: It holds any instance of ViewerBase, which can be either the Okular viewer (the fallback one)… | |||||
292 | * Okular viewer(the fallback one), or one of the type specific | ||||
293 | * ones(ImageBrowser based). | ||||
294 | */ | ||||
286 | Item { | 295 | Item { | ||
287 | width: root.width - (root.leftPadding + root.rightPadding); | 296 | width: root.width - (root.leftPadding + root.rightPadding); | ||
288 | height: root.height - (root.topPadding + root.bottomPadding); | 297 | height: root.height - (root.topPadding + root.bottomPadding); | ||
289 | Timer { | 298 | Timer { | ||
290 | id: updateCurrent; | 299 | id: updateCurrent; | ||
291 | interval: applicationWindow().animationDuration; | 300 | interval: applicationWindow().animationDuration; | ||
292 | running: false; | 301 | running: false; | ||
293 | repeat: false; | 302 | repeat: false; | ||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Line(s) | 353 | onCurrentPageChanged: { | |||
354 | thumbnailMovementAnimation.to = newPos; | 363 | thumbnailMovementAnimation.to = newPos; | ||
355 | thumbnailMovementAnimation.running = true; | 364 | thumbnailMovementAnimation.running = true; | ||
356 | } | 365 | } | ||
357 | onGoNextPage: root.nextPage(); | 366 | onGoNextPage: root.nextPage(); | ||
358 | onGoPreviousPage: root.previousPage(); | 367 | onGoPreviousPage: root.previousPage(); | ||
359 | } | 368 | } | ||
360 | } | 369 | } | ||
361 | } | 370 | } | ||
362 | 371 | /** | |||
372 | * Overlay with book information and a series selection. | ||||
373 | */ | ||||
363 | Kirigami.OverlaySheet { | 374 | Kirigami.OverlaySheet { | ||
364 | id: bookInfo; | 375 | id: bookInfo; | ||
365 | function setNewCurrentIndex(newIndex) { | 376 | function setNewCurrentIndex(newIndex) { | ||
366 | seriesListAnimation.running = false; | 377 | seriesListAnimation.running = false; | ||
367 | var currentPos = seriesListView.contentX; | 378 | var currentPos = seriesListView.contentX; | ||
368 | var newPos; | 379 | var newPos; | ||
369 | seriesListView.positionViewAtIndex(newIndex, ListView.Center); | 380 | seriesListView.positionViewAtIndex(newIndex, ListView.Center); | ||
370 | newPos = seriesListView.contentX; | 381 | newPos = seriesListView.contentX; | ||
▲ Show 20 Lines • Show All 133 Lines • Show Last 20 Lines |
It holds any instance of ViewerBase, which can be either the Okular viewer (the fallback one), or one of the type specific ones (which right now means the ImageBrowser based ones, but would in the future be joined by a third one, which would do the viewport based navigation)