The card used its own padding and packed rows at the top while the block stretched it beside the tiles. It now uses tile metrics and grows its gaps, so each row meets a tile's toggle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
98 lines
3.5 KiB
QML
98 lines
3.5 KiB
QML
pragma ComponentBehavior: Bound
|
|
import QtQuick
|
|
import QtQuick.Layouts
|
|
import ".."
|
|
import "../../services"
|
|
import "../../core"
|
|
import "../../theme"
|
|
|
|
// Wi-Fi, Bluetooth and live throughput; labels open the matching Settings page.
|
|
ControlCard {
|
|
id: root
|
|
// Tile metrics, so rows line up with the small tiles beside this card: when
|
|
// the block stretches it, the gaps grow and each row meets a tile's toggle.
|
|
readonly property int rowHeight: 34
|
|
padding: 10
|
|
implicitHeight: 3 * rowHeight + 2 * 10 + 2 * padding
|
|
spacing: Math.max(10, (root.height - 2 * root.padding - 3 * root.rowHeight) / 2)
|
|
Demand {
|
|
service: MetricsService
|
|
}
|
|
component Entry: RowLayout {
|
|
id: entry
|
|
property alias toggle: toggle
|
|
property string title
|
|
property string detail
|
|
property string page
|
|
Layout.fillWidth: true
|
|
Layout.preferredHeight: toggle.size
|
|
spacing: 10
|
|
CCToggle {
|
|
id: toggle
|
|
}
|
|
Item {
|
|
Layout.fillWidth: true
|
|
implicitHeight: labels.implicitHeight
|
|
ColumnLayout {
|
|
id: labels
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
spacing: 0
|
|
Text {
|
|
text: entry.title
|
|
color: Theme.text
|
|
font.pixelSize: 12
|
|
font.weight: Font.DemiBold
|
|
elide: Text.ElideRight
|
|
Layout.fillWidth: true
|
|
}
|
|
Text {
|
|
text: entry.detail
|
|
color: Theme.textSecondary
|
|
font.pixelSize: 11
|
|
elide: Text.ElideRight
|
|
Layout.fillWidth: true
|
|
}
|
|
}
|
|
MouseArea {
|
|
anchors.fill: parent
|
|
cursorShape: Qt.PointingHandCursor
|
|
onClicked: ShellState.openSettings(entry.page)
|
|
}
|
|
}
|
|
}
|
|
Entry {
|
|
title: "Wi-Fi"
|
|
detail: !NetworkService.available ? "No Wi-Fi adapter" : !NetworkService.backend.wifiHardwareEnabled ? "Hardware blocked" : NetworkService.enabled ? NetworkService.summary : "Off"
|
|
page: "network"
|
|
toggle.objectName: "wifiToggle"
|
|
toggle.glyph: NetworkService.enabled ? "" : ""
|
|
toggle.fallback: "W"
|
|
toggle.checked: NetworkService.available && NetworkService.enabled
|
|
toggle.enabled: NetworkService.available && NetworkService.backend.wifiHardwareEnabled
|
|
toggle.onClicked: NetworkService.toggle()
|
|
toggle.Accessible.name: "Wi-Fi"
|
|
}
|
|
Entry {
|
|
title: "Bluetooth"
|
|
detail: !BluetoothService.adapter ? "No adapter" : !BluetoothService.canToggle ? "Hardware blocked" : BluetoothService.summary
|
|
page: "bluetooth"
|
|
toggle.objectName: "bluetoothToggle"
|
|
toggle.glyph: BluetoothService.enabled ? "" : ""
|
|
toggle.fallback: "B"
|
|
toggle.checked: BluetoothService.enabled
|
|
toggle.enabled: BluetoothService.canToggle
|
|
toggle.onClicked: BluetoothService.toggle()
|
|
toggle.Accessible.name: "Bluetooth"
|
|
}
|
|
Entry {
|
|
title: "Network"
|
|
detail: "↓ " + MetricsService.bytes(MetricsService.network.download) + "/s ↑ " + MetricsService.bytes(MetricsService.network.upload) + "/s"
|
|
page: "metrics"
|
|
toggle.glyph: ""
|
|
toggle.fallback: "N"
|
|
toggle.onClicked: ShellState.openSettings("network")
|
|
toggle.Accessible.name: "Network settings"
|
|
}
|
|
}
|