mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-30 00:12:50 -05:00
correctly represent network details
This commit is contained in:
@@ -89,54 +89,25 @@ DankModal {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Flickable {
|
DankFlickable {
|
||||||
|
id: flickableArea
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height - 140
|
height: parent.height - 140
|
||||||
clip: true
|
clip: true
|
||||||
contentWidth: width
|
contentWidth: width
|
||||||
contentHeight: detailsRect.height
|
contentHeight: detailsRect.height
|
||||||
|
|
||||||
// Qt 6.9+ scrolling: flickDeceleration/maximumFlickVelocity only affect touch now
|
|
||||||
interactive: true
|
|
||||||
flickDeceleration: 1500
|
|
||||||
maximumFlickVelocity: 2000
|
|
||||||
boundsBehavior: Flickable.DragAndOvershootBounds
|
|
||||||
boundsMovement: Flickable.FollowBoundsBehavior
|
|
||||||
pressDelay: 0
|
|
||||||
flickableDirection: Flickable.VerticalFlick
|
|
||||||
|
|
||||||
// Custom wheel handler for Qt 6.9+ responsive mouse wheel scrolling
|
|
||||||
WheelHandler {
|
|
||||||
acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad
|
|
||||||
onWheel: event => {
|
|
||||||
let delta = event.pixelDelta.y
|
|
||||||
!== 0 ? event.pixelDelta.y
|
|
||||||
* 1.8 : event.angleDelta.y / 120 * 60
|
|
||||||
let newY = parent.contentY - delta
|
|
||||||
newY = Math.max(
|
|
||||||
0, Math.min(
|
|
||||||
parent.contentHeight - parent.height,
|
|
||||||
newY))
|
|
||||||
parent.contentY = newY
|
|
||||||
event.accepted = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: detailsRect
|
id: detailsRect
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: Math.max(
|
height: detailsText.contentHeight + Theme.spacingM * 2
|
||||||
parent.parent.height,
|
|
||||||
detailsText.contentHeight + Theme.spacingM * 2)
|
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
color: Theme.surfaceHover
|
color: Theme.surfaceHover
|
||||||
border.color: Theme.outlineStrong
|
border.color: Theme.outlineStrong
|
||||||
border.width: 1
|
border.width: 1
|
||||||
|
|
||||||
StyledText {
|
TextArea {
|
||||||
id: detailsText
|
id: detailsText
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Theme.spacingM
|
anchors.margins: Theme.spacingM
|
||||||
text: NetworkService.networkInfoDetails.replace(
|
text: NetworkService.networkInfoDetails.replace(
|
||||||
@@ -145,17 +116,12 @@ DankModal {
|
|||||||
font.pixelSize: Theme.fontSizeMedium
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
color: Theme.surfaceText
|
color: Theme.surfaceText
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
lineHeight: 1.5
|
readOnly: true
|
||||||
|
selectByMouse: true
|
||||||
|
background: null
|
||||||
|
padding: 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollBar.vertical: ScrollBar {
|
|
||||||
policy: ScrollBar.AsNeeded
|
|
||||||
}
|
|
||||||
|
|
||||||
ScrollBar.horizontal: ScrollBar {
|
|
||||||
policy: ScrollBar.AlwaysOff
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
|||||||
@@ -848,7 +848,7 @@ Singleton {
|
|||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: wifiInfoFetcher
|
id: wifiInfoFetcher
|
||||||
command: ["nmcli", "-t", "-f", "SSID,SIGNAL,SECURITY,FREQ,RATE,MODE,CHAN,WPA-FLAGS,RSN-FLAGS", "dev", "wifi", "list"]
|
command: ["nmcli", "-t", "-f", "SSID,SIGNAL,SECURITY,FREQ,RATE,MODE,CHAN,WPA-FLAGS,RSN-FLAGS,ACTIVE,BSSID", "dev", "wifi", "list"]
|
||||||
running: false
|
running: false
|
||||||
|
|
||||||
stdout: StdioCollector {
|
stdout: StdioCollector {
|
||||||
@@ -856,19 +856,31 @@ Singleton {
|
|||||||
let details = ""
|
let details = ""
|
||||||
if (text.trim()) {
|
if (text.trim()) {
|
||||||
let lines = text.trim().split('\n')
|
let lines = text.trim().split('\n')
|
||||||
|
let bands = []
|
||||||
|
|
||||||
|
// Collect all access points for this SSID
|
||||||
for (let line of lines) {
|
for (let line of lines) {
|
||||||
let parts = line.split(':')
|
let parts = line.split(':')
|
||||||
if (parts.length >= 9
|
if (parts.length >= 11 && parts[0] === root.networkInfoSSID) {
|
||||||
&& parts[0] === root.networkInfoSSID) {
|
|
||||||
let ssid = parts[0] || "Unknown"
|
|
||||||
let signal = parts[1] || "0"
|
let signal = parts[1] || "0"
|
||||||
let security = parts[2] || "Open"
|
let security = parts[2] || "Open"
|
||||||
let freq = parts[3] || "Unknown"
|
let freq = parts[3] || "Unknown"
|
||||||
let rate = parts[4] || "Unknown"
|
let rate = parts[4] || "Unknown"
|
||||||
let mode = parts[5] || "Unknown"
|
|
||||||
let channel = parts[6] || "Unknown"
|
let channel = parts[6] || "Unknown"
|
||||||
let wpaFlags = parts[7] || ""
|
let isActive = parts[9] === "yes"
|
||||||
let rsnFlags = parts[8] || ""
|
// BSSID is the last field, find it by counting colons
|
||||||
|
let colonCount = 0
|
||||||
|
let bssidStart = -1
|
||||||
|
for (let i = 0; i < line.length; i++) {
|
||||||
|
if (line[i] === ':') {
|
||||||
|
colonCount++
|
||||||
|
if (colonCount === 10) {
|
||||||
|
bssidStart = i + 1
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let bssid = bssidStart >= 0 ? line.substring(bssidStart).replace(/\\:/g, ":") : ""
|
||||||
|
|
||||||
let band = "Unknown"
|
let band = "Unknown"
|
||||||
let freqNum = parseInt(freq)
|
let freqNum = parseInt(freq)
|
||||||
@@ -880,23 +892,39 @@ Singleton {
|
|||||||
band = "6 GHz"
|
band = "6 GHz"
|
||||||
}
|
}
|
||||||
|
|
||||||
details = "Network Name: " + ssid + "\\n"
|
bands.push({
|
||||||
details += "Signal Strength: " + signal + "%\\n"
|
band: band,
|
||||||
details += "Security: " + (security === "" ? "Open" : security) + "\\n"
|
freq: freq,
|
||||||
details += "Frequency: " + freq + " MHz\\n"
|
channel: channel,
|
||||||
details += "Band: " + band + "\\n"
|
signal: signal,
|
||||||
details += "Channel: " + channel + "\\n"
|
rate: rate,
|
||||||
details += "Mode: " + mode + "\\n"
|
security: security,
|
||||||
details += "Max Rate: " + rate + " Mbit/s\\n"
|
isActive: isActive,
|
||||||
|
bssid: bssid
|
||||||
if (wpaFlags !== "") {
|
})
|
||||||
details += "WPA Flags: " + wpaFlags + "\\n"
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bands.length > 0) {
|
||||||
|
// Sort bands: active first, then by signal strength
|
||||||
|
bands.sort((a, b) => {
|
||||||
|
if (a.isActive && !b.isActive) return -1
|
||||||
|
if (!a.isActive && b.isActive) return 1
|
||||||
|
return parseInt(b.signal) - parseInt(a.signal)
|
||||||
|
})
|
||||||
|
|
||||||
|
for (let i = 0; i < bands.length; i++) {
|
||||||
|
let b = bands[i]
|
||||||
|
if (b.isActive) {
|
||||||
|
details += "● " + b.band + " (Connected) - " + b.signal + "%\\n"
|
||||||
|
} else {
|
||||||
|
details += " " + b.band + " - " + b.signal + "%\\n"
|
||||||
}
|
}
|
||||||
if (rsnFlags !== "") {
|
details += " Channel " + b.channel + " (" + b.freq + " MHz) • " + b.rate + " Mbit/s\\n"
|
||||||
details += "RSN Flags: " + rsnFlags + "\\n"
|
details += " " + b.bssid
|
||||||
|
if (i < bands.length - 1) {
|
||||||
|
details += "\\n\\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user