Settings: cleanup Network tab
This commit is contained in:
parent
a7e40e643b
commit
09706ccb28
1 changed files with 45 additions and 187 deletions
|
|
@ -6,223 +6,81 @@ import Quickshell.Bluetooth
|
||||||
import qs.Components
|
import qs.Components
|
||||||
import qs.Settings
|
import qs.Settings
|
||||||
|
|
||||||
ScrollView {
|
ColumnLayout {
|
||||||
anchors.fill: parent
|
id: root
|
||||||
padding: 0
|
|
||||||
rightPadding: 12
|
spacing: 0
|
||||||
clip: true
|
anchors.fill: parent
|
||||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
anchors.margins: 0
|
||||||
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
|
||||||
|
ScrollView {
|
||||||
|
id: scrollView
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
id: root
|
|
||||||
width: parent.availableWidth
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
spacing: 24
|
padding: 16
|
||||||
Component.onCompleted: {
|
rightPadding: 12
|
||||||
Quickshell.execDetached(["nmcli", "-t", "-f", "WIFI", "radio"]);
|
clip: true
|
||||||
}
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||||
|
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
spacing: 16
|
width: scrollView.availableWidth
|
||||||
Layout.fillWidth: true
|
spacing: 0
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: "Wi-Fi"
|
text: "Wi-Fi"
|
||||||
font.pixelSize: 18 * Theme.uiScale
|
font.pixelSize: 18 * Theme.uiScale
|
||||||
font.bold: true
|
font.bold: true
|
||||||
color: Theme.textPrimary
|
color: Theme.textPrimary
|
||||||
|
Layout.bottomMargin: 16 * Theme.uiScale
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ToggleOption {
|
||||||
spacing: 8
|
label: "Enable Wi-Fi"
|
||||||
Layout.fillWidth: true
|
description: "Turn Wi-Fi radio on or off"
|
||||||
|
value: Settings.settings.wifiEnabled
|
||||||
RowLayout {
|
onToggled: function() {
|
||||||
spacing: 8
|
Settings.settings.wifiEnabled = !Settings.settings.wifiEnabled;
|
||||||
Layout.fillWidth: true
|
Quickshell.execDetached(["nmcli", "radio", "wifi", Settings.settings.wifiEnabled ? "on" : "off"]);
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
spacing: 4
|
|
||||||
Layout.fillWidth: true
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: "Enable Wi-Fi"
|
|
||||||
font.pixelSize: 13 * Theme.uiScale
|
|
||||||
font.bold: true
|
|
||||||
color: Theme.textPrimary
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: "Turn Wi-Fi radio on or off"
|
|
||||||
font.pixelSize: 12 * Theme.uiScale
|
|
||||||
color: Theme.textSecondary
|
|
||||||
wrapMode: Text.WordWrap
|
|
||||||
Layout.fillWidth: true
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: wifiSwitch
|
|
||||||
|
|
||||||
property bool checked: Settings.settings.wifiEnabled
|
|
||||||
|
|
||||||
width: 52
|
|
||||||
height: 32
|
|
||||||
radius: 16
|
|
||||||
color: checked ? Theme.accentPrimary : Theme.surfaceVariant
|
|
||||||
border.color: checked ? Theme.accentPrimary : Theme.outline
|
|
||||||
border.width: 2
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: wifiThumb
|
|
||||||
|
|
||||||
width: 28
|
|
||||||
height: 28
|
|
||||||
radius: 14
|
|
||||||
color: Theme.surface
|
|
||||||
border.color: Theme.outline
|
|
||||||
border.width: 1
|
|
||||||
y: 2
|
|
||||||
x: wifiSwitch.checked ? wifiSwitch.width - width - 2 : 2
|
|
||||||
|
|
||||||
Behavior on x {
|
|
||||||
NumberAnimation {
|
|
||||||
duration: 200
|
|
||||||
easing.type: Easing.OutCubic
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
onClicked: {
|
|
||||||
Settings.settings.wifiEnabled = !Settings.settings.wifiEnabled;
|
|
||||||
Quickshell.execDetached(["nmcli", "radio", "wifi", Settings.settings.wifiEnabled ? "on" : "off"]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
// Separator
|
||||||
|
Rectangle {
|
||||||
Rectangle {
|
Layout.fillWidth: true
|
||||||
Layout.fillWidth: true
|
Layout.topMargin: 26
|
||||||
Layout.topMargin: 26
|
Layout.bottomMargin: 18
|
||||||
Layout.bottomMargin: 0
|
height: 1
|
||||||
height: 1
|
color: Theme.outline
|
||||||
color: Theme.outline
|
opacity: 0.3
|
||||||
opacity: 0.3
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
spacing: 16
|
|
||||||
Layout.fillWidth: true
|
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: "Bluetooth"
|
text: "Bluetooth"
|
||||||
font.pixelSize: 18 * Theme.uiScale
|
font.pixelSize: 18 * Theme.uiScale
|
||||||
font.bold: true
|
font.bold: true
|
||||||
color: Theme.textPrimary
|
color: Theme.textPrimary
|
||||||
|
Layout.bottomMargin: 16 * Theme.uiScale
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ToggleOption {
|
||||||
spacing: 8
|
label: "Enable Bluetooth"
|
||||||
Layout.fillWidth: true
|
description: "Turn Bluetooth radio on or off"
|
||||||
|
value: Settings.settings.bluetoothEnabled
|
||||||
RowLayout {
|
onToggled: function() {
|
||||||
spacing: 8
|
if (Bluetooth.defaultAdapter) {
|
||||||
Layout.fillWidth: true
|
Settings.settings.bluetoothEnabled = !Settings.settings.bluetoothEnabled;
|
||||||
|
Bluetooth.defaultAdapter.enabled = Settings.settings.bluetoothEnabled;
|
||||||
ColumnLayout {
|
if (Bluetooth.defaultAdapter.enabled)
|
||||||
spacing: 4
|
Bluetooth.defaultAdapter.discovering = true;
|
||||||
Layout.fillWidth: true
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: "Enable Bluetooth"
|
|
||||||
font.pixelSize: 13 * Theme.uiScale
|
|
||||||
font.bold: true
|
|
||||||
color: Theme.textPrimary
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: "Turn Bluetooth radio on or off"
|
|
||||||
font.pixelSize: 12 * Theme.uiScale
|
|
||||||
color: Theme.textSecondary
|
|
||||||
wrapMode: Text.WordWrap
|
|
||||||
Layout.fillWidth: true
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: bluetoothSwitch
|
|
||||||
|
|
||||||
property bool checked: Settings.settings.bluetoothEnabled
|
|
||||||
|
|
||||||
width: 52
|
|
||||||
height: 32
|
|
||||||
radius: 16
|
|
||||||
color: checked ? Theme.accentPrimary : Theme.surfaceVariant
|
|
||||||
border.color: checked ? Theme.accentPrimary : Theme.outline
|
|
||||||
border.width: 2
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: bluetoothThumb
|
|
||||||
|
|
||||||
width: 28
|
|
||||||
height: 28
|
|
||||||
radius: 14
|
|
||||||
color: Theme.surface
|
|
||||||
border.color: Theme.outline
|
|
||||||
border.width: 1
|
|
||||||
y: 2
|
|
||||||
x: bluetoothSwitch.checked ? bluetoothSwitch.width - width - 2 : 2
|
|
||||||
|
|
||||||
Behavior on x {
|
|
||||||
NumberAnimation {
|
|
||||||
duration: 200
|
|
||||||
easing.type: Easing.OutCubic
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
onClicked: {
|
|
||||||
if (Bluetooth.defaultAdapter) {
|
|
||||||
Settings.settings.bluetoothEnabled = !Settings.settings.bluetoothEnabled;
|
|
||||||
Bluetooth.defaultAdapter.enabled = Settings.settings.bluetoothEnabled;
|
|
||||||
if (Bluetooth.defaultAdapter.enabled)
|
|
||||||
Bluetooth.defaultAdapter.discovering = true;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.fillHeight: true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue