Warning, /graphics/kphotoalbum/AndroidRemoteControl/qml/ThumbnailsPage.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 QtQuick 2.0
0007 import KPhotoAlbum 1.0
0008 import QtQuick.Controls 1.1
0009
0010 PinchArea {
0011 id: root
0012 property alias model : grid.model
0013 property int type
0014 property bool showLabels : false
0015 property alias name : observer.objectName
0016 readonly property int itemsPerPage : Math.floor(root.width/grid.cellWidth) * Math.floor(root.height/grid.cellHeight)
0017 signal clicked(int imageId, string label)
0018
0019 pinch.minimumScale: 0.1
0020 pinch.maximumScale: 10
0021 onPinchUpdated: grid.scale = pinch.scale
0022 onPinchFinished: {
0023 if ( type == Enums.CategoryItems )
0024 _settings.categoryItemSize = pinch.scale * _settings.categoryItemSize
0025 else
0026 _settings.thumbnailSize = pinch.scale * _settings.thumbnailSize
0027 grid.scale = 1
0028 }
0029
0030 Keys.onMenuPressed: menu.popup()
0031 Keys.onTabPressed: menu.popup() /* on desktop */
0032 Keys.onEscapePressed: menu.visible = false
0033
0034 GridView {
0035 id: grid
0036 anchors.fill: parent
0037 transformOrigin: Qt.TopLeftCorner
0038
0039 cellWidth: imageWidth() + padding()
0040 cellHeight: imageWidth() + padding() + (root.showLabels ? 30 : 0)
0041
0042 delegate: Item {
0043 Column {
0044 x: (padding() + grid.cellWidth - width)/2
0045 y: grid.cellHeight - height
0046
0047 RemoteImage {
0048 id: remoteImage
0049 imageId: model.imageId
0050 type: root.type
0051
0052 width: imageWidth()
0053 height: width
0054 MouseArea {
0055 anchors.fill: parent
0056 onClicked: root.clicked(parent.imageId,parent.label)
0057 onPressAndHold: menu.popup()
0058 }
0059 }
0060 Text {
0061 visible: root.showLabels
0062 color: _settings.textColor
0063 anchors { left: parent.left; right: parent.right; margins: padding()/2 }
0064 text: remoteImage.label
0065 elide: Text.ElideRight
0066 verticalAlignment: Text.AlignTop
0067 }
0068 }
0069 }
0070 }
0071 ScrollBar {
0072 flickable: grid
0073 }
0074
0075 Menu {
0076 id: menu
0077 title: "Context Menu"
0078 MenuItem {
0079 text: "Refine search"
0080 onTriggered: _remoteInterface.showOverviewPage()
0081 }
0082 MenuItem {
0083 text: "Go Home"
0084 onTriggered: _remoteInterface.goHome()
0085 }
0086 }
0087
0088 PositionObserver {
0089 id: observer
0090 view: grid
0091 }
0092
0093 function imageWidth() {
0094 return type == Enums.CategoryItems ? _settings.categoryItemSize : _settings.thumbnailSize;
0095 }
0096 function padding() {
0097 return 20 // imageWidth()/8 - rhk would like us to try not to scale the space.
0098 }
0099 }