summaryrefslogtreecommitdiff
path: root/raveos-sddm-theme/sddm-rave-theme/Components/NetworkIndicator.qml
diff options
context:
space:
mode:
authorNippy <nippy@Nippy-Mac-mini.local>2026-10-09 10:49:26 +0200
committerNippy <nippy@Nippy-Mac-mini.local>2026-10-09 10:49:26 +0200
commit91978706279a19a3ac96393630876f3e50cbc518 (patch)
tree1355da60486a305aefeea4e55543bbf1008715b3 /raveos-sddm-theme/sddm-rave-theme/Components/NetworkIndicator.qml
parent17a23f8a0cec5439d674d90c593497e4ceed2c68 (diff)
downloadRaveOS-PKGBUILD-91978706279a19a3ac96393630876f3e50cbc518.tar.gz
RaveOS-PKGBUILD-91978706279a19a3ac96393630876f3e50cbc518.zip
fix
Diffstat (limited to 'raveos-sddm-theme/sddm-rave-theme/Components/NetworkIndicator.qml')
-rw-r--r--raveos-sddm-theme/sddm-rave-theme/Components/NetworkIndicator.qml19
1 files changed, 0 insertions, 19 deletions
diff --git a/raveos-sddm-theme/sddm-rave-theme/Components/NetworkIndicator.qml b/raveos-sddm-theme/sddm-rave-theme/Components/NetworkIndicator.qml
index 6300841..07bf902 100644
--- a/raveos-sddm-theme/sddm-rave-theme/Components/NetworkIndicator.qml
+++ b/raveos-sddm-theme/sddm-rave-theme/Components/NetworkIndicator.qml
@@ -10,7 +10,6 @@ Row {
height: root.font.pointSize * 1.6
spacing: root.font.pointSize * 0.5
- // "none" | "wifi" | "ethernet"
property string netType: "none"
property int wifiQuality: 0 // 0-100
property string activeIface: ""
@@ -28,7 +27,6 @@ Row {
"enp0s3","enp0s31f6","ens33","ens3","ens18"
]
- // ── Fájl olvasó ──────────────────────────────────────────────────────────
function readFile(path, cb) {
var xhr = new XMLHttpRequest()
xhr.open("GET", "file://" + path, true)
@@ -42,16 +40,13 @@ Row {
xhr.send()
}
- // ── WiFi jelerősség /proc/net/wireless-ből ───────────────────────────────
function readWifiSignal(iface) {
readFile("/proc/net/wireless", function(content) {
if (!content) { wifiQuality = 60; netCanvas.requestPaint(); return }
var lines = content.split("\n")
for (var i = 0; i < lines.length; i++) {
if (lines[i].indexOf(iface + ":") !== -1) {
- // formátum: "wlan0: 0000 61. -49. -256 ..."
var parts = lines[i].trim().replace(/\./g,"").split(/\s+/)
- // parts[2] = link quality (0–70 tartomány általában)
var q = parseFloat(parts[2]) || 0
wifiQuality = Math.min(100, Math.round(q / 70 * 100))
break
@@ -61,7 +56,6 @@ Row {
})
}
- // ── Interfész keresők ────────────────────────────────────────────────────
function checkWifi(idx) {
if (idx >= wifiIfaces.length) { checkEth(0); return }
readFile("/sys/class/net/" + wifiIfaces[idx] + "/operstate", function(st) {
@@ -75,7 +69,6 @@ Row {
})
}
- // ── Ethernet keresés ─────────────────────────────────────────────────────
function checkEth(idx) {
if (idx >= ethIfaces.length) { netType = "none"; return }
readFile("/sys/class/net/" + ethIfaces[idx] + "/operstate", function(st) {
@@ -100,21 +93,18 @@ Row {
onTriggered: networkIndicator.refresh()
}
- // ── Szín ─────────────────────────────────────────────────────────────────
function signalColor(q) {
if (q >= 65) return "#4ade80" // zöld – erős
if (q >= 40) return "#facc15" // sárga – közepes
return "#fb923c" // narancs – gyenge
}
- // ── UI ───────────────────────────────────────────────────────────────────
Canvas {
id: netCanvas
width: root.font.pointSize * 2.0
height: root.font.pointSize * 1.6
anchors.verticalCenter: parent.verticalCenter
- // Qt Canvas nem támogatja ctx.roundRect() – saját helper
function rr(c, x, y, w, h, r) {
r = Math.min(Math.max(r, 0), Math.min(w, h) / 2)
c.beginPath()
@@ -136,14 +126,12 @@ Row {
drawEthernet(ctx)
}
- // ── WiFi antenna ikon (4 ívelt sáv) ─────────────────────────────
function drawWifi(ctx) {
var q = networkIndicator.wifiQuality
var cx = width / 2
var base = height * 0.96
var dot = height * 0.08
- // Sávok száma a minőség alapján
var bars = q >= 70 ? 4 : q >= 45 ? 3 : q >= 20 ? 2 : 1
var col = networkIndicator.signalColor(q)
@@ -161,7 +149,6 @@ Row {
ctx.stroke()
}
- // Középső pont (antenna)
ctx.beginPath()
ctx.arc(cx, base, dot, 0, Math.PI * 2)
ctx.fillStyle = col
@@ -170,7 +157,6 @@ Row {
ctx.globalAlpha = 1.0
}
- // ── Ethernet dugó ikon ───────────────────────────────────────────
function drawEthernet(ctx) {
var col = "#4ade80"
var lw = height * 0.09
@@ -184,7 +170,6 @@ Row {
var cx = width / 2
var cy = height / 2
- // Kábel test (felső téglalap)
var bw = width * 0.70
var bh = height * 0.38
var bx = cx - bw / 2
@@ -192,7 +177,6 @@ Row {
rr(ctx, bx, by, bw, bh, height * 0.06)
ctx.stroke()
- // 3 érintkező pin a téglalapban
var pinW = width * 0.08
var pinH = height * 0.22
var pinY = by - pinH + lw
@@ -202,13 +186,11 @@ Row {
ctx.fill()
}
- // Kábel vonala lefelé
ctx.beginPath()
ctx.moveTo(cx, by + bh)
ctx.lineTo(cx, cy + height * 0.38)
ctx.stroke()
- // Dugó alap vonal
ctx.lineWidth = lw * 1.5
ctx.beginPath()
ctx.moveTo(cx - width * 0.22, cy + height * 0.38)
@@ -219,7 +201,6 @@ Row {
}
}
- // Felirat
Text {
id: netLabel
anchors.verticalCenter: parent.verticalCenter