diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2021-07-10 17:21:15 +0200 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2021-07-10 17:21:15 +0200 |
commit | d61a9c718a36268d927b140712708952cabf329f (patch) | |
tree | 46a9f2645539ed767f5b1cd08db34525955760bb /resources/qml | |
parent | Fix lint (diff) | |
download | nheko-d61a9c718a36268d927b140712708952cabf329f.tar.xz |
Fix high CPU usage when a room is open
Diffstat (limited to 'resources/qml')
-rw-r--r-- | resources/qml/MessageView.qml | 2 | ||||
-rw-r--r-- | resources/qml/TimelineView.qml | 3 | ||||
-rw-r--r-- | resources/qml/TopBar.qml | 4 | ||||
-rw-r--r-- | resources/qml/ui/Spinner.qml | 46 | ||||
-rw-r--r-- | resources/qml/ui/animations/BlinkAnimation.qml | 14 |
5 files changed, 34 insertions, 35 deletions
diff --git a/resources/qml/MessageView.qml b/resources/qml/MessageView.qml index 16c92ebf..260bc9da 100644 --- a/resources/qml/MessageView.qml +++ b/resources/qml/MessageView.qml @@ -5,7 +5,6 @@ import "./delegates" import "./emoji" import "./ui" - import Qt.labs.platform 1.1 as Platform import QtGraphicalEffects 1.0 import QtQuick 2.12 @@ -413,6 +412,7 @@ ScrollView { visible: chat.model && chat.model.paginationInProgress z: 3 } + } Platform.Menu { diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index 46317b2c..148a5817 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -6,9 +6,8 @@ import "./components" import "./delegates" import "./device-verification" import "./emoji" -import "./voip" import "./ui" - +import "./voip" import Qt.labs.platform 1.1 as Platform import QtGraphicalEffects 1.0 import QtQuick 2.9 diff --git a/resources/qml/TopBar.qml b/resources/qml/TopBar.qml index 82373023..58aba0c7 100644 --- a/resources/qml/TopBar.qml +++ b/resources/qml/TopBar.qml @@ -65,9 +65,9 @@ Rectangle { url: avatarUrl.replace("mxc://", "image://MxcImage/") displayName: roomName onClicked: { - if (room) { + if (room) room.openRoomSettings(); - } + } } diff --git a/resources/qml/ui/Spinner.qml b/resources/qml/ui/Spinner.qml index a1a09a6a..f94c5539 100644 --- a/resources/qml/ui/Spinner.qml +++ b/resources/qml/ui/Spinner.qml @@ -2,10 +2,9 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -import QtQuick 2.12 -import QtGraphicalEffects 1.12 - import "./animations" +import QtGraphicalEffects 1.12 +import QtQuick 2.12 Item { id: spinner @@ -76,48 +75,62 @@ Item { BlinkAnimation { id: anim1 + target: rect1 + running: spinner.running pauseDuration: spinner.pauseDuration glowDuration: spinner.glowDuration - - loops: Animation.Infinite + offset: 0 / spinner.barCount } BlinkAnimation { id: anim2 + target: rect2 + running: spinner.running pauseDuration: spinner.pauseDuration glowDuration: spinner.glowDuration + offset: 1 / spinner.barCount } BlinkAnimation { id: anim3 + target: rect3 + running: spinner.running pauseDuration: spinner.pauseDuration glowDuration: spinner.glowDuration - + offset: 2 / spinner.barCount } BlinkAnimation { id: anim4 + target: rect4 + running: spinner.running pauseDuration: spinner.pauseDuration glowDuration: spinner.glowDuration - + offset: 3 / spinner.barCount } BlinkAnimation { id: anim5 + target: rect5 + running: spinner.running pauseDuration: spinner.pauseDuration glowDuration: spinner.glowDuration + offset: 4 / spinner.barCount } BlinkAnimation { id: anim6 + target: rect6 + running: spinner.running pauseDuration: spinner.pauseDuration glowDuration: spinner.glowDuration + offset: 5 / spinner.barCount } transform: Matrix4x4 { @@ -126,25 +139,6 @@ Item { } - Timer { - // ----- Private Properties ----- // - property int _barIndex: 0 - - interval: 80 - repeat: true - running: spinner.running - onTriggered: { - if (_barIndex === spinner.barCount) { - _barIndex = 0; - stop(); - } else { - anims[_barIndex].start(); - _barIndex++; - } - } - Component.onCompleted: start() - } - Glow { anchors.fill: row radius: 14 diff --git a/resources/qml/ui/animations/BlinkAnimation.qml b/resources/qml/ui/animations/BlinkAnimation.qml index 73991a1f..3d6fbd31 100644 --- a/resources/qml/ui/animations/BlinkAnimation.qml +++ b/resources/qml/ui/animations/BlinkAnimation.qml @@ -2,25 +2,31 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -import QtQuick 2.12 import QtGraphicalEffects 1.12 +import QtQuick 2.12 SequentialAnimation { property alias target: numberAnimation.target property alias glowDuration: numberAnimation.duration - property alias pauseDuration: pauseAnimation.duration + property int pauseDuration: 150 + property double offset: 0 loops: Animation.Infinite + PauseAnimation { + duration: pauseDuration * offset + } + NumberAnimation { id: numberAnimation + property: "opacity" from: 0 to: 1 } PauseAnimation { - id: pauseAnimation + duration: pauseDuration * (1 - offset) } -} \ No newline at end of file +} |