Click anywhere on errored upload bar to close it
This commit is contained in:
		| @@ -14,8 +14,20 @@ HColumnLayout { | |||||||
|     readonly property int speed: model.speed |     readonly property int speed: model.speed | ||||||
|     readonly property int totalSize: model.total_size |     readonly property int totalSize: model.total_size | ||||||
|     readonly property string status: model.status |     readonly property string status: model.status | ||||||
|     property var pr: status |  | ||||||
|     onPrChanged: print("pr changed:", pr) |  | ||||||
|  |     function cancel() { | ||||||
|  |         // Python might take a sec to cancel, but we want | ||||||
|  |         // immediate visual feedback | ||||||
|  |         transfer.height = 0 | ||||||
|  |         // Python will delete this model item on cancel | ||||||
|  |         py.call(py.getattr(model.task, "cancel")) | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     function pause() { | ||||||
|  |         transfer.paused = ! transfer.paused | ||||||
|  |         py.setattr(model.monitor, "pause", transfer.paused) | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|     Behavior on msLeft { HNumberAnimation { duration: 1000 } } |     Behavior on msLeft { HNumberAnimation { duration: 1000 } } | ||||||
| @@ -127,12 +139,7 @@ HColumnLayout { | |||||||
|             toolTip.text: transfer.paused ? |             toolTip.text: transfer.paused ? | ||||||
|                           qsTr("Resume") : qsTr("Pause") |                           qsTr("Resume") : qsTr("Pause") | ||||||
|  |  | ||||||
|             onClicked: { |             onClicked: transfer.pause() | ||||||
|                 transfer.paused = ! transfer.paused |  | ||||||
|                 py.setattr( |  | ||||||
|                     model.monitor, "pause", transfer.paused, |  | ||||||
|                 ) |  | ||||||
|             } |  | ||||||
|  |  | ||||||
|             Layout.preferredWidth: |             Layout.preferredWidth: | ||||||
|                 status === "Uploading" ? |                 status === "Uploading" ? | ||||||
| @@ -147,21 +154,17 @@ HColumnLayout { | |||||||
|             icon.name: "upload-cancel" |             icon.name: "upload-cancel" | ||||||
|             icon.color: theme.colors.negativeBackground |             icon.color: theme.colors.negativeBackground | ||||||
|             padded: false |             padded: false | ||||||
|  |             onClicked: transfer.cancel() | ||||||
|             onClicked: { |  | ||||||
|                 // Python might take a sec to cancel, but we want |  | ||||||
|                 // immediate visual feedback |  | ||||||
|                 transfer.height = 0 |  | ||||||
|                 // Python will delete this model item on cancel |  | ||||||
|                 py.call(py.getattr(model.task, "cancel")) |  | ||||||
|             } |  | ||||||
|  |  | ||||||
|             Layout.preferredWidth: theme.baseElementsHeight |             Layout.preferredWidth: theme.baseElementsHeight | ||||||
|             Layout.fillHeight: true |             Layout.fillHeight: true | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         TapHandler { |         TapHandler { | ||||||
|             onTapped: if (status !== "Error") |             onTapped: { | ||||||
|                 statusLabel.expand = ! statusLabel.expand |                 if (status === "Error") { transfer.cancel() } | ||||||
|  |                 else { statusLabel.expand = ! statusLabel.expand } | ||||||
|  |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	