Warning, /maui/shelf/src/views/Viewer/Viewer_CB.qml is written in an unsupported language. File is not indexed.
0001 import QtQuick 2.13
0002 import QtQuick.Controls 2.13
0003 import QtQuick.Window 2.12
0004
0005 import org.mauikit.controls 1.3 as Maui
0006 import org.mauikit.filebrowsing 1.3 as FB
0007
0008 import org.mauikit.documents 1.0 as Peruse
0009
0010 Maui.Page
0011 {
0012 id: control
0013 property string path
0014
0015 title: _model.title
0016 property int imageWidth : control.width
0017 property int imageHeight : control.height
0018
0019 property bool twoPagesMode : true
0020 property alias orientation : _listView.orientation
0021
0022 headBar.visible: false
0023
0024 footBar.leftContent: ToolButton
0025 {
0026 icon.name: "view-dual-symbolic"
0027 checked: control.twoPagesMode
0028 onClicked: control.twoPagesMode = !control.twoPagesMode
0029 }
0030
0031 ListView
0032 {
0033 id: _listView
0034 anchors.fill: parent
0035 orientation: ListView.Horizontal
0036 snapMode: control.twoPagesMode ? ListView.SnapPosition : ListView.SnapOneItem
0037 cacheBuffer: 3000
0038
0039 onMovementEnded:
0040 {
0041 var indexHere = indexAt(contentX + width / 2, contentY + height / 2);
0042 if(currentIndex !== indexHere) {
0043 currentIndex = indexHere;
0044 }
0045 }
0046
0047 model: Peruse.ArchiveBookModel
0048 {
0049 id: _model
0050 qmlEngine: globalQmlEngine
0051 onLoadingCompleted: {
0052 // root.loadingCompleted(success);
0053 // if (success) {
0054 // initialPageChange.start();
0055 // for (var i = 0 ; i < root.languageCount; ++i) {
0056 // var language = imageBrowser.model.acbfData.metaData.bookInfo.languages[i];
0057 // var action = translationActionEntry.createObject(translationsAction, {language: language});
0058 // translationsAction.children.push(action);
0059 // }
0060 // }
0061 }
0062 }
0063
0064 delegate: Maui.ImageViewer
0065 {
0066 source: model.url
0067 height: ListView.view.height
0068 width: Math.floor(ListView.view.width / (control.twoPagesMode ? 2 : 1))
0069 fillMode: Image.PreserveAspectFit
0070 asynchronous: true
0071
0072 // property bool shouldCheat: imageWidth * 2 > maxTextureSize || imageHeight * 2 > maxTextureSize;
0073 // property bool isTall: imageHeight < imageWidth;
0074 // property int fixedWidth: isTall ? maxTextureSize * (imageWidth / imageHeight) : maxTextureSize;
0075 // property int fixedHeight: isTall ? maxTextureSize : maxTextureSize * (imageHeight / imageWidth);
0076 // sourceSize.width: shouldCheat ? fixedWidth : imageWidth * 2;
0077 // sourceSize.height: shouldCheat ? fixedHeight : imageHeight * 2;
0078 }
0079 }
0080
0081 Component.onCompleted: _model.filename = control.path.replace("file://", "")
0082
0083 }