Warning, /maui/mauikit-imagetools/src/controls.6/ImageInfoDialog.qml is written in an unsupported language. File is not indexed.
0001 // Copyright 2018-2020 Camilo Higuita <milo.h@aol.com>
0002 // Copyright 2018-2020 Nitrux Latinoamericana S.C.
0003 //
0004 // SPDX-License-Identifier: GPL-3.0-or-later
0005
0006
0007 import QtQuick
0008
0009 import QtQuick.Layouts
0010 import QtQuick.Controls
0011
0012 import QtLocation
0013 import QtPositioning
0014
0015 import org.mauikit.controls 1.3 as Maui
0016 import org.mauikit.filebrowsing 1.3 as FB
0017 import org.mauikit.imagetools 1.3 as IT
0018
0019 /**
0020 * @inherit org::mauikit::controls::PopupPage
0021 * @brief A popup view presenting with metadata information about a given image file.
0022 *
0023 * @image html imageinfodialog.png "Image information dialog"
0024 *
0025 * @code
0026 * IT.ImageInfoDialog
0027 * {
0028 * id: _dialog
0029 * url: "file:///home/camiloh/maui-demo-files/Pictures/4416d027-9fa4-4762-8eb6-31de331623a1.jpg"
0030 * }
0031 * @endcode
0032 */
0033 Maui.PopupPage
0034 {
0035 id: control
0036
0037 /**
0038 * @brief
0039 */
0040 property alias url : _infoModel.url
0041
0042 maxHeight: 800
0043 maxWidth: 500
0044 hint: 1
0045
0046 title: _infoModel.fileName
0047 headBar.visible: true
0048 spacing: Maui.Style.space.huge
0049
0050 footBar.rightContent: [
0051 ToolButton
0052 {
0053 icon.name: "list-add"
0054 text: "Add Exif tag"
0055 onClicked: _editTagDialog.open()
0056 },
0057
0058 ToolButton
0059 {
0060 icon.name: "file-open"
0061 text: "Open"
0062 }
0063 ]
0064
0065 Rectangle
0066 {
0067 Layout.fillWidth: true
0068 Layout.preferredHeight: 200
0069 color: Qt.darker(Maui.Theme.backgroundColor, 1.1)
0070
0071 Image
0072 {
0073 id: _img
0074 anchors.fill: parent
0075 source: control.url
0076 fillMode: Image.PreserveAspectCrop
0077 // sourceSize.width: width
0078 // sourceSize.height: height
0079
0080 Rectangle
0081 {
0082 color: "#333"
0083 opacity: 0.5
0084 anchors.fill: parent
0085 }
0086
0087 Rectangle
0088 {
0089 anchors.centerIn: parent
0090 color: "#333"
0091 radius: Maui.Style.radiusV
0092 width: 100
0093 height: 32
0094 Label
0095 {
0096 anchors.centerIn: parent
0097 text: _img.implicitWidth + " x " + _img.implicitHeight
0098 color: "white"
0099 }
0100 }
0101 }
0102 }
0103
0104 FB.TagsBar
0105 {
0106 Layout.fillWidth: true
0107 visible: count > 0
0108 allowEditMode: false
0109 list.urls: [control.url]
0110 list.strict: false
0111 }
0112
0113 Maui.InfoDialog
0114 {
0115 id: _editTagDialog
0116 property alias key : _keyField.text
0117 property alias value : _valueField.text
0118
0119 title: i18n ("Edit")
0120 message: i18nd("mauikitimagetools","Editing Exif tag")
0121
0122 standardButtons: Dialog.Save | Dialog.Cancel
0123
0124 TextField
0125 {
0126 id: _keyField
0127 Layout.fillWidth: true
0128 placeholderText: i18nd("mauikitimagetools","Tag key")
0129 }
0130
0131 TextField
0132 {
0133 id: _valueField
0134 Layout.fillWidth: true
0135 placeholderText: i18nd("mauikitimagetools","Tag value")
0136 }
0137
0138 onAccepted:
0139 {
0140 console.log(_editTagDialog.key, _editTagDialog.value)
0141 if(_infoModel.editTag(_editTagDialog.key, _editTagDialog.value))
0142 {
0143 _editTagDialog.close()
0144 }else
0145 {
0146 _editTagDialog.alert(i18nd("mauikitimagetools","Could not edit the tag"), 2)
0147 }
0148 }
0149
0150 onRejected:
0151 {
0152 _editTagDialog.close()
0153 }
0154
0155 function set(key, value)
0156 {
0157 _editTagDialog.key = key
0158 _editTagDialog.value = value
0159 _editTagDialog.open()
0160 }
0161 }
0162
0163 Maui.InfoDialog
0164 {
0165 id: _removeTagDialog
0166 property string key
0167 property string value
0168
0169 title: i18n ("Remove")
0170 message: i18nd("mauikitimagetools","Are you sure you want to remove the Exif tag %1?", _removeTagDialog.value)
0171
0172 standardButtons: Dialog.Yes | Dialog.Cancel
0173
0174 onAccepted:
0175 {
0176 if(_infoModel.removeTag(_removeTagDialog.key))
0177 {
0178 _removeTagDialog.close()
0179 }else
0180 {
0181 _removeTagDialog.alert(i18nd("mauikitimagetools","Could not remove the tag"), 2)
0182 }
0183 }
0184
0185 onRejected:
0186 {
0187 _removeTagDialog.close()
0188 }
0189
0190 function set(key, value)
0191 {
0192 _removeTagDialog.key = key
0193 _removeTagDialog.value = value
0194 _removeTagDialog.open()
0195 }
0196 }
0197
0198 Maui.SectionGroup
0199 {
0200 Layout.fillWidth: true
0201
0202 title: i18nd("mauikitimagetools","Details")
0203 description: i18nd("mauikitimagetools","File information")
0204
0205 Repeater
0206 {
0207 model: Maui.BaseModel
0208 {
0209 list: IT.PicInfoModel
0210 {
0211 id:_infoModel
0212 }
0213 }
0214
0215 delegate: Maui.FlexSectionItem
0216 {
0217 visible: model.value && String(model.value).length > 0
0218 label1.text: model.name
0219 label2.text: model.value
0220
0221 ToolButton
0222 {
0223 visible: model.key
0224 icon.name: "document-edit"
0225 onClicked: _editTagDialog.set(model.key, model.value)
0226 }
0227
0228 ToolButton
0229 {
0230 visible: model.key
0231 icon.name: "edit-delete"
0232 onClicked: _removeTagDialog.set(model.key, model.value)
0233 }
0234 }
0235 }
0236 }
0237
0238 Maui.Separator
0239 {
0240 Layout.fillWidth: true
0241 visible: map.visible
0242 }
0243
0244 Map
0245 {
0246 id: map
0247 visible: _infoModel.lat !== 0 && _infoModel.lon !== 0
0248 color: Maui.Theme.backgroundColor
0249 Layout.fillWidth: true
0250 Layout.preferredHeight: 400
0251 // gesture.acceptedGestures: MapGestureArea.NoGesture
0252 // gesture.flickDeceleration: 3000
0253 // gesture.enabled: true
0254
0255 plugin: Plugin
0256 {
0257 id: mapPlugin
0258 name: "osm" // "mapboxgl", "esri", ...
0259 // specify plugin parameters if necessary
0260 // PluginParameter {
0261 // name:
0262 // value:
0263 // }
0264 }
0265 // center: QtPositioning.coordinate(_infoModel.lat, _infoModel.lon) // Oslo
0266 zoomLevel: 16
0267 center
0268 {
0269 latitude: _infoModel.lat
0270 longitude:_infoModel.lon
0271 }
0272
0273 MapCircle
0274 {
0275 center: map.center
0276 radius: 50.0
0277 color: Maui.Theme.highlightColor
0278 }
0279
0280 Component.onCompleted:
0281 {
0282 map.addMapItem(map.circle)
0283 }
0284 }
0285 }