Color upload icon but not text on pause/error

This commit is contained in:
miruka 2019-12-06 18:37:18 -04:00
parent 74efce589b
commit 737e102629

View File

@ -7,14 +7,15 @@ HColumnLayout {
id: transfer id: transfer
property bool guiPaused: false property bool paused: false
property int msLeft: model.time_left || 0 property int msLeft: model.time_left || 0
property int uploaded: model.uploaded property int uploaded: model.uploaded
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
readonly property bool paused: status === "Paused" || guiPaused property var pr: status
onPrChanged: print("pr changed:", pr)
Behavior on msLeft { HNumberAnimation { duration: 1000 } } Behavior on msLeft { HNumberAnimation { duration: 1000 } }
@ -25,8 +26,8 @@ HColumnLayout {
HIcon { HIcon {
svgName: "uploading" svgName: "uploading"
colorize: colorize:
status === "Error" ? theme.colors.negativeBackground : transfer.status === "Error" ? theme.colors.negativeBackground :
status === "Paused" ? theme.colors.middleBackground : transfer.paused ? theme.colors.middleBackground :
theme.icons.colorize theme.icons.colorize
Layout.preferredWidth: theme.baseElementsHeight Layout.preferredWidth: theme.baseElementsHeight
@ -38,9 +39,6 @@ HColumnLayout {
elide: expand ? Text.ElideNone : Text.ElideRight elide: expand ? Text.ElideNone : Text.ElideRight
wrapMode: expand ? Text.Wrap : Text.NoWrap wrapMode: expand ? Text.Wrap : Text.NoWrap
color: status === "Error" ?
theme.colors.errorText : theme.colors.text
text: text:
status === "Uploading" ? fileName : status === "Uploading" ? fileName :
@ -131,9 +129,9 @@ HColumnLayout {
qsTr("Resume") : qsTr("Pause") qsTr("Resume") : qsTr("Pause")
onClicked: { onClicked: {
transfer.guiPaused = ! transfer.guiPaused transfer.paused = ! transfer.paused
py.setattr( py.setattr(
model.monitor, "pause", transfer.guiPaused, model.monitor, "pause", transfer.paused,
) )
} }