Skip to content

Commit

Permalink
Avoid drawing invisible animations
Browse files Browse the repository at this point in the history
  • Loading branch information
emericg committed Jun 29, 2022
1 parent 2c107a2 commit d7171b6
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions qml/DeviceWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,14 @@ Item {
if (!boxDevice.isDataToday()) {
if (boxDevice.status === DeviceUtils.DEVICE_QUEUED) {
imageStatus.source = "qrc:/assets/icons_material/duotone-settings_bluetooth-24px.svg"
refreshAnimation.running = false
} else if (boxDevice.status === DeviceUtils.DEVICE_CONNECTING) {
imageStatus.source = "qrc:/assets/icons_material/duotone-bluetooth_searching-24px.svg"
refreshAnimation.running = true
} else if (boxDevice.status === DeviceUtils.DEVICE_CONNECTED) {
imageStatus.source = "qrc:/assets/icons_material/duotone-bluetooth_connected-24px.svg"
refreshAnimation.running = true
} else if (boxDevice.status >= DeviceUtils.DEVICE_WORKING) {
imageStatus.source = "qrc:/assets/icons_material/duotone-bluetooth_connected-24px.svg"
refreshAnimation.running = true
} else {
imageStatus.source = "qrc:/assets/icons_material/baseline-bluetooth_disabled-24px.svg"
refreshAnimation.running = false
}
}
}
Expand Down Expand Up @@ -436,7 +431,8 @@ Item {
id: opa
loops: Animation.Infinite
alwaysRunToEnd: true
running: (boxDevice.status !== DeviceUtils.DEVICE_OFFLINE &&
running: (visible &&
boxDevice.status !== DeviceUtils.DEVICE_OFFLINE &&
boxDevice.status !== DeviceUtils.DEVICE_QUEUED &&
boxDevice.status !== DeviceUtils.DEVICE_CONNECTED)

Expand Down Expand Up @@ -500,7 +496,7 @@ Item {
color: parent.color

SequentialAnimation on opacity {
running: alarmVentilate.visible
running: visible
loops: Animation.Infinite

PropertyAnimation { to: 0; duration: 1000; }
Expand Down Expand Up @@ -529,7 +525,7 @@ Item {
color: Qt.lighter(parent.color, 1.66)

SequentialAnimation on opacity {
running: alarmRadiation.visible
running: visible
alwaysRunToEnd: true
loops: Animation.Infinite

Expand Down Expand Up @@ -609,7 +605,10 @@ Item {
SequentialAnimation on opacity {
id: refreshAnimation
loops: Animation.Infinite
running: false
running: (visible &&
boxDevice.status === DeviceUtils.DEVICE_CONNECTING ||
boxDevice.status === DeviceUtils.DEVICE_CONNECTED ||
boxDevice.status === DeviceUtils.DEVICE_WORKING)
alwaysRunToEnd: true
OpacityAnimator { from: 0.8; to: 0; duration: 750 }
OpacityAnimator { from: 0; to: 0.8; duration: 750 }
Expand Down

0 comments on commit d7171b6

Please sign in to comment.