From b874dfc9831413ec300e22502e513df042d8a59f Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Sun, 7 Jun 2026 00:02:10 +1000 Subject: [PATCH] refactor: move anim loader -> new component --- components/AnimLoader.qml | 40 +++++++++++++++++++++++++++++ modules/nexus/pages/NetworkPage.qml | 37 ++------------------------ 2 files changed, 42 insertions(+), 35 deletions(-) create mode 100644 components/AnimLoader.qml diff --git a/components/AnimLoader.qml b/components/AnimLoader.qml new file mode 100644 index 00000000..343dfa12 --- /dev/null +++ b/components/AnimLoader.qml @@ -0,0 +1,40 @@ +import QtQuick + +Loader { + id: root + + property Component sourceComp + property bool isComplete + + asynchronous: true + Component.onCompleted: { + isComplete = true; + sourceComponent = sourceComp; + } + onSourceCompChanged: { + if (isComplete) + anim.restart(); + } + + SequentialAnimation { + id: anim + + running: false + + Anim { + target: root + property: "opacity" + to: 0 + type: Anim.FastEffects + } + ScriptAction { + script: root.sourceComponent = root.sourceComp + } + Anim { + target: root + property: "opacity" + to: 1 + type: Anim.DefaultEffects + } + } +} diff --git a/modules/nexus/pages/NetworkPage.qml b/modules/nexus/pages/NetworkPage.qml index 219266b3..f32b854b 100644 --- a/modules/nexus/pages/NetworkPage.qml +++ b/modules/nexus/pages/NetworkPage.qml @@ -169,8 +169,6 @@ PageBase { id: network required property Nmcli.AccessPoint modelData - readonly property Component rightComp: Nmcli.connectingSsid() === modelData.ssid ? loadingComp : iconComp - property bool isComplete property bool currentSelected property real textOpacity: disabled ? 0.5 : 1 @@ -190,12 +188,6 @@ PageBase { } } - Component.onCompleted: isComplete = true - onRightCompChanged: { - if (isComplete) - rightCompAnim.restart(); - } - Behavior on textOpacity { Anim { type: Anim.DefaultEffects @@ -220,28 +212,6 @@ PageBase { target: root } - SequentialAnimation { - id: rightCompAnim - - running: false - - Anim { - target: rightLoader - property: "opacity" - to: 0 - type: Anim.FastEffects - } - ScriptAction { - script: rightLoader.sourceComponent = network.rightComp - } - Anim { - target: rightLoader - property: "opacity" - to: 1 - type: Anim.DefaultEffects - } - } - RowLayout { id: networkLayout @@ -279,11 +249,8 @@ PageBase { } } - Loader { - id: rightLoader - - asynchronous: true - sourceComponent: iconComp + AnimLoader { + sourceComp: Nmcli.connectingSsid() === network.modelData.ssid ? loadingComp : iconComp Component { id: iconComp