tray: wireless, ethernet, bluetooth cleanup
This commit is contained in:
parent
8d8afba79a
commit
7dcfed3f0e
4 changed files with 39 additions and 9 deletions
|
|
@ -154,7 +154,7 @@ StyledRect {
|
||||||
|
|
||||||
// Ethernet icon
|
// Ethernet icon
|
||||||
WrappedLoader {
|
WrappedLoader {
|
||||||
name: "network"
|
name: "ethernet"
|
||||||
active: Config.bar.status.showNetwork && Nmcli.activeEthernet
|
active: Config.bar.status.showNetwork && Nmcli.activeEthernet
|
||||||
|
|
||||||
sourceComponent: MaterialIcon {
|
sourceComponent: MaterialIcon {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ ColumnLayout {
|
||||||
StyledText {
|
StyledText {
|
||||||
Layout.topMargin: Appearance.padding.normal
|
Layout.topMargin: Appearance.padding.normal
|
||||||
Layout.rightMargin: Appearance.padding.small
|
Layout.rightMargin: Appearance.padding.small
|
||||||
text: qsTr("Bluetooth %1").arg(BluetoothAdapterState.toString(Bluetooth.defaultAdapter?.state).toLowerCase())
|
text: qsTr("Bluetooth")
|
||||||
font.weight: 500
|
font.weight: 500
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,16 @@ Item {
|
||||||
|
|
||||||
Popout {
|
Popout {
|
||||||
name: "network"
|
name: "network"
|
||||||
sourceComponent: Network {}
|
sourceComponent: Network {
|
||||||
|
view: "wireless"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Popout {
|
||||||
|
name: "ethernet"
|
||||||
|
sourceComponent: Network {
|
||||||
|
view: "ethernet"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Popout {
|
Popout {
|
||||||
|
|
|
||||||
|
|
@ -13,25 +13,33 @@ ColumnLayout {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property string connectingToSsid: ""
|
property string connectingToSsid: ""
|
||||||
|
property string view: "wireless" // "wireless" or "ethernet"
|
||||||
|
|
||||||
spacing: Appearance.spacing.small
|
spacing: Appearance.spacing.small
|
||||||
width: Config.bar.sizes.networkWidth
|
width: Config.bar.sizes.networkWidth
|
||||||
|
|
||||||
|
// Wireless section
|
||||||
StyledText {
|
StyledText {
|
||||||
Layout.topMargin: Appearance.padding.normal
|
visible: root.view === "wireless"
|
||||||
|
Layout.preferredHeight: visible ? implicitHeight : 0
|
||||||
|
Layout.topMargin: visible ? Appearance.padding.normal : 0
|
||||||
Layout.rightMargin: Appearance.padding.small
|
Layout.rightMargin: Appearance.padding.small
|
||||||
text: qsTr("Wifi %1").arg(Nmcli.wifiEnabled ? "enabled" : "disabled")
|
text: qsTr("Wireless")
|
||||||
font.weight: 500
|
font.weight: 500
|
||||||
}
|
}
|
||||||
|
|
||||||
Toggle {
|
Toggle {
|
||||||
|
visible: root.view === "wireless"
|
||||||
|
Layout.preferredHeight: visible ? implicitHeight : 0
|
||||||
label: qsTr("Enabled")
|
label: qsTr("Enabled")
|
||||||
checked: Nmcli.wifiEnabled
|
checked: Nmcli.wifiEnabled
|
||||||
toggle.onToggled: Nmcli.enableWifi(checked)
|
toggle.onToggled: Nmcli.enableWifi(checked)
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
Layout.topMargin: Appearance.spacing.small
|
visible: root.view === "wireless"
|
||||||
|
Layout.preferredHeight: visible ? implicitHeight : 0
|
||||||
|
Layout.topMargin: visible ? Appearance.spacing.small : 0
|
||||||
Layout.rightMargin: Appearance.padding.small
|
Layout.rightMargin: Appearance.padding.small
|
||||||
text: qsTr("%1 networks available").arg(Nmcli.networks.length)
|
text: qsTr("%1 networks available").arg(Nmcli.networks.length)
|
||||||
color: Colours.palette.m3onSurfaceVariant
|
color: Colours.palette.m3onSurfaceVariant
|
||||||
|
|
@ -39,6 +47,7 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
|
visible: root.view === "wireless"
|
||||||
model: ScriptModel {
|
model: ScriptModel {
|
||||||
values: [...Nmcli.networks].sort((a, b) => {
|
values: [...Nmcli.networks].sort((a, b) => {
|
||||||
if (a.active !== b.active)
|
if (a.active !== b.active)
|
||||||
|
|
@ -54,6 +63,8 @@ ColumnLayout {
|
||||||
readonly property bool isConnecting: root.connectingToSsid === modelData.ssid
|
readonly property bool isConnecting: root.connectingToSsid === modelData.ssid
|
||||||
readonly property bool loading: networkItem.isConnecting
|
readonly property bool loading: networkItem.isConnecting
|
||||||
|
|
||||||
|
visible: root.view === "wireless"
|
||||||
|
Layout.preferredHeight: visible ? implicitHeight : 0
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.rightMargin: Appearance.padding.small
|
Layout.rightMargin: Appearance.padding.small
|
||||||
spacing: Appearance.spacing.small
|
spacing: Appearance.spacing.small
|
||||||
|
|
@ -142,7 +153,9 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledRect {
|
StyledRect {
|
||||||
Layout.topMargin: Appearance.spacing.small
|
visible: root.view === "wireless"
|
||||||
|
Layout.preferredHeight: visible ? implicitHeight : 0
|
||||||
|
Layout.topMargin: visible ? Appearance.spacing.small : 0
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
implicitHeight: rescanBtn.implicitHeight + Appearance.padding.small * 2
|
implicitHeight: rescanBtn.implicitHeight + Appearance.padding.small * 2
|
||||||
|
|
||||||
|
|
@ -192,15 +205,20 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ethernet section
|
||||||
StyledText {
|
StyledText {
|
||||||
Layout.topMargin: Appearance.spacing.normal
|
visible: root.view === "ethernet"
|
||||||
|
Layout.preferredHeight: visible ? implicitHeight : 0
|
||||||
|
Layout.topMargin: visible ? Appearance.padding.normal : 0
|
||||||
Layout.rightMargin: Appearance.padding.small
|
Layout.rightMargin: Appearance.padding.small
|
||||||
text: qsTr("Ethernet")
|
text: qsTr("Ethernet")
|
||||||
font.weight: 500
|
font.weight: 500
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
Layout.topMargin: Appearance.spacing.small
|
visible: root.view === "ethernet"
|
||||||
|
Layout.preferredHeight: visible ? implicitHeight : 0
|
||||||
|
Layout.topMargin: visible ? Appearance.spacing.small : 0
|
||||||
Layout.rightMargin: Appearance.padding.small
|
Layout.rightMargin: Appearance.padding.small
|
||||||
text: qsTr("%1 devices available").arg(Nmcli.ethernetDevices.length)
|
text: qsTr("%1 devices available").arg(Nmcli.ethernetDevices.length)
|
||||||
color: Colours.palette.m3onSurfaceVariant
|
color: Colours.palette.m3onSurfaceVariant
|
||||||
|
|
@ -208,6 +226,7 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
|
visible: root.view === "ethernet"
|
||||||
model: ScriptModel {
|
model: ScriptModel {
|
||||||
values: [...Nmcli.ethernetDevices].sort((a, b) => {
|
values: [...Nmcli.ethernetDevices].sort((a, b) => {
|
||||||
if (a.connected !== b.connected)
|
if (a.connected !== b.connected)
|
||||||
|
|
@ -222,6 +241,8 @@ ColumnLayout {
|
||||||
required property var modelData
|
required property var modelData
|
||||||
readonly property bool loading: false
|
readonly property bool loading: false
|
||||||
|
|
||||||
|
visible: root.view === "ethernet"
|
||||||
|
Layout.preferredHeight: visible ? implicitHeight : 0
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.rightMargin: Appearance.padding.small
|
Layout.rightMargin: Appearance.padding.small
|
||||||
spacing: Appearance.spacing.small
|
spacing: Appearance.spacing.small
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue