on xenial help sign in
Add preview activity indicator and fix subsequent preview input.
48bc3b8Michał Sawicz
qml/Dash/PreviewListView.qml+25−29
@@ -151,43 +151,39 @@ Item {
151 }
151 }
152 }
152 }
153
153
154− delegate: Previews.Preview {
154+ delegate: Item {
155− id: preview
156− objectName: "preview" + index
157 height: previewListView.height
155 height: previewListView.height
158 width: previewListView.width
156 width: previewListView.width
159
157
158+ Previews.Preview {
159+ id: preview
160+ objectName: "preview" + index
161+ anchors.fill: parent
162+
160− isCurrent: ListView.isCurrentItem
163+ isCurrent: parent.ListView.isCurrentItem
161−
164+
162− onPreviewModelChanged: preview.opacity = 0;
163− onReadyChanged: if (ready) fadeIn.start()
164− previewModel: {
165+ previewModel: {
165− // TODO
166− // We need the isCurrent because the scope fails to
167− // deliver the preview if we ask for one after other very quickly
168− // If we remove the isCurrent, we will have to think another way of
169− // doing the fadeIn or just don't do it at all or just decide
170− // this code is good enough and remove the TODO
171− if (isCurrent) {
172 var previewStack = root.scope.preview(result);
166 var previewStack = root.scope.preview(result);
173 return previewStack.get(0);
167 return previewStack.get(0);
174− } else {
175− ready = false;
176− return null;
177 }
168 }
169+
170+ // onClose: {
171+ // previewListView.open = false
172+ // }
173+
178 }
174 }
179
175
180−// onClose: {
176+ MouseArea {
181−// previewListView.open = false
177+ id: processingMouseArea
178+ objectName: "processingMouseArea"
179+ anchors.fill: parent
180+ enabled: !preview.previewModel.loaded || preview.previewModel.processingAction
181+
182+ ActivityIndicator {
183+ anchors.centerIn: parent
184+ visible: parent.enabled
185+ running: visible
182−// }
186+ }
183−
184− PropertyAnimation {
185− id: fadeIn
186− target: preview
187− property: "opacity"
188− from: 0.0
189− to: 1.0
190− duration: UbuntuAnimation.BriskDuration
191 }
187 }
192 }
188 }
193 }
189 }
qml/Dash/Previews/Preview.qml−13
@@ -36,9 +36,6 @@ Item {
36 //! \brief Should be set to true if this preview is currently displayed.
36 //! \brief Should be set to true if this preview is currently displayed.
37 property bool isCurrent: false
37 property bool isCurrent: false
38
38
39− //! \brief Will be changed to true when the initial preview widgets are in.
40− property bool ready: false
41−
42 clip: true
39 clip: true
43
40
44 Connections {
41 Connections {
@@ -52,8 +49,6 @@ Item {
52 }
49 }
53 }
50 }
54
51
55− onPreviewModelChanged: processingMouseArea.enabled = false
56−
57 Binding {
52 Binding {
58 target: previewModel
53 target: previewModel
59 property: "widgetColumnCount"
54 property: "widgetColumnCount"
@@ -84,7 +79,6 @@ Item {
84 bottomMargin: Qt.inputMethod.visible ? Qt.inputMethod.keyboardRectangle.height : 0
79 bottomMargin: Qt.inputMethod.visible ? Qt.inputMethod.keyboardRectangle.height : 0
85
80
86 model: columnModel
81 model: columnModel
87− onCountChanged: if (count > 0) root.ready = true
88 cacheBuffer: height
82 cacheBuffer: height
89
83
90 Behavior on contentY { UbuntuNumberAnimation { } }
84 Behavior on contentY { UbuntuNumberAnimation { } }
@@ -113,11 +107,4 @@ Item {
113 }
107 }
114 }
108 }
115 }
109 }
116−
117− MouseArea {
118− id: processingMouseArea
119− objectName: "processingMouseArea"
120− anchors.fill: parent
121− enabled: false
122− }
123}
110}