Wrap image progress bars in loaders, fix cpu usage
This commit is contained in:
parent
2d501dca5a
commit
2cfe76fd8e
1
TODO.md
1
TODO.md
@ -59,7 +59,6 @@
|
||||
- Messed up message delegates position
|
||||
- Pausing uploads doesn't work well, servers end up dropping the connection
|
||||
- Quickly posting with another account leads to sync stop
|
||||
- CPU usage
|
||||
- `code` not colored in room subtitle
|
||||
- In the "Leave me" room, "join > Hi > left" aren't combined
|
||||
- Event delegates changing height don't scroll the list
|
||||
|
@ -45,7 +45,7 @@ Rectangle {
|
||||
HMxcImage {
|
||||
id: avatarImage
|
||||
anchors.fill: parent
|
||||
progressBar.visible: false
|
||||
showProgressBar: false
|
||||
visible: Boolean(sourceOverride || mxc)
|
||||
z: 2
|
||||
sourceSize.width: parent.width
|
||||
|
@ -14,7 +14,9 @@ Image {
|
||||
property bool broken: false
|
||||
property bool animate: true
|
||||
property bool animated: Utils.urlExtension(image.source) === "gif"
|
||||
property alias progressBar: progressBar
|
||||
|
||||
property alias showProgressBar: progressBarLoader.active
|
||||
property bool inderterminateProgressBar: false
|
||||
|
||||
|
||||
Component {
|
||||
@ -64,17 +66,21 @@ Image {
|
||||
sourceComponent: animate && animated ? animatedImageComponent : null
|
||||
}
|
||||
|
||||
HCircleProgressBar {
|
||||
id: progressBar
|
||||
HLoader {
|
||||
id: progressBarLoader
|
||||
anchors.centerIn: parent
|
||||
width: Math.min(parent.width, parent.height) * 0.5
|
||||
height: width
|
||||
visible: image.status === Image.Loading
|
||||
active: image.status === Image.Loading
|
||||
|
||||
sourceComponent: HCircleProgressBar {
|
||||
id: progressBar
|
||||
value: image.progress
|
||||
text: Math.round(value * 100) + "%"
|
||||
|
||||
Behavior on value { HNumberAnimation { factor: 2 } }
|
||||
}
|
||||
}
|
||||
|
||||
HIcon {
|
||||
anchors.centerIn: parent
|
||||
|
@ -2,7 +2,7 @@ import QtQuick 2.12
|
||||
|
||||
HImage {
|
||||
id: image
|
||||
progressBar.indeterminate: isMxc
|
||||
inderterminateProgressBar: isMxc
|
||||
source: sourceOverride || (show ? cachedPath : "")
|
||||
onWidthChanged: Qt.callLater(update)
|
||||
onHeightChanged: Qt.callLater(update)
|
||||
|
Loading…
Reference in New Issue
Block a user