mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-24 12:05:21 -04:00
fix(network): show WiFi connection progress (#2684)
This commit is contained in:
@@ -565,6 +565,7 @@ Rectangle {
|
||||
required property int index
|
||||
|
||||
readonly property bool isConnected: modelData.ssid === NetworkService.currentWifiSSID
|
||||
readonly property bool isConnecting: NetworkService.isWifiConnecting && NetworkService.connectingSSID === modelData.ssid
|
||||
readonly property bool isPinned: root.getPinnedNetworks().includes(modelData.ssid)
|
||||
readonly property string networkName: modelData.ssid || I18n.tr("Unknown Network")
|
||||
readonly property int signalStrength: modelData.signal || 0
|
||||
@@ -583,7 +584,17 @@ Rectangle {
|
||||
anchors.leftMargin: Theme.spacingM
|
||||
spacing: Theme.spacingS
|
||||
|
||||
DankSpinner {
|
||||
size: Theme.iconSize - 4
|
||||
strokeWidth: 2
|
||||
color: Theme.warning
|
||||
running: wifiDelegate.isConnecting
|
||||
visible: wifiDelegate.isConnecting
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
DankIcon {
|
||||
visible: !wifiDelegate.isConnecting
|
||||
name: {
|
||||
if (wifiDelegate.signalStrength >= 50)
|
||||
return "wifi";
|
||||
@@ -603,7 +614,7 @@ Rectangle {
|
||||
StyledText {
|
||||
text: wifiDelegate.networkName
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
color: wifiDelegate.isConnected ? Theme.primary : Theme.surfaceText
|
||||
font.weight: wifiDelegate.isConnected ? Font.Medium : Font.Normal
|
||||
elide: Text.ElideRight
|
||||
width: parent.width
|
||||
@@ -613,9 +624,9 @@ Rectangle {
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
StyledText {
|
||||
text: wifiDelegate.isConnected ? I18n.tr("Connected") + " \u2022" : (modelData.secured ? I18n.tr("Secured") + " \u2022" : I18n.tr("Open") + " \u2022")
|
||||
text: wifiDelegate.isConnecting ? I18n.tr("Connecting...") + " \u2022" : (wifiDelegate.isConnected ? I18n.tr("Connected") + " \u2022" : (modelData.secured ? I18n.tr("Secured") + " \u2022" : I18n.tr("Open") + " \u2022"))
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
color: wifiDelegate.isConnecting ? Theme.warning : Theme.surfaceVariantText
|
||||
}
|
||||
|
||||
StyledText {
|
||||
@@ -651,6 +662,7 @@ Rectangle {
|
||||
networkContextMenu.currentSecured = modelData.secured;
|
||||
networkContextMenu.currentEnterprise = modelData.enterprise;
|
||||
networkContextMenu.currentConnected = wifiDelegate.isConnected;
|
||||
networkContextMenu.currentConnecting = wifiDelegate.isConnecting;
|
||||
networkContextMenu.currentSaved = modelData.saved;
|
||||
networkContextMenu.currentSignal = modelData.signal;
|
||||
networkContextMenu.currentAutoconnect = modelData.autoconnect || false;
|
||||
@@ -743,7 +755,8 @@ Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.rightMargin: optionsButton.width + pinWifiRow.width + (qrCodeButton.visible ? qrCodeButton.width : 0) + Theme.spacingS * 5 + Theme.spacingM
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
enabled: !NetworkService.isWifiConnecting || wifiDelegate.isConnected
|
||||
cursorShape: enabled ? Qt.PointingHandCursor : Qt.BusyCursor
|
||||
onPressed: mouse => wifiRipple.trigger(mouse.x, mouse.y)
|
||||
onClicked: function (event) {
|
||||
if (wifiDelegate.isConnected) {
|
||||
@@ -768,6 +781,7 @@ Rectangle {
|
||||
property bool currentSecured: false
|
||||
property bool currentEnterprise: false
|
||||
property bool currentConnected: false
|
||||
property bool currentConnecting: false
|
||||
property bool currentSaved: false
|
||||
property int currentSignal: 0
|
||||
property bool currentAutoconnect: false
|
||||
@@ -786,13 +800,14 @@ Rectangle {
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: networkContextMenu.currentConnected ? I18n.tr("Disconnect") : I18n.tr("Connect")
|
||||
text: networkContextMenu.currentConnecting ? I18n.tr("Connecting...") : (networkContextMenu.currentConnected ? I18n.tr("Disconnect") : I18n.tr("Connect"))
|
||||
height: 32
|
||||
enabled: !networkContextMenu.currentConnecting
|
||||
|
||||
contentItem: StyledText {
|
||||
text: parent.text
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceText
|
||||
color: parent.enabled ? Theme.surfaceText : Theme.surfaceVariantText
|
||||
leftPadding: Theme.spacingS
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user