on xenial help sign in
Add preview activity indicator and fix subsequent preview input.
commit48bc3b89193d836d82fa6a21d91968a08e5f5f3b authorMichał Sawicz <michal.sawicz@canonical.com> dateThu 20 Feb 2014, 18:16 (13 years ago) parentd344dfc
2 files changed+25−42
qml/Dash/PreviewListView.qml+25−29 qml/Dash/Previews/Preview.qml−13
qml/Dash/PreviewListView.qml+25−29
@@ -151,43 +151,39 @@ Item {
151151 }
152152 }
153153
154− delegate: Previews.Preview {
155− id: preview
156− objectName: "preview" + index
154+ delegate: Item {
157155 height: previewListView.height
158156 width: previewListView.width
159157
160− isCurrent: ListView.isCurrentItem
161−
162− onPreviewModelChanged: preview.opacity = 0;
163− onReadyChanged: if (ready) fadeIn.start()
164− 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) {
158+ Previews.Preview {
159+ id: preview
160+ objectName: "preview" + index
161+ anchors.fill: parent
162+
163+ isCurrent: parent.ListView.isCurrentItem
164+
165+ previewModel: {
172166 var previewStack = root.scope.preview(result);
173167 return previewStack.get(0);
174− } else {
175− ready = false;
176− return null;
177168 }
169+
170+ // onClose: {
171+ // previewListView.open = false
172+ // }
173+
178174 }
179175
180−// onClose: {
181−// previewListView.open = false
182−// }
183−
184− PropertyAnimation {
185− id: fadeIn
186− target: preview
187− property: "opacity"
188− from: 0.0
189− to: 1.0
190− duration: UbuntuAnimation.BriskDuration
176+ MouseArea {
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
186+ }
191187 }
192188 }
193189 }
qml/Dash/Previews/Preview.qml−13
@@ -36,9 +36,6 @@ Item {
3636 //! \brief Should be set to true if this preview is currently displayed.
3737 property bool isCurrent: false
3838
39− //! \brief Will be changed to true when the initial preview widgets are in.
40− property bool ready: false
41−
4239 clip: true
4340
4441 Connections {
@@ -52,8 +49,6 @@ Item {
5249 }
5350 }
5451
55− onPreviewModelChanged: processingMouseArea.enabled = false
56−
5752 Binding {
5853 target: previewModel
5954 property: "widgetColumnCount"
@@ -84,7 +79,6 @@ Item {
8479 bottomMargin: Qt.inputMethod.visible ? Qt.inputMethod.keyboardRectangle.height : 0
8580
8681 model: columnModel
87− onCountChanged: if (count > 0) root.ready = true
8882 cacheBuffer: height
8983
9084 Behavior on contentY { UbuntuNumberAnimation { } }
@@ -113,11 +107,4 @@ Item {
113107 }
114108 }
115109 }
116−
117− MouseArea {
118− id: processingMouseArea
119− objectName: "processingMouseArea"
120− anchors.fill: parent
121− enabled: false
122− }
123110}