on xenial help sign in
show progress bar instead of spinner
0b02859Diego Sarmentero
qml/Dash/PreviewListView.qml+1−2
@@ -33,8 +33,7 @@ Item {
33 property alias count: previewListView.count
33 property alias count: previewListView.count
34
34
35 readonly property bool processing: currentItem && (!currentItem.previewModel.loaded
35 readonly property bool processing: currentItem && (!currentItem.previewModel.loaded
36− || currentItem.previewModel.processingAction
36+ || currentItem.previewModel.processingAction)
37− || currentItem.actionInProgress)
38
37
39 PageHeader {
38 PageHeader {
40 id: header
39 id: header
qml/Dash/Previews/Preview.qml−7
@@ -39,9 +39,6 @@ Item {
39 //! \brief The ScopeStyle component.
39 //! \brief The ScopeStyle component.
40 property var scopeStyle: null
40 property var scopeStyle: null
41
41
42− //! \brief Should be set to true if an operation is in the background and the preview shouldn't allow interactions.
43− property bool actionInProgress: false
44−
45 clip: true
42 clip: true
46
43
47 Binding {
44 Binding {
@@ -95,10 +92,6 @@ Item {
95 previewModel.triggered(widgetId, actionId, data);
92 previewModel.triggered(widgetId, actionId, data);
96 }
93 }
97
94
98− onProcessing: {
99− root.actionInProgress = active;
100− }
101−
102 onFocusChanged: if (focus) column.positionViewAtIndex(index, ListView.Contain)
95 onFocusChanged: if (focus) column.positionViewAtIndex(index, ListView.Contain)
103
96
104 onHeightChanged: if (focus) column.positionViewAtIndex(index, ListView.Contain)
97 onHeightChanged: if (focus) column.positionViewAtIndex(index, ListView.Contain)
qml/Dash/Previews/PreviewPayments.qml+13−6
@@ -38,15 +38,16 @@ PreviewWidget {
38 objectName: "paymentButton"
38 objectName: "paymentButton"
39
39
40 color: Theme.palette.selected.foreground
40 color: Theme.palette.selected.foreground
41− text: root.processActive ? i18n.tr("Purchasing…") : paymentClient.formattedPrice
41+ text: paymentClient.formattedPrice
42 onClicked: {
42 onClicked: {
43 root.processActive = true;
43 root.processActive = true;
44− root.processing(root.processActive);
45 paymentClient.start();
44 paymentClient.start();
46 }
45 }
47 enabled: !root.processActive
46 enabled: !root.processActive
48 anchors.right: parent.right
47 anchors.right: parent.right
49 width: (root.width - units.gu(1)) / 2
48 width: (root.width - units.gu(1)) / 2
49+ opacity: root.processActive ? 0 : 1
50+ Behavior on opacity { PropertyAnimation {duration: UbuntuAnimation.SlowDuration}}
50
51
51 Payments {
52 Payments {
52 id: paymentClient
53 id: paymentClient
@@ -57,15 +58,21 @@ PreviewWidget {
57 currency: source["currency"]
58 currency: source["currency"]
58 storeItemId: source["store_item_id"]
59 storeItemId: source["store_item_id"]
59 onPurchaseCompleted: {
60 onPurchaseCompleted: {
60− root.processActive = false;
61− root.processing(root.processActive);
62 root.triggered(widgetId, "purchaseCompleted", source);
61 root.triggered(widgetId, "purchaseCompleted", source);
63 }
62 }
64 onPurchaseError: {
63 onPurchaseError: {
65− root.processActive = false;
66− root.processing(root.processActive);
67 root.triggered(widgetId, "purchaseError", source);
64 root.triggered(widgetId, "purchaseError", source);
68 }
65 }
69 }
66 }
70 }
67 }
68+
69+ ProgressBar {
70+ id: loadingBar
71+ indeterminate: true
72+ anchors.right: parent.right
73+ width: (root.width - units.gu(1)) / 2
74+ opacity: root.processActive ? 1 : 0
75+
76+ Behavior on opacity { PropertyAnimation {duration: UbuntuAnimation.SlowDuration}}
77+ }
71}
78}