Warning, /graphics/kphotoalbum/AndroidRemoteControl/qml/ImageViewer.qml is written in an unsupported language. File is not indexed.

0001 /* SPDX-FileCopyrightText: 2014 Jesper K. Pedersen <blackie@kde.org>
0002 
0003    SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 import KPhotoAlbum 1.0
0007 import QtQuick 2.0
0008 import QtQuick.Controls 1.1
0009 
0010 ListView {
0011     id: root
0012     model: _remoteInterface.activeThumbnailModel
0013     snapMode: ListView.SnapToItem
0014     orientation: ListView.Horizontal
0015     flickDeceleration: 20000
0016     highlightMoveDuration: 200
0017     highlightRangeMode: ListView.StrictlyEnforceRange
0018     interactive: currentItem && currentItem.isZoomedOut
0019 
0020     Keys.onMenuPressed: menu.popup()
0021     Keys.onTabPressed: menu.popup() /* on desktop */
0022     Keys.onEscapePressed: {
0023         menu.visible = false
0024         keyboard.visible = false
0025         details.hide()
0026     }
0027 
0028     delegate: Zoomable {
0029         id: zoomable
0030         clip: true
0031         width: root.width
0032         height: root.height
0033         fitOnScreen: true
0034         property int imageId : model.imageId
0035 
0036         sourceComponent: Item {
0037             property QtObject sourceSize : QtObject {
0038                 readonly property int width: remoteImage.width
0039                 readonly property int height: remoteImage.height
0040             }
0041 
0042             RemoteImage {
0043                 id: remoteImage
0044                 scale: parent.width / width
0045                 transformOrigin: Item.TopLeft
0046                 imageId: model.imageId
0047                 type: Enums.Images
0048 
0049                 Connections {
0050                     target: zoomable
0051                     onZoomStarted: remoteImage.loadFullSize()
0052                 }
0053             }
0054         }
0055     }
0056 
0057     MouseArea {
0058         z: -1
0059         anchors { left: parent.left; right: parent.right; bottom: parent.bottom }
0060         height: parent.height/5
0061         onClicked: details.show()
0062     }
0063 
0064     MouseArea {
0065         z: -1
0066         anchors { top: parent.top; bottom: parent.bottom; left: parent.left }
0067         width: parent.width/5
0068         onClicked: root.decrementCurrentIndex()
0069     }
0070 
0071     MouseArea {
0072         z: -1
0073         anchors { top: parent.top; bottom: parent.bottom; right: parent.right }
0074         width: parent.width/5
0075         onClicked: root.incrementCurrentIndex()
0076     }
0077 
0078     MouseArea {
0079         z: -1
0080         anchors { top: parent.top; left: parent.left; right: parent.right }
0081         height: parent.height/5
0082         onClicked: keyboard.visible = true
0083     }
0084 
0085     Connections {
0086         target: _remoteInterface
0087         onJumpToImage: {
0088             var tmp = root.highlightMoveDuration;
0089             root.highlightMoveDuration = 0
0090             root.currentIndex = index
0091             root.highlightMoveDuration = tmp
0092         }
0093     }
0094 
0095     MouseArea {
0096         enabled: keyboard.visible || details.visible
0097         anchors.fill: parent
0098         onClicked: {
0099             keyboard.visible = false
0100             details.hide()
0101         }
0102     }
0103 
0104     Keyboard {
0105         id: keyboard
0106         anchors.centerIn: parent
0107         visible: false
0108         onVisibleChanged: _remoteInterface.requestDetails(root.currentItem.imageId)
0109         onLetterSelected: _remoteInterface.setToken(root.currentItem.imageId, letter)
0110         onLetterDeselected: _remoteInterface.removeToken(root.currentItem.imageId, letter)
0111         selected: _remoteInterface.tokens
0112     }
0113 
0114     ImageDetails {
0115         id: details
0116         anchors.centerIn: parent
0117         imageId: currentItem ? currentItem.imageId : -1
0118     }
0119 
0120     Menu {
0121         id: menu
0122         title: "Context Menu"
0123         MenuItem {
0124             text: "Image details"
0125             onTriggered: details.show()
0126         }
0127         MenuItem {
0128             text: "Add/Remove tokens..."
0129             onTriggered: keyboard.visible = true
0130         }
0131         MenuItem {
0132             text: "Refine search"
0133             onTriggered: _remoteInterface.showOverviewPage()
0134         }
0135         MenuItem {
0136             text: "Go Home"
0137             onTriggered: _remoteInterface.goHome()
0138         }
0139     }
0140 
0141     onCurrentIndexChanged: {
0142         if (keyboard.visible)
0143             _remoteInterface.requestDetails(root.currentItem.imageId)
0144     }
0145 }