Settings: some more refinments

This commit is contained in:
quadbyte 2025-08-06 20:11:33 -04:00
parent 63eeb40c64
commit 5388260020
3 changed files with 48 additions and 37 deletions

View file

@ -32,7 +32,7 @@ ColumnLayout {
ColumnLayout { ColumnLayout {
spacing: 4 spacing: 12
Layout.fillWidth: true Layout.fillWidth: true
Text { Text {

View file

@ -3,19 +3,17 @@ import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import Quickshell import Quickshell
import Quickshell.Bluetooth import Quickshell.Bluetooth
import qs.Settings
import qs.Components import qs.Components
import qs.Settings
ColumnLayout { ColumnLayout {
id: root id: root
spacing: 24 spacing: 24
Component.onCompleted: { Component.onCompleted: {
Quickshell.execDetached(["nmcli", "-t", "-f", "WIFI", "radio"]);
Quickshell.execDetached(["nmcli", "-t", "-f", "WIFI", "radio"])
} }
ColumnLayout { ColumnLayout {
spacing: 16 spacing: 16
Layout.fillWidth: true Layout.fillWidth: true
@ -53,20 +51,24 @@ ColumnLayout {
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
Layout.fillWidth: true Layout.fillWidth: true
} }
} }
Rectangle { Rectangle {
id: wifiSwitch id: wifiSwitch
property bool checked: Settings.settings.wifiEnabled
width: 52 width: 52
height: 32 height: 32
radius: 16 radius: 16
property bool checked: Settings.settings.wifiEnabled
color: checked ? Theme.accentPrimary : Theme.surfaceVariant color: checked ? Theme.accentPrimary : Theme.surfaceVariant
border.color: checked ? Theme.accentPrimary : Theme.outline border.color: checked ? Theme.accentPrimary : Theme.outline
border.width: 2 border.width: 2
Rectangle { Rectangle {
id: wifiThumb id: wifiThumb
width: 28 width: 28
height: 28 height: 28
radius: 14 radius: 14
@ -81,26 +83,32 @@ ColumnLayout {
duration: 200 duration: 200
easing.type: Easing.OutCubic easing.type: Easing.OutCubic
} }
} }
} }
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
Settings.settings.wifiEnabled = !Settings.settings.wifiEnabled Settings.settings.wifiEnabled = !Settings.settings.wifiEnabled;
Quickshell.execDetached(["nmcli", "radio", "wifi", Settings.settings.wifiEnabled ? "on" : "off"]) Quickshell.execDetached(["nmcli", "radio", "wifi", Settings.settings.wifiEnabled ? "on" : "off"]);
} }
} }
} }
} }
} }
} }
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
@ -143,20 +151,24 @@ ColumnLayout {
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
Layout.fillWidth: true Layout.fillWidth: true
} }
} }
Rectangle { Rectangle {
id: bluetoothSwitch id: bluetoothSwitch
property bool checked: Settings.settings.bluetoothEnabled
width: 52 width: 52
height: 32 height: 32
radius: 16 radius: 16
property bool checked: Settings.settings.bluetoothEnabled
color: checked ? Theme.accentPrimary : Theme.surfaceVariant color: checked ? Theme.accentPrimary : Theme.surfaceVariant
border.color: checked ? Theme.accentPrimary : Theme.outline border.color: checked ? Theme.accentPrimary : Theme.outline
border.width: 2 border.width: 2
Rectangle { Rectangle {
id: bluetoothThumb id: bluetoothThumb
width: 28 width: 28
height: 28 height: 28
radius: 14 radius: 14
@ -171,7 +183,9 @@ ColumnLayout {
duration: 200 duration: 200
easing.type: Easing.OutCubic easing.type: Easing.OutCubic
} }
} }
} }
MouseArea { MouseArea {
@ -179,22 +193,26 @@ ColumnLayout {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
if (Bluetooth.defaultAdapter) { if (Bluetooth.defaultAdapter) {
Settings.settings.bluetoothEnabled = !Settings.settings.bluetoothEnabled Settings.settings.bluetoothEnabled = !Settings.settings.bluetoothEnabled;
Bluetooth.defaultAdapter.enabled = Settings.settings.bluetoothEnabled Bluetooth.defaultAdapter.enabled = Settings.settings.bluetoothEnabled;
if (Bluetooth.defaultAdapter.enabled) { if (Bluetooth.defaultAdapter.enabled)
Bluetooth.defaultAdapter.discovering = true Bluetooth.defaultAdapter.discovering = true;
}
}
}
}
}
} }
} }
} }
}
}
}
}
Item { Item {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
} }
} }

View file

@ -37,7 +37,7 @@ ColumnLayout {
Layout.fillWidth: true Layout.fillWidth: true
Text { Text {
text: "Wallpaper" text: "Wallpaper Settings"
font.pixelSize: 18 font.pixelSize: 18
font.bold: true font.bold: true
color: Theme.textPrimary color: Theme.textPrimary
@ -48,14 +48,7 @@ ColumnLayout {
ColumnLayout { ColumnLayout {
spacing: 8 spacing: 8
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 16 Layout.topMargin: 8
Text {
text: "Wallpaper Settings"
font.pixelSize: 13
font.bold: true
color: Theme.textPrimary
}
// Wallpaper Folder // Wallpaper Folder
ColumnLayout { ColumnLayout {