Warning, /graphics/kphotoalbum/AndroidRemoteControl/qml/ImageDetails.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 
0008 Item {
0009     id: root
0010     property int imageId
0011     onImageIdChanged: {
0012         if (visible)
0013             _remoteInterface.requestDetails(imageId)
0014     }
0015 
0016     visible: false
0017     opacity: visible ? 1 : 0
0018     Behavior on opacity { NumberAnimation { duration: 200 } }
0019 
0020     width: rect.width
0021     height: Math.min(_screenInfo.viewHeight, rect.height)
0022     anchors.centerIn: parent
0023 
0024     Flickable {
0025         contentWidth: rect.width
0026         contentHeight: rect.height
0027         anchors.fill: parent
0028 
0029         Rectangle {
0030             id: rect
0031             width: visible ? column.width + 40 : 0
0032             height: visible ? column.height + 40 : 0
0033             color: "#AA000000"
0034 
0035             MouseArea {
0036                 anchors.fill: parent
0037                 // Just eat all events, so a click outside a link doesn't go to next page
0038             }
0039 
0040             Column {
0041                 id: column
0042 
0043                 x: 20
0044                 y: 20
0045                 spacing: 15
0046 
0047                 Text {
0048                     text: "<b>Date</b>: " + _imageDetails.date
0049                     color: "white"
0050                 }
0051                 Repeater {
0052                     model: _imageDetails.categories
0053                     Text {
0054                         text: "<b>" + modelData + "</b>: " + items(modelData) + _imageDetails.dummy
0055                         color: "white"
0056                         linkColor: "white"
0057                         onLinkActivated: { hide(); _remoteInterface.activateSearch(link) }
0058                         wrapMode: Text.Wrap
0059                         width: column.width
0060                     }
0061                 }
0062                 Text {
0063                     text: "<b>File name</b>: " + _imageDetails.fileName
0064                     color: "white"
0065                 }
0066 
0067                 Text {
0068                     visible: _imageDetails.description !== ""
0069                     width: Math.min(_screenInfo.viewWidth-200, implicitWidth)
0070                     textFormat: Text.RichText
0071                     text: "<b>Description</b>: " + _imageDetails.description.replace("\n","<br/>")
0072                     color: "white"
0073                     wrapMode: Text.Wrap
0074                 }
0075             }
0076 
0077             Behavior on width {
0078                 NumberAnimation {duration: 100 }
0079             }
0080             Behavior on height {
0081                 NumberAnimation {duration: 100 }
0082             }
0083 
0084             SequentialAnimation {
0085                 id: hideAnimation
0086                 PropertyAnimation {
0087                     target: root
0088                     properties: "opacity"
0089                     to: 0
0090                     duration: 200
0091                 }
0092 
0093                 // I need to remove the visibility otherwise it will still steal all the event.
0094                 PropertyAction {
0095                     target: root
0096                     property: "visible"
0097                     value: false
0098                 }
0099             }
0100         }
0101     }
0102     Canvas {
0103         id:canvas
0104         anchors { right: parent.right; top: parent.top }
0105         width: 50
0106         height: 50
0107         onPaint: {
0108             var ctx = getContext("2d");
0109             ctx.fillStyle = "#FFFFFF";
0110             ctx.fillRect(0,0,width,height)
0111             ctx.lineWidth = 5
0112             ctx.moveTo(0,0)
0113             ctx.lineTo(width,height)
0114             ctx.moveTo(0,height)
0115             ctx.lineTo(width,0)
0116             ctx.stroke()
0117         }
0118 
0119         MouseArea {
0120             x: -50; y: -50
0121             width: parent.width+100
0122             height: parent.height+100
0123             onClicked: hide()
0124         }
0125     }
0126 
0127     function items(category) {
0128         var result
0129         var list = _imageDetails.itemsOfCategory(category)
0130         for (var i=0; i<list.length; ++i ) {
0131             var url=category + ";;;"+ list[i]
0132             var link = "<a href=\"" + url + "\">" + list[i] + "</a>"
0133             var age = _imageDetails.age(category, list[i])
0134             if (age)
0135                 link += age
0136             if (result)
0137                 result = result + ", " + link
0138             else
0139                 result = link
0140         }
0141         return result
0142     }
0143 
0144     function hide() {
0145         hideAnimation.restart()
0146     }
0147 
0148     function show() {
0149         _remoteInterface.requestDetails(imageId)
0150         visible = true
0151     }
0152 }