Possible ram improvement, move settings into sidebar
This commit is contained in:
parent
61e852ed51
commit
3f6bc3414d
17 changed files with 795 additions and 2454 deletions
|
|
@ -102,6 +102,7 @@ Scope {
|
|||
}
|
||||
|
||||
NotificationIcon {
|
||||
shell: rootScope.shell
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
|
|
@ -135,12 +136,9 @@ Scope {
|
|||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
SettingsButton {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
PanelPopup {
|
||||
id: sidebarPopup
|
||||
shell: rootScope.shell
|
||||
}
|
||||
|
||||
Button {
|
||||
|
|
@ -151,8 +149,7 @@ Scope {
|
|||
}
|
||||
}
|
||||
|
||||
Background {}
|
||||
Overview {}
|
||||
|
||||
}
|
||||
|
||||
PanelWindow {
|
||||
|
|
|
|||
|
|
@ -55,14 +55,19 @@ Item {
|
|||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
bluetoothMenu.visible = !bluetoothMenu.visible;
|
||||
// Enable adapter and start discovery when menu opens
|
||||
if (bluetoothMenu.visible && Bluetooth.defaultAdapter) {
|
||||
if (!Bluetooth.defaultAdapter.enabled) {
|
||||
Bluetooth.defaultAdapter.enabled = true;
|
||||
}
|
||||
if (!Bluetooth.defaultAdapter.discovering) {
|
||||
Bluetooth.defaultAdapter.discovering = true;
|
||||
if (!bluetoothMenuLoader.active) {
|
||||
bluetoothMenuLoader.loading = true;
|
||||
}
|
||||
if (bluetoothMenuLoader.item) {
|
||||
bluetoothMenuLoader.item.visible = !bluetoothMenuLoader.item.visible;
|
||||
// Enable adapter and start discovery when menu opens
|
||||
if (bluetoothMenuLoader.item.visible && Bluetooth.defaultAdapter) {
|
||||
if (!Bluetooth.defaultAdapter.enabled) {
|
||||
Bluetooth.defaultAdapter.enabled = true;
|
||||
}
|
||||
if (!Bluetooth.defaultAdapter.discovering) {
|
||||
Bluetooth.defaultAdapter.discovering = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -80,190 +85,195 @@ Item {
|
|||
delay: 200
|
||||
}
|
||||
|
||||
PanelWindow {
|
||||
id: bluetoothMenu
|
||||
implicitWidth: 320
|
||||
implicitHeight: 480
|
||||
visible: false
|
||||
color: "transparent"
|
||||
anchors.top: true
|
||||
anchors.right: true
|
||||
margins.right: 0
|
||||
margins.top: 0
|
||||
WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand
|
||||
// LazyLoader for Bluetooth menu
|
||||
LazyLoader {
|
||||
id: bluetoothMenuLoader
|
||||
loading: false
|
||||
component: PanelWindow {
|
||||
id: bluetoothMenu
|
||||
implicitWidth: 320
|
||||
implicitHeight: 480
|
||||
visible: false
|
||||
color: "transparent"
|
||||
anchors.top: true
|
||||
anchors.right: true
|
||||
margins.right: 0
|
||||
margins.top: 0
|
||||
WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand
|
||||
|
||||
onVisibleChanged: {
|
||||
// Stop discovery when menu closes to save battery
|
||||
if (!visible && Bluetooth.defaultAdapter && Bluetooth.defaultAdapter.discovering) {
|
||||
Bluetooth.defaultAdapter.discovering = false;
|
||||
onVisibleChanged: {
|
||||
// Stop discovery when menu closes to save battery
|
||||
if (!visible && Bluetooth.defaultAdapter && Bluetooth.defaultAdapter.discovering) {
|
||||
Bluetooth.defaultAdapter.discovering = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: Theme.backgroundPrimary
|
||||
radius: 12
|
||||
|
||||
ColumnLayout {
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 16
|
||||
spacing: 16
|
||||
color: Theme.backgroundPrimary
|
||||
radius: 12
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 12
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 16
|
||||
spacing: 16
|
||||
|
||||
Text {
|
||||
text: "bluetooth"
|
||||
font.family: "Material Symbols Outlined"
|
||||
font.pixelSize: 24
|
||||
color: Theme.accentPrimary
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "Bluetooth Devices"
|
||||
font.pixelSize: 18
|
||||
font.bold: true
|
||||
color: Theme.textPrimary
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
spacing: 12
|
||||
|
||||
IconButton {
|
||||
icon: "close"
|
||||
onClicked: {
|
||||
bluetoothMenu.visible = false;
|
||||
if (Bluetooth.defaultAdapter && Bluetooth.defaultAdapter.discovering) {
|
||||
Bluetooth.defaultAdapter.discovering = false;
|
||||
Text {
|
||||
text: "bluetooth"
|
||||
font.family: "Material Symbols Outlined"
|
||||
font.pixelSize: 24
|
||||
color: Theme.accentPrimary
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "Bluetooth Devices"
|
||||
font.pixelSize: 18
|
||||
font.bold: true
|
||||
color: Theme.textPrimary
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
IconButton {
|
||||
icon: "close"
|
||||
onClicked: {
|
||||
bluetoothMenu.visible = false;
|
||||
if (Bluetooth.defaultAdapter && Bluetooth.defaultAdapter.discovering) {
|
||||
Bluetooth.defaultAdapter.discovering = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
height: 1
|
||||
color: Theme.outline
|
||||
opacity: 0.12
|
||||
}
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
height: 1
|
||||
color: Theme.outline
|
||||
opacity: 0.12
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: deviceList
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
model: Bluetooth.defaultAdapter ? Bluetooth.defaultAdapter.devices : []
|
||||
spacing: 8
|
||||
clip: true
|
||||
ListView {
|
||||
id: deviceList
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
model: Bluetooth.defaultAdapter ? Bluetooth.defaultAdapter.devices : []
|
||||
spacing: 8
|
||||
clip: true
|
||||
|
||||
delegate: Item {
|
||||
width: parent.width
|
||||
height: 48
|
||||
delegate: Item {
|
||||
width: parent.width
|
||||
height: 48
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: 8
|
||||
color: modelData.connected ? Qt.rgba(Theme.accentPrimary.r, Theme.accentPrimary.g, Theme.accentPrimary.b, 0.44) : (deviceMouseArea.containsMouse ? Theme.highlight : "transparent")
|
||||
|
||||
RowLayout {
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 8
|
||||
spacing: 8
|
||||
radius: 8
|
||||
color: modelData.connected ? Qt.rgba(Theme.accentPrimary.r, Theme.accentPrimary.g, Theme.accentPrimary.b, 0.44) : (deviceMouseArea.containsMouse ? Theme.highlight : "transparent")
|
||||
|
||||
Text {
|
||||
text: modelData.connected ? "bluetooth" : "bluetooth_disabled"
|
||||
font.family: "Material Symbols Outlined"
|
||||
font.pixelSize: 18
|
||||
color: deviceMouseArea.containsMouse ? Theme.backgroundPrimary : (modelData.connected ? Theme.accentPrimary : Theme.textSecondary)
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 2
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 8
|
||||
spacing: 8
|
||||
|
||||
Text {
|
||||
text: {
|
||||
let deviceName = modelData.name || modelData.deviceName || "Unknown Device";
|
||||
// Hide MAC addresses and show "Unknown Device" instead
|
||||
let macPattern = /^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/;
|
||||
if (macPattern.test(deviceName)) {
|
||||
return "Unknown Device";
|
||||
}
|
||||
return deviceName;
|
||||
}
|
||||
color: deviceMouseArea.containsMouse ? Theme.backgroundPrimary : (modelData.connected ? Theme.accentPrimary : Theme.textPrimary)
|
||||
font.pixelSize: 14
|
||||
elide: Text.ElideRight
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Text {
|
||||
text: {
|
||||
let deviceName = modelData.name || modelData.deviceName || "";
|
||||
let macPattern = /^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/;
|
||||
if (macPattern.test(deviceName)) {
|
||||
// Show MAC address in subtitle for unnamed devices
|
||||
return modelData.address + " • " + (modelData.paired ? "Paired" : "Available");
|
||||
} else {
|
||||
// Show only status for named devices
|
||||
return modelData.paired ? "Paired" : "Available";
|
||||
}
|
||||
}
|
||||
text: modelData.connected ? "bluetooth" : "bluetooth_disabled"
|
||||
font.family: "Material Symbols Outlined"
|
||||
font.pixelSize: 18
|
||||
color: deviceMouseArea.containsMouse ? Theme.backgroundPrimary : (modelData.connected ? Theme.accentPrimary : Theme.textSecondary)
|
||||
font.pixelSize: 11
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 2
|
||||
|
||||
Text {
|
||||
text: {
|
||||
let deviceName = modelData.name || modelData.deviceName || "Unknown Device";
|
||||
// Hide MAC addresses and show "Unknown Device" instead
|
||||
let macPattern = /^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/;
|
||||
if (macPattern.test(deviceName)) {
|
||||
return "Unknown Device";
|
||||
}
|
||||
return deviceName;
|
||||
}
|
||||
color: deviceMouseArea.containsMouse ? Theme.backgroundPrimary : (modelData.connected ? Theme.accentPrimary : Theme.textPrimary)
|
||||
font.pixelSize: 14
|
||||
elide: Text.ElideRight
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Text {
|
||||
text: {
|
||||
let deviceName = modelData.name || modelData.deviceName || "";
|
||||
let macPattern = /^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/;
|
||||
if (macPattern.test(deviceName)) {
|
||||
// Show MAC address in subtitle for unnamed devices
|
||||
return modelData.address + " • " + (modelData.paired ? "Paired" : "Available");
|
||||
} else {
|
||||
// Show only status for named devices
|
||||
return modelData.paired ? "Paired" : "Available";
|
||||
}
|
||||
}
|
||||
color: deviceMouseArea.containsMouse ? Theme.backgroundPrimary : (modelData.connected ? Theme.accentPrimary : Theme.textSecondary)
|
||||
font.pixelSize: 11
|
||||
elide: Text.ElideRight
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.preferredWidth: 22
|
||||
Layout.preferredHeight: 22
|
||||
visible: modelData.pairing || modelData.state === BluetoothDeviceState.Connecting || modelData.state === BluetoothDeviceState.Disconnecting
|
||||
|
||||
Spinner {
|
||||
visible: parent.visible
|
||||
running: parent.visible
|
||||
color: Theme.accentPrimary
|
||||
anchors.centerIn: parent
|
||||
size: 22
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.preferredWidth: 22
|
||||
Layout.preferredHeight: 22
|
||||
visible: modelData.pairing || modelData.state === BluetoothDeviceState.Connecting || modelData.state === BluetoothDeviceState.Disconnecting
|
||||
|
||||
Spinner {
|
||||
visible: parent.visible
|
||||
running: parent.visible
|
||||
color: Theme.accentPrimary
|
||||
anchors.centerIn: parent
|
||||
size: 22
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: deviceMouseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
// Handle device actions: disconnect, pair, or connect
|
||||
if (modelData.connected) {
|
||||
modelData.disconnect();
|
||||
} else if (!modelData.paired) {
|
||||
modelData.pair();
|
||||
} else {
|
||||
modelData.connect();
|
||||
MouseArea {
|
||||
id: deviceMouseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
// Handle device actions: disconnect, pair, or connect
|
||||
if (modelData.connected) {
|
||||
modelData.disconnect();
|
||||
} else if (!modelData.paired) {
|
||||
modelData.pair();
|
||||
} else {
|
||||
modelData.connect();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Discovering indicator
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 8
|
||||
visible: Bluetooth.defaultAdapter && Bluetooth.defaultAdapter.discovering
|
||||
// Discovering indicator
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 8
|
||||
visible: Bluetooth.defaultAdapter && Bluetooth.defaultAdapter.discovering
|
||||
|
||||
Text {
|
||||
text: "Scanning for devices..."
|
||||
font.pixelSize: 12
|
||||
color: Theme.textSecondary
|
||||
}
|
||||
Text {
|
||||
text: "Scanning for devices..."
|
||||
font.pixelSize: 12
|
||||
color: Theme.textSecondary
|
||||
}
|
||||
|
||||
Spinner {
|
||||
running: true
|
||||
color: Theme.accentPrimary
|
||||
size: 16
|
||||
Spinner {
|
||||
running: true
|
||||
color: Theme.accentPrimary
|
||||
size: 16
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,80 +0,0 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import qs.Settings
|
||||
import qs.Components
|
||||
import qs.Widgets.SettingsWindow
|
||||
|
||||
Item {
|
||||
id: root
|
||||
width: 22
|
||||
height: 22
|
||||
|
||||
property var settingsWindow: null
|
||||
|
||||
Rectangle {
|
||||
id: button
|
||||
anchors.fill: parent
|
||||
color: "transparent"
|
||||
radius: width / 2
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: "settings"
|
||||
font.family: "Material Symbols Outlined"
|
||||
font.pixelSize: 16
|
||||
color: mouseArea.containsMouse ? Theme.accentPrimary : Theme.textPrimary
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
|
||||
onClicked: {
|
||||
if (!settingsWindow) {
|
||||
// Create new window
|
||||
settingsWindow = settingsComponent.createObject(null); // No parent to avoid dependency issues
|
||||
if (settingsWindow) {
|
||||
settingsWindow.visible = true;
|
||||
// Handle window closure
|
||||
settingsWindow.visibleChanged.connect(function() {
|
||||
if (settingsWindow && !settingsWindow.visible) {
|
||||
var windowToDestroy = settingsWindow;
|
||||
settingsWindow = null;
|
||||
windowToDestroy.destroy();
|
||||
}
|
||||
});
|
||||
}
|
||||
} else if (settingsWindow.visible) {
|
||||
// Close and destroy window
|
||||
var windowToDestroy = settingsWindow;
|
||||
settingsWindow = null;
|
||||
windowToDestroy.visible = false;
|
||||
windowToDestroy.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StyledTooltip {
|
||||
text: "Settings"
|
||||
targetItem: mouseArea
|
||||
tooltipVisible: mouseArea.containsMouse
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: settingsComponent
|
||||
SettingsWindow {}
|
||||
}
|
||||
|
||||
// Clean up on destruction
|
||||
Component.onDestruction: {
|
||||
if (settingsWindow) {
|
||||
var windowToDestroy = settingsWindow;
|
||||
settingsWindow = null;
|
||||
windowToDestroy.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -61,11 +61,16 @@ Item {
|
|||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
wifiMenu.visible = !wifiMenu.visible;
|
||||
if (wifiMenu.visible) {
|
||||
network.onMenuOpened();
|
||||
} else {
|
||||
network.onMenuClosed();
|
||||
if (!wifiMenuLoader.active) {
|
||||
wifiMenuLoader.loading = true;
|
||||
}
|
||||
if (wifiMenuLoader.item) {
|
||||
wifiMenuLoader.item.visible = !wifiMenuLoader.item.visible;
|
||||
if (wifiMenuLoader.item.visible) {
|
||||
network.onMenuOpened();
|
||||
} else {
|
||||
network.onMenuClosed();
|
||||
}
|
||||
}
|
||||
}
|
||||
onEntered: wifiTooltip.tooltipVisible = true
|
||||
|
|
@ -82,282 +87,287 @@ Item {
|
|||
delay: 200
|
||||
}
|
||||
|
||||
PanelWindow {
|
||||
id: wifiMenu
|
||||
implicitWidth: 320
|
||||
implicitHeight: 480
|
||||
visible: false
|
||||
color: "transparent"
|
||||
anchors.top: true
|
||||
anchors.right: true
|
||||
margins.right: 0
|
||||
margins.top: 0
|
||||
WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand
|
||||
// LazyLoader for WiFi menu
|
||||
LazyLoader {
|
||||
id: wifiMenuLoader
|
||||
loading: false
|
||||
component: PanelWindow {
|
||||
id: wifiMenu
|
||||
implicitWidth: 320
|
||||
implicitHeight: 480
|
||||
visible: false
|
||||
color: "transparent"
|
||||
anchors.top: true
|
||||
anchors.right: true
|
||||
margins.right: 0
|
||||
margins.top: 0
|
||||
WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: Theme.backgroundPrimary
|
||||
radius: 12
|
||||
|
||||
ColumnLayout {
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 16
|
||||
spacing: 16
|
||||
color: Theme.backgroundPrimary
|
||||
radius: 12
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 12
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 16
|
||||
spacing: 16
|
||||
|
||||
Text {
|
||||
text: "wifi"
|
||||
font.family: "Material Symbols Outlined"
|
||||
font.pixelSize: 24
|
||||
color: Theme.accentPrimary
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "WiFi Networks"
|
||||
font.pixelSize: 18
|
||||
font.bold: true
|
||||
color: Theme.textPrimary
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
spacing: 12
|
||||
|
||||
IconButton {
|
||||
icon: "refresh"
|
||||
onClicked: network.refreshNetworks()
|
||||
}
|
||||
Text {
|
||||
text: "wifi"
|
||||
font.family: "Material Symbols Outlined"
|
||||
font.pixelSize: 24
|
||||
color: Theme.accentPrimary
|
||||
}
|
||||
|
||||
IconButton {
|
||||
icon: "close"
|
||||
onClicked: {
|
||||
wifiMenu.visible = false;
|
||||
network.onMenuClosed();
|
||||
Text {
|
||||
text: "WiFi Networks"
|
||||
font.pixelSize: 18
|
||||
font.bold: true
|
||||
color: Theme.textPrimary
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
IconButton {
|
||||
icon: "refresh"
|
||||
onClicked: network.refreshNetworks()
|
||||
}
|
||||
|
||||
IconButton {
|
||||
icon: "close"
|
||||
onClicked: {
|
||||
wifiMenu.visible = false;
|
||||
network.onMenuClosed();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
height: 1
|
||||
color: Theme.outline
|
||||
opacity: 0.12
|
||||
}
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
height: 1
|
||||
color: Theme.outline
|
||||
opacity: 0.12
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: networkList
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
model: Object.values(network.networks)
|
||||
spacing: 8
|
||||
clip: true
|
||||
ListView {
|
||||
id: networkList
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
model: Object.values(network.networks)
|
||||
spacing: 8
|
||||
clip: true
|
||||
|
||||
delegate: Item {
|
||||
width: parent.width
|
||||
height: modelData.ssid === passwordPromptSsid && showPasswordPrompt ? 108 : 48 // 48 for network + 60 for password prompt
|
||||
delegate: Item {
|
||||
width: parent.width
|
||||
height: modelData.ssid === passwordPromptSsid && showPasswordPrompt ? 108 : 48 // 48 for network + 60 for password prompt
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
spacing: 0
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
spacing: 0
|
||||
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 48
|
||||
radius: 8
|
||||
color: modelData.connected ? Qt.rgba(Theme.accentPrimary.r, Theme.accentPrimary.g, Theme.accentPrimary.b, 0.44) : (networkMouseArea.containsMouse ? Theme.highlight : "transparent")
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 48
|
||||
radius: 8
|
||||
color: modelData.connected ? Qt.rgba(Theme.accentPrimary.r, Theme.accentPrimary.g, Theme.accentPrimary.b, 0.44) : (networkMouseArea.containsMouse ? Theme.highlight : "transparent")
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 8
|
||||
spacing: 8
|
||||
|
||||
Text {
|
||||
text: network.signalIcon(modelData.signal)
|
||||
font.family: "Material Symbols Outlined"
|
||||
font.pixelSize: 18
|
||||
color: networkMouseArea.containsMouse ? Theme.backgroundPrimary : (modelData.connected ? Theme.accentPrimary : Theme.textSecondary)
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 2
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 8
|
||||
spacing: 8
|
||||
|
||||
Text {
|
||||
text: modelData.ssid || "Unknown Network"
|
||||
color: networkMouseArea.containsMouse ? Theme.backgroundPrimary : (modelData.connected ? Theme.accentPrimary : Theme.textPrimary)
|
||||
font.pixelSize: 14
|
||||
elide: Text.ElideRight
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Text {
|
||||
text: modelData.security && modelData.security !== "--" ? modelData.security : "Open"
|
||||
text: network.signalIcon(modelData.signal)
|
||||
font.family: "Material Symbols Outlined"
|
||||
font.pixelSize: 18
|
||||
color: networkMouseArea.containsMouse ? Theme.backgroundPrimary : (modelData.connected ? Theme.accentPrimary : Theme.textSecondary)
|
||||
font.pixelSize: 11
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 2
|
||||
|
||||
Text {
|
||||
text: modelData.ssid || "Unknown Network"
|
||||
color: networkMouseArea.containsMouse ? Theme.backgroundPrimary : (modelData.connected ? Theme.accentPrimary : Theme.textPrimary)
|
||||
font.pixelSize: 14
|
||||
elide: Text.ElideRight
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Text {
|
||||
text: modelData.security && modelData.security !== "--" ? modelData.security : "Open"
|
||||
color: networkMouseArea.containsMouse ? Theme.backgroundPrimary : (modelData.connected ? Theme.accentPrimary : Theme.textSecondary)
|
||||
font.pixelSize: 11
|
||||
elide: Text.ElideRight
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Text {
|
||||
visible: network.connectStatusSsid === modelData.ssid && network.connectStatus === "error" && network.connectError.length > 0
|
||||
text: network.connectError
|
||||
color: Theme.error
|
||||
font.pixelSize: 11
|
||||
elide: Text.ElideRight
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.preferredWidth: 22
|
||||
Layout.preferredHeight: 22
|
||||
visible: network.connectStatusSsid === modelData.ssid && (network.connectStatus !== "" || network.connectingSsid === modelData.ssid)
|
||||
|
||||
Spinner {
|
||||
visible: network.connectingSsid === modelData.ssid
|
||||
running: network.connectingSsid === modelData.ssid
|
||||
color: Theme.accentPrimary
|
||||
anchors.centerIn: parent
|
||||
size: 22
|
||||
}
|
||||
|
||||
Text {
|
||||
visible: network.connectStatus === "success" && !network.connectingSsid
|
||||
text: "check_circle"
|
||||
font.family: "Material Symbols Outlined"
|
||||
font.pixelSize: 18
|
||||
color: "#43a047"
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
|
||||
Text {
|
||||
visible: network.connectStatus === "error" && !network.connectingSsid
|
||||
text: "error"
|
||||
font.family: "Material Symbols Outlined"
|
||||
font.pixelSize: 18
|
||||
color: Theme.error
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
visible: network.connectStatusSsid === modelData.ssid && network.connectStatus === "error" && network.connectError.length > 0
|
||||
text: network.connectError
|
||||
color: Theme.error
|
||||
visible: modelData.connected
|
||||
text: "connected"
|
||||
color: networkMouseArea.containsMouse ? Theme.backgroundPrimary : Theme.accentPrimary
|
||||
font.pixelSize: 11
|
||||
elide: Text.ElideRight
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.preferredWidth: 22
|
||||
Layout.preferredHeight: 22
|
||||
visible: network.connectStatusSsid === modelData.ssid && (network.connectStatus !== "" || network.connectingSsid === modelData.ssid)
|
||||
|
||||
Spinner {
|
||||
visible: network.connectingSsid === modelData.ssid
|
||||
running: network.connectingSsid === modelData.ssid
|
||||
color: Theme.accentPrimary
|
||||
anchors.centerIn: parent
|
||||
size: 22
|
||||
MouseArea {
|
||||
id: networkMouseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
if (modelData.connected) {
|
||||
network.disconnectNetwork(modelData.ssid);
|
||||
} else if (network.isSecured(modelData.security) && !modelData.existing) {
|
||||
passwordPromptSsid = modelData.ssid;
|
||||
showPasswordPrompt = true;
|
||||
passwordInput = ""; // Clear previous input
|
||||
Qt.callLater(function() {
|
||||
passwordInputField.forceActiveFocus();
|
||||
});
|
||||
} else {
|
||||
network.connectNetwork(modelData.ssid, modelData.security);
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
visible: network.connectStatus === "success" && !network.connectingSsid
|
||||
text: "check_circle"
|
||||
font.family: "Material Symbols Outlined"
|
||||
font.pixelSize: 18
|
||||
color: "#43a047"
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
|
||||
Text {
|
||||
visible: network.connectStatus === "error" && !network.connectingSsid
|
||||
text: "error"
|
||||
font.family: "Material Symbols Outlined"
|
||||
font.pixelSize: 18
|
||||
color: Theme.error
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
visible: modelData.connected
|
||||
text: "connected"
|
||||
color: networkMouseArea.containsMouse ? Theme.backgroundPrimary : Theme.accentPrimary
|
||||
font.pixelSize: 11
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: networkMouseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
if (modelData.connected) {
|
||||
network.disconnectNetwork(modelData.ssid);
|
||||
} else if (network.isSecured(modelData.security) && !modelData.existing) {
|
||||
passwordPromptSsid = modelData.ssid;
|
||||
showPasswordPrompt = true;
|
||||
passwordInput = ""; // Clear previous input
|
||||
Qt.callLater(function() {
|
||||
passwordInputField.forceActiveFocus();
|
||||
});
|
||||
} else {
|
||||
network.connectNetwork(modelData.ssid, modelData.security);
|
||||
// Password prompt section
|
||||
Rectangle {
|
||||
id: passwordPromptSection
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: modelData.ssid === passwordPromptSsid && showPasswordPrompt ? 60 : 0
|
||||
Layout.margins: 8
|
||||
visible: modelData.ssid === passwordPromptSsid && showPasswordPrompt
|
||||
color: Theme.surfaceVariant
|
||||
radius: 8
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 12
|
||||
spacing: 10
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 36
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: 8
|
||||
color: "transparent"
|
||||
border.color: passwordInputField.activeFocus ? Theme.accentPrimary : Theme.outline
|
||||
border.width: 1
|
||||
|
||||
TextInput {
|
||||
id: passwordInputField
|
||||
anchors.fill: parent
|
||||
anchors.margins: 12
|
||||
text: passwordInput
|
||||
font.pixelSize: 13
|
||||
color: Theme.textPrimary
|
||||
verticalAlignment: TextInput.AlignVCenter
|
||||
clip: true
|
||||
focus: true
|
||||
selectByMouse: true
|
||||
activeFocusOnTab: true
|
||||
inputMethodHints: Qt.ImhNone
|
||||
echoMode: TextInput.Password
|
||||
onTextChanged: passwordInput = text
|
||||
onAccepted: {
|
||||
network.submitPassword(passwordPromptSsid, passwordInput);
|
||||
showPasswordPrompt = false;
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: passwordInputMouseArea
|
||||
anchors.fill: parent
|
||||
onClicked: passwordInputField.forceActiveFocus()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Password prompt section
|
||||
Rectangle {
|
||||
id: passwordPromptSection
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: modelData.ssid === passwordPromptSsid && showPasswordPrompt ? 60 : 0
|
||||
Layout.margins: 8
|
||||
visible: modelData.ssid === passwordPromptSsid && showPasswordPrompt
|
||||
color: Theme.surfaceVariant
|
||||
radius: 8
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 12
|
||||
spacing: 10
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 36
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: 8
|
||||
color: "transparent"
|
||||
border.color: passwordInputField.activeFocus ? Theme.accentPrimary : Theme.outline
|
||||
border.width: 1
|
||||
Layout.preferredWidth: 80
|
||||
Layout.preferredHeight: 36
|
||||
radius: 18
|
||||
color: Theme.accentPrimary
|
||||
border.color: Theme.accentPrimary
|
||||
border.width: 0
|
||||
opacity: 1.0
|
||||
|
||||
TextInput {
|
||||
id: passwordInputField
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: 100
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 12
|
||||
text: passwordInput
|
||||
font.pixelSize: 13
|
||||
color: Theme.textPrimary
|
||||
verticalAlignment: TextInput.AlignVCenter
|
||||
clip: true
|
||||
focus: true
|
||||
selectByMouse: true
|
||||
activeFocusOnTab: true
|
||||
inputMethodHints: Qt.ImhNone
|
||||
echoMode: TextInput.Password
|
||||
onTextChanged: passwordInput = text
|
||||
onAccepted: {
|
||||
onClicked: {
|
||||
network.submitPassword(passwordPromptSsid, passwordInput);
|
||||
showPasswordPrompt = false;
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: passwordInputMouseArea
|
||||
anchors.fill: parent
|
||||
onClicked: passwordInputField.forceActiveFocus()
|
||||
}
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
hoverEnabled: true
|
||||
onEntered: parent.color = Qt.darker(Theme.accentPrimary, 1.1)
|
||||
onExited: parent.color = Theme.accentPrimary
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
Layout.preferredWidth: 80
|
||||
Layout.preferredHeight: 36
|
||||
radius: 18
|
||||
color: Theme.accentPrimary
|
||||
border.color: Theme.accentPrimary
|
||||
border.width: 0
|
||||
opacity: 1.0
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: 100
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: "Connect"
|
||||
color: Theme.backgroundPrimary
|
||||
font.pixelSize: 14
|
||||
font.bold: true
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
network.submitPassword(passwordPromptSsid, passwordInput);
|
||||
showPasswordPrompt = false;
|
||||
}
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
hoverEnabled: true
|
||||
onEntered: parent.color = Qt.darker(Theme.accentPrimary, 1.1)
|
||||
onExited: parent.color = Theme.accentPrimary
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: "Connect"
|
||||
color: Theme.backgroundPrimary
|
||||
font.pixelSize: 14
|
||||
font.bold: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue