Changeset View
Changeset View
Standalone View
Standalone View
qmlUiKirigami/ImageViewer.qml
Show All 18 Lines | |||||
19 | * You should have received a copy of the GNU Lesser General Public | 19 | * You should have received a copy of the GNU Lesser General Public | ||
20 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | 20 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
21 | * | 21 | * | ||
22 | */ | 22 | */ | ||
23 | 23 | | |||
24 | import QtQuick 2.7 | 24 | import QtQuick 2.7 | ||
25 | import QtQuick.Window 2.2 | 25 | import QtQuick.Window 2.2 | ||
26 | import QtQuick.Controls 2.0 as Controls | 26 | import QtQuick.Controls 2.0 as Controls | ||
27 | import QtQuick.Layouts 1.3 | ||||
27 | import org.kde.kirigami 2.0 as Kirigami | 28 | import org.kde.kirigami 2.0 as Kirigami | ||
28 | import org.kde.koko 0.1 as Koko | 29 | import org.kde.koko 0.1 as Koko | ||
29 | import org.kde.kquickcontrolsaddons 2.0 as KQA | 30 | import org.kde.kquickcontrolsaddons 2.0 as KQA | ||
30 | 31 | | |||
31 | Kirigami.Page { | 32 | Kirigami.Page { | ||
32 | id: root | 33 | id: root | ||
33 | 34 | | |||
34 | title: i18n("Details") | 35 | title: i18n("Details") | ||
35 | property alias sourceModel: imagesListModel.sourceModel | 36 | property alias sourceModel: imagesListModel.sourceModel | ||
36 | property int indexValue | 37 | property int indexValue | ||
37 | 38 | | |||
38 | property int imageWidth | 39 | property int imageWidth | ||
39 | property int imageHeight | 40 | property int imageHeight | ||
40 | 41 | | |||
41 | leftPadding: 0 | 42 | leftPadding: 0 | ||
42 | rightPadding: 0 | 43 | rightPadding: 0 | ||
43 | 44 | | |||
44 | KQA.MimeDatabase { | 45 | KQA.MimeDatabase { | ||
45 | id: mimeDB | 46 | id: mimeDB | ||
46 | } | 47 | } | ||
47 | 48 | | |||
48 | Koko.ImageDocument { | 49 | Koko.ImageDocument { | ||
49 | id: imageDoc | 50 | id: imageDoc | ||
50 | path: listView.currentItem.currentImageSource | 51 | path: listView.currentItem.currentImageSource | ||
52 | onResetHandle: brightnessSlider.value = 0.5 | ||||
51 | } | 53 | } | ||
52 | 54 | | |||
53 | Kirigami.ContextDrawer { | 55 | Kirigami.ContextDrawer { | ||
54 | id: contextDrawer | 56 | id: contextDrawer | ||
55 | title: i18n("Edit image") | 57 | title: i18n("Edit image") | ||
56 | handleVisible: true | 58 | handleVisible: true | ||
57 | } | 59 | } | ||
58 | 60 | | |||
Show All 31 Lines | 89 | Kirigami.Action { | |||
90 | tooltip: i18n("Rotate the image to the right") | 92 | tooltip: i18n("Rotate the image to the right") | ||
91 | onTriggered: { | 93 | onTriggered: { | ||
92 | imageDoc.rotate(90) | 94 | imageDoc.rotate(90) | ||
93 | } | 95 | } | ||
94 | } | 96 | } | ||
95 | ] | 97 | ] | ||
96 | } | 98 | } | ||
97 | 99 | | |||
100 | ColumnLayout { | ||||
101 | anchors.top: root.top | ||||
102 | width: root.width | ||||
103 | z: listView.z + 1 | ||||
104 | | ||||
105 | Controls.Slider { | ||||
106 | id: brightnessSlider | ||||
107 | property real previousValue: 0.5 | ||||
108 | Layout.fillWidth: true | ||||
109 | visible: applicationWindow().controlsVisible | ||||
110 | from: 0 | ||||
111 | to: 1.0 | ||||
112 | value: 0.5 | ||||
113 | stepSize: 0.1 | ||||
114 | z: listView.z + 1 | ||||
115 | snapMode: Controls.Slider.SnapAlways | ||||
116 | hoverEnabled: true | ||||
117 | Controls.ToolTip { | ||||
118 | parent: brightnessSlider | ||||
119 | visible: brightnessSlider.hovered | ||||
120 | text: i18n("Brightness Controller") | ||||
121 | } | ||||
122 | onValueChanged: { | ||||
123 | if( value > previousValue) { | ||||
124 | imageDoc.changeBrightness( true) | ||||
125 | } else if( value < previousValue) { | ||||
126 | imageDoc.changeBrightness( false) | ||||
127 | } | ||||
128 | previousValue = value | ||||
129 | listView.forceActiveFocus() | ||||
130 | } | ||||
131 | } | ||||
132 | | ||||
133 | RowLayout { | ||||
134 | Layout.fillWidth: true | ||||
135 | visible: imageDoc.edited | ||||
136 | Controls.Button { | ||||
137 | Layout.fillWidth: true | ||||
138 | text: i18n("Save") | ||||
139 | onClicked: imageDoc.save() | ||||
140 | } | ||||
141 | Controls.Button { | ||||
142 | Layout.fillWidth: true | ||||
143 | text: i18n("Cancel") | ||||
144 | onClicked: imageDoc.cancel() | ||||
145 | } | ||||
146 | } | ||||
147 | } | ||||
148 | | ||||
98 | //FIXME: HACK | 149 | //FIXME: HACK | ||
99 | property bool wasDrawerOpen | 150 | property bool wasDrawerOpen | ||
100 | Component.onCompleted: { | 151 | Component.onCompleted: { | ||
101 | applicationWindow().controlsVisible = false; | 152 | applicationWindow().controlsVisible = false; | ||
102 | listView.forceActiveFocus(); | 153 | listView.forceActiveFocus(); | ||
103 | applicationWindow().header.visible = false; | 154 | applicationWindow().header.visible = false; | ||
104 | applicationWindow().footer.visible = false; | 155 | applicationWindow().footer.visible = false; | ||
105 | wasDrawerOpen = applicationWindow().globalDrawer.visible; | 156 | wasDrawerOpen = applicationWindow().globalDrawer.visible; | ||
▲ Show 20 Lines • Show All 149 Lines • ▼ Show 20 Line(s) | 300 | KQA.QImageItem { | |||
255 | Timer { | 306 | Timer { | ||
256 | id: doubleClickTimer | 307 | id: doubleClickTimer | ||
257 | interval: 150 | 308 | interval: 150 | ||
258 | onTriggered: applicationWindow().controlsVisible = !applicationWindow().controlsVisible | 309 | onTriggered: applicationWindow().controlsVisible = !applicationWindow().controlsVisible | ||
259 | } | 310 | } | ||
260 | MouseArea { | 311 | MouseArea { | ||
261 | anchors.fill: parent | 312 | anchors.fill: parent | ||
262 | onClicked: { | 313 | onClicked: { | ||
314 | contextDrawer.drawerOpen = false | ||||
263 | doubleClickTimer.restart(); | 315 | doubleClickTimer.restart(); | ||
264 | } | 316 | } | ||
265 | onDoubleClicked: { | 317 | onDoubleClicked: { | ||
266 | doubleClickTimer.running = false; | 318 | doubleClickTimer.running = false; | ||
267 | applicationWindow().controlsVisible = false; | 319 | applicationWindow().controlsVisible = false; | ||
268 | if (flick.interactive) { | 320 | if (flick.interactive) { | ||
269 | zoomAnim.x = 0; | 321 | zoomAnim.x = 0; | ||
270 | zoomAnim.y = 0; | 322 | zoomAnim.y = 0; | ||
▲ Show 20 Lines • Show All 59 Lines • Show Last 20 Lines |