diff --git a/TODO.md b/TODO.md index de2360dc..b42f6147 100644 --- a/TODO.md +++ b/TODO.md @@ -21,7 +21,7 @@ - Create room tabs brutal size transition - Refactoring - - Use `.pragma library` for utils.js + - Use a singleton for utils.js - Room header elide detection - Use HBox for Profile - Banners diff --git a/src/icons/thin/upload-cancel.svg b/src/icons/thin/upload-cancel.svg new file mode 100644 index 00000000..e4728028 --- /dev/null +++ b/src/icons/thin/upload-cancel.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/thin/upload-pause.svg b/src/icons/thin/upload-pause.svg new file mode 100644 index 00000000..85180f87 --- /dev/null +++ b/src/icons/thin/upload-pause.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/icons/thin/upload-resume.svg b/src/icons/thin/upload-resume.svg new file mode 100644 index 00000000..721df82d --- /dev/null +++ b/src/icons/thin/upload-resume.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/qml/Base/HIcon.qml b/src/qml/Base/HIcon.qml index 87f36d4b..c7ffa4bc 100644 --- a/src/qml/Base/HIcon.qml +++ b/src/qml/Base/HIcon.qml @@ -29,5 +29,7 @@ Image { layer.effect: ColorOverlay { color: icon.colorize cached: icon.cache + + Behavior on color { HColorAnimation {} } } } diff --git a/src/qml/Base/HProgressBar.qml b/src/qml/Base/HProgressBar.qml index c4ed44b0..432c78fd 100644 --- a/src/qml/Base/HProgressBar.qml +++ b/src/qml/Base/HProgressBar.qml @@ -24,6 +24,8 @@ ProgressBar { height: parent.height color: foregroundColor + Behavior on color { HColorAnimation {} } + XAnimator on x { running: bar.indeterminate duration: theme.animationDuration * 8 diff --git a/src/qml/Chat/UploadsBar.qml b/src/qml/Chat/UploadsBar.qml index 1c570e24..f14e6bcf 100644 --- a/src/qml/Chat/UploadsBar.qml +++ b/src/qml/Chat/UploadsBar.qml @@ -35,6 +35,11 @@ Rectangle { id: delegate width: uploadsList.width + property bool guiPaused: false + + readonly property bool paused: + model.status === "Paused" || guiPaused + Behavior on height { HNumberAnimation {} } Binding { @@ -47,7 +52,7 @@ Rectangle { HRowLayout { HButton { - icon.name: "cancel" + icon.name: "upload-cancel" icon.color: theme.colors.negativeBackground padded: false @@ -166,6 +171,34 @@ Rectangle { Behavior on Layout.preferredWidth { HNumberAnimation {} } } + HButton { + visible: Layout.preferredWidth > 0 + padded: false + + icon.name: delegate.paused ? + "upload-resume" : "upload-pause" + + icon.color: delegate.paused ? + theme.colors.positiveBackground : + theme.colors.middleBackground + + toolTip.text: delegate.paused ? + qsTr("Resume") : qsTr("Pause") + + onClicked: { + delegate.guiPaused = ! delegate.guiPaused + // py.ev("model.task. TODO + } + + Layout.preferredWidth: + model.status === "Uploading" ? + theme.baseElementsHeight : 0 + + Layout.fillHeight: true + + Behavior on Layout.preferredWidth { HNumberAnimation {} } + } + TapHandler { onTapped: if (model.status !== "Error") statusLabel.expand = ! statusLabel.expand @@ -179,9 +212,14 @@ Rectangle { value: model.uploaded to: model.total_size + // TODO: bake this in hprogressbar foregroundColor: model.status === "Error" ? theme.controls.progressBar.errorForeground : + + delegate.paused ? + theme.controls.progressBar.pausedForeground : + theme.controls.progressBar.foreground Layout.fillWidth: true