popouts/network: better rescan loading
This commit is contained in:
parent
b52822f3da
commit
f662717c0a
2 changed files with 27 additions and 15 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
import qs.services
|
||||||
import qs.config
|
import qs.config
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
|
|
@ -7,6 +8,9 @@ BusyIndicator {
|
||||||
|
|
||||||
property real implicitSize: Appearance.font.size.normal * 3
|
property real implicitSize: Appearance.font.size.normal * 3
|
||||||
property real strokeWidth: Appearance.padding.small
|
property real strokeWidth: Appearance.padding.small
|
||||||
|
property color fgColour: Colours.palette.m3primary
|
||||||
|
property color bgColour: Colours.palette.m3secondaryContainer
|
||||||
|
|
||||||
property real internalStrokeWidth: strokeWidth
|
property real internalStrokeWidth: strokeWidth
|
||||||
property string animState
|
property string animState
|
||||||
|
|
||||||
|
|
@ -48,6 +52,8 @@ BusyIndicator {
|
||||||
contentItem: CircularProgress {
|
contentItem: CircularProgress {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
strokeWidth: root.internalStrokeWidth
|
strokeWidth: root.internalStrokeWidth
|
||||||
|
fgColour: root.fgColour
|
||||||
|
bgColour: root.bgColour
|
||||||
padding: root.padding
|
padding: root.padding
|
||||||
startAngle: updater.startFraction * 360
|
startAngle: updater.startFraction * 360
|
||||||
value: updater.endFraction - updater.startFraction
|
value: updater.endFraction - updater.startFraction
|
||||||
|
|
|
||||||
|
|
@ -146,11 +146,11 @@ ColumnLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
implicitHeight: rescanBtn.implicitHeight + Appearance.padding.small * 2
|
implicitHeight: rescanBtn.implicitHeight + Appearance.padding.small * 2
|
||||||
|
|
||||||
radius: Appearance.rounding.normal
|
radius: Appearance.rounding.full
|
||||||
color: Network.scanning ? Colours.tPalette.m3surfaceContainer : Colours.palette.m3primaryContainer
|
color: Colours.palette.m3primaryContainer
|
||||||
|
|
||||||
StateLayer {
|
StateLayer {
|
||||||
color: Network.scanning ? Colours.palette.m3onSurface : Colours.palette.m3onPrimaryContainer
|
color: Colours.palette.m3onPrimaryContainer
|
||||||
disabled: Network.scanning || !Network.wifiEnabled
|
disabled: Network.scanning || !Network.wifiEnabled
|
||||||
|
|
||||||
function onClicked(): void {
|
function onClicked(): void {
|
||||||
|
|
@ -160,29 +160,35 @@ ColumnLayout {
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: rescanBtn
|
id: rescanBtn
|
||||||
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
spacing: Appearance.spacing.small
|
spacing: Appearance.spacing.small
|
||||||
|
opacity: Network.scanning ? 0 : 1
|
||||||
|
|
||||||
MaterialIcon {
|
MaterialIcon {
|
||||||
id: scanIcon
|
id: scanIcon
|
||||||
|
|
||||||
animate: true
|
animate: true
|
||||||
text: Network.scanning ? "refresh" : "wifi_find"
|
text: "wifi_find"
|
||||||
color: Network.scanning ? Colours.palette.m3onSurface : Colours.palette.m3onPrimaryContainer
|
color: Colours.palette.m3onPrimaryContainer
|
||||||
|
|
||||||
RotationAnimation on rotation {
|
|
||||||
running: Network.scanning
|
|
||||||
loops: Animation.Infinite
|
|
||||||
from: 0
|
|
||||||
to: 360
|
|
||||||
duration: 1000
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: Network.scanning ? qsTr("Scanning...") : qsTr("Rescan networks")
|
text: qsTr("Rescan networks")
|
||||||
color: Network.scanning ? Colours.palette.m3onSurface : Colours.palette.m3onPrimaryContainer
|
color: Colours.palette.m3onPrimaryContainer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledBusyIndicator {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
strokeWidth: Appearance.padding.small / 2
|
||||||
|
bgColour: "transparent"
|
||||||
|
implicitHeight: parent.implicitHeight - Appearance.padding.smaller * 2
|
||||||
|
running: Network.scanning
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue