Changeset View
Changeset View
Standalone View
Standalone View
qmlUiKirigami/ImageViewer.qml
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Line(s) | 33 | Kirigami.Page { | |||
---|---|---|---|---|---|
42 | 42 | | |||
43 | leftPadding: 0 | 43 | leftPadding: 0 | ||
44 | rightPadding: 0 | 44 | rightPadding: 0 | ||
45 | 45 | | |||
46 | KQA.MimeDatabase { | 46 | KQA.MimeDatabase { | ||
47 | id: mimeDB | 47 | id: mimeDB | ||
48 | } | 48 | } | ||
49 | 49 | | |||
50 | Kirigami.ContextDrawer { | | |||
51 | id: contextDrawer | | |||
52 | title: i18n("Edit image") | | |||
53 | handleVisible: true | | |||
54 | } | | |||
55 | | ||||
56 | actions { | 50 | actions { | ||
57 | left: Kirigami.Action { | 51 | left: Kirigami.Action { | ||
58 | id: backAction | 52 | id: backAction | ||
59 | iconName: "view-close" | 53 | iconName: "view-close" | ||
60 | tooltip: i18n("Close Image") | 54 | tooltip: i18n("Close Image") | ||
61 | onTriggered: root.close(); | 55 | onTriggered: root.close(); | ||
62 | } | 56 | } | ||
63 | main: Kirigami.Action { | 57 | main: Kirigami.Action { | ||
Show All 13 Lines | 69 | right: Kirigami.Action { | |||
77 | iconName: "edit-entry" | 71 | iconName: "edit-entry" | ||
78 | tooltip: i18n("Edit Image") | 72 | tooltip: i18n("Edit Image") | ||
79 | onTriggered: { | 73 | onTriggered: { | ||
80 | applicationWindow().pageStack.layers.push(editorComponent) | 74 | applicationWindow().pageStack.layers.push(editorComponent) | ||
81 | } | 75 | } | ||
82 | } | 76 | } | ||
83 | } | 77 | } | ||
84 | 78 | | |||
85 | //FIXME: HACK | | |||
86 | property bool wasDrawerOpen | 79 | property bool wasDrawerOpen | ||
80 | states: [ | ||||
81 | State { | ||||
82 | name: "viewing" | ||||
83 | PropertyChanges { | ||||
84 | target: applicationWindow() | ||||
85 | globalDrawer.enabled: false | ||||
86 | controlsVisible: false | ||||
87 | header.visible: false | ||||
88 | } | ||||
89 | StateChangeScript { | ||||
90 | script: { | ||||
91 | listView.forceActiveFocus() | ||||
92 | wasDrawerOpen = globalDrawer.visible | ||||
93 | globalDrawer.visible = false | ||||
94 | } | ||||
95 | } | ||||
96 | } | ||||
97 | ] | ||||
98 | | ||||
87 | Component.onCompleted: { | 99 | Component.onCompleted: { | ||
88 | applicationWindow().controlsVisible = false; | 100 | root.state = "viewing" | ||
89 | listView.forceActiveFocus(); | | |||
90 | applicationWindow().header.visible = false; | | |||
91 | applicationWindow().footer.visible = false; | | |||
92 | wasDrawerOpen = applicationWindow().globalDrawer.visible; | | |||
93 | applicationWindow().globalDrawer.visible = false; | | |||
94 | applicationWindow().globalDrawer.enabled = false; | | |||
95 | } | 101 | } | ||
102 | | ||||
96 | function close() { | 103 | function close() { | ||
97 | applicationWindow().controlsVisible = true; | 104 | applicationWindow().controlsVisible = true; | ||
98 | applicationWindow().header.visible = true; | 105 | applicationWindow().header.visible = true; | ||
99 | if (applicationWindow().footer) { | 106 | if (applicationWindow().footer) { | ||
100 | applicationWindow().footer.visible = true; | 107 | applicationWindow().footer.visible = true; | ||
101 | } | 108 | } | ||
102 | applicationWindow().globalDrawer.visible = wasDrawerOpen; | | |||
103 | applicationWindow().globalDrawer.enabled = true; | 109 | applicationWindow().globalDrawer.enabled = true; | ||
110 | applicationWindow().globalDrawer.visible = wasDrawerOpen; | ||||
104 | applicationWindow().visibility = Window.Windowed; | 111 | applicationWindow().visibility = Window.Windowed; | ||
105 | applicationWindow().pageStack.layers.pop(); | 112 | applicationWindow().pageStack.layers.pop(); | ||
106 | } | 113 | } | ||
107 | 114 | | |||
108 | | ||||
109 | background: Rectangle { | 115 | background: Rectangle { | ||
110 | color: "black" | 116 | color: "black" | ||
111 | } | 117 | } | ||
112 | 118 | | |||
113 | Keys.onPressed: { | 119 | Keys.onPressed: { | ||
114 | switch(event.key) { | 120 | switch(event.key) { | ||
115 | case Qt.Key_Escape: | 121 | case Qt.Key_Escape: | ||
116 | root.close(); | 122 | root.close(); | ||
▲ Show 20 Lines • Show All 127 Lines • ▼ Show 20 Line(s) | 244 | Image { | |||
244 | Timer { | 250 | Timer { | ||
245 | id: doubleClickTimer | 251 | id: doubleClickTimer | ||
246 | interval: 150 | 252 | interval: 150 | ||
247 | onTriggered: applicationWindow().controlsVisible = !applicationWindow().controlsVisible | 253 | onTriggered: applicationWindow().controlsVisible = !applicationWindow().controlsVisible | ||
248 | } | 254 | } | ||
249 | MouseArea { | 255 | MouseArea { | ||
250 | anchors.fill: parent | 256 | anchors.fill: parent | ||
251 | onClicked: { | 257 | onClicked: { | ||
252 | contextDrawer.drawerOpen = false | | |||
253 | doubleClickTimer.restart(); | 258 | doubleClickTimer.restart(); | ||
254 | } | 259 | } | ||
255 | onDoubleClicked: { | 260 | onDoubleClicked: { | ||
256 | doubleClickTimer.running = false; | 261 | doubleClickTimer.running = false; | ||
257 | applicationWindow().controlsVisible = false; | 262 | applicationWindow().controlsVisible = false; | ||
258 | if (flick.interactive) { | 263 | if (flick.interactive) { | ||
259 | zoomAnim.x = 0; | 264 | zoomAnim.x = 0; | ||
260 | zoomAnim.y = 0; | 265 | zoomAnim.y = 0; | ||
▲ Show 20 Lines • Show All 72 Lines • Show Last 20 Lines |