mirror of https://github.com/cutefishos/settings
Improve network
parent
0ab3bc6462
commit
3c61f2ae7c
@ -1,135 +0,0 @@
|
|||||||
import QtQuick 2.4
|
|
||||||
import QtQuick.Controls 2.4
|
|
||||||
import QtQuick.Layouts 1.3
|
|
||||||
import QtGraphicalEffects 1.0
|
|
||||||
|
|
||||||
import FishUI 1.0 as FishUI
|
|
||||||
import Cutefish.NetworkManagement 1.0 as NM
|
|
||||||
|
|
||||||
ItemPage {
|
|
||||||
id: control
|
|
||||||
headerTitle: qsTr("Network")
|
|
||||||
|
|
||||||
property var itemHeight: 50
|
|
||||||
property var settingsMap: ({})
|
|
||||||
|
|
||||||
NM.Networking {
|
|
||||||
id: networking
|
|
||||||
}
|
|
||||||
|
|
||||||
NM.NetworkModel {
|
|
||||||
id: networkModel
|
|
||||||
}
|
|
||||||
|
|
||||||
Scrollable {
|
|
||||||
anchors.fill: parent
|
|
||||||
contentHeight: mainLayout.implicitHeight
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
id: mainLayout
|
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
// Wired connection
|
|
||||||
ColumnLayout {
|
|
||||||
id: wiredLayout
|
|
||||||
|
|
||||||
visible: networking.enabled && wiredView.count > 0
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
Label {
|
|
||||||
text: qsTr("Wired")
|
|
||||||
color: FishUI.Theme.disabledTextColor
|
|
||||||
Layout.fillWidth: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ListView {
|
|
||||||
id: wiredView
|
|
||||||
|
|
||||||
Layout.fillWidth: true
|
|
||||||
implicitHeight: wiredView.count * control.itemHeight
|
|
||||||
clip: true
|
|
||||||
|
|
||||||
model: NM.TechnologyProxyModel {
|
|
||||||
type: NM.TechnologyProxyModel.WiredType
|
|
||||||
sourceModel: networkModel
|
|
||||||
}
|
|
||||||
|
|
||||||
ScrollBar.vertical: ScrollBar {}
|
|
||||||
|
|
||||||
delegate: WiredItem {
|
|
||||||
height: control.itemHeight
|
|
||||||
width: wiredView.width
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
HorizontalDivider {
|
|
||||||
visible: wiredView.visible && networking.wirelessHardwareEnabled
|
|
||||||
}
|
|
||||||
|
|
||||||
// Wireless
|
|
||||||
ColumnLayout {
|
|
||||||
id: wirelessLayout
|
|
||||||
spacing: FishUI.Units.largeSpacing
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
spacing: FishUI.Units.largeSpacing
|
|
||||||
|
|
||||||
Label {
|
|
||||||
text: qsTr("Wi-Fi")
|
|
||||||
color: FishUI.Theme.disabledTextColor
|
|
||||||
}
|
|
||||||
|
|
||||||
FishUI.BusyIndicator {
|
|
||||||
id: wlanBusyIndicator
|
|
||||||
width: wirelessSwitch.height
|
|
||||||
height: width
|
|
||||||
visible: networking.wirelessEnabled && wirelessView.count === 0
|
|
||||||
running: wlanBusyIndicator.visible
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
}
|
|
||||||
|
|
||||||
Switch {
|
|
||||||
id: wirelessSwitch
|
|
||||||
Layout.fillHeight: true
|
|
||||||
leftPadding: 0
|
|
||||||
rightPadding: 0
|
|
||||||
onCheckedChanged: networking.wirelessEnabled = checked
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
wirelessSwitch.checked = networking.wirelessEnabled
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ListView {
|
|
||||||
id: wirelessView
|
|
||||||
|
|
||||||
visible: networking.wirelessEnabled && networking.wirelessHardwareEnabled
|
|
||||||
Layout.fillWidth: true
|
|
||||||
|
|
||||||
implicitHeight: count * control.itemHeight
|
|
||||||
interactive: false
|
|
||||||
clip: true
|
|
||||||
|
|
||||||
model: NM.TechnologyProxyModel {
|
|
||||||
type: NM.TechnologyProxyModel.WirelessType
|
|
||||||
sourceModel: networkModel
|
|
||||||
showInactiveConnections: true
|
|
||||||
}
|
|
||||||
|
|
||||||
ScrollBar.vertical: ScrollBar {}
|
|
||||||
|
|
||||||
delegate: WirelessItem {
|
|
||||||
height: control.itemHeight
|
|
||||||
width: wirelessView.width
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,72 @@
|
|||||||
|
import QtQuick 2.12
|
||||||
|
import QtQuick.Controls 2.12
|
||||||
|
import QtQuick.Layouts 1.12
|
||||||
|
import FishUI 1.0 as FishUI
|
||||||
|
|
||||||
|
Item {
|
||||||
|
implicitHeight: _contentLayout.implicitHeight + FishUI.Theme.mediumRadius * 2
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: _contentLayout
|
||||||
|
anchors.fill: parent
|
||||||
|
spacing: FishUI.Units.smallSpacing
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
Label {
|
||||||
|
id: wlanLabel
|
||||||
|
text: qsTr("WLAN")
|
||||||
|
}
|
||||||
|
|
||||||
|
FishUI.BusyIndicator {
|
||||||
|
id: wlanBusyIndicator
|
||||||
|
width: wirelessSwitch.height
|
||||||
|
height: width
|
||||||
|
visible: enabledConnections.wirelessEnabled && wirelessView.count === 0
|
||||||
|
running: wlanBusyIndicator.visible
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Switch {
|
||||||
|
id: wirelessSwitch
|
||||||
|
height: wlanLabel.implicitHeight
|
||||||
|
leftPadding: 0
|
||||||
|
rightPadding: 0
|
||||||
|
|
||||||
|
checked: enabledConnections.wirelessEnabled
|
||||||
|
onCheckedChanged: {
|
||||||
|
if (checked) {
|
||||||
|
if (!enabledConnections.wirelessEnabled) {
|
||||||
|
handler.enableWireless(checked)
|
||||||
|
handler.requestScan()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (enabledConnections.wirelessEnabled) {
|
||||||
|
handler.enableWireless(checked)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ListView {
|
||||||
|
id: wirelessView
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: itemHeight * count
|
||||||
|
clip: true
|
||||||
|
model: appletProxyModel
|
||||||
|
interactive: false
|
||||||
|
|
||||||
|
visible: enabledConnections.wirelessEnabled
|
||||||
|
|
||||||
|
property var itemHeight: 45
|
||||||
|
|
||||||
|
delegate: WifiItem {
|
||||||
|
width: ListView.view.width
|
||||||
|
height: ListView.view.itemHeight
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,106 @@
|
|||||||
|
import QtQuick 2.4
|
||||||
|
import QtQuick.Controls 2.4
|
||||||
|
import QtQuick.Layouts 1.3
|
||||||
|
import QtGraphicalEffects 1.0
|
||||||
|
|
||||||
|
import FishUI 1.0 as FishUI
|
||||||
|
import Cutefish.NetworkManagement 1.0 as NM
|
||||||
|
|
||||||
|
import "../"
|
||||||
|
|
||||||
|
ItemPage {
|
||||||
|
id: control
|
||||||
|
headerTitle: qsTr("Network")
|
||||||
|
|
||||||
|
property var itemHeight: 50
|
||||||
|
property var settingsMap: ({})
|
||||||
|
|
||||||
|
NM.Handler {
|
||||||
|
id: handler
|
||||||
|
}
|
||||||
|
|
||||||
|
NM.WifiSettings {
|
||||||
|
id: wifiSettings
|
||||||
|
}
|
||||||
|
|
||||||
|
NM.NetworkModel {
|
||||||
|
id: networkModel
|
||||||
|
}
|
||||||
|
|
||||||
|
NM.EnabledConnections {
|
||||||
|
id: enabledConnections
|
||||||
|
}
|
||||||
|
|
||||||
|
NM.IdentityModel {
|
||||||
|
id: connectionModel
|
||||||
|
}
|
||||||
|
|
||||||
|
NM.AppletProxyModel {
|
||||||
|
id: appletProxyModel
|
||||||
|
sourceModel: connectionModel
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: handler.requestScan()
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: scanTimer
|
||||||
|
interval: 10200
|
||||||
|
repeat: true
|
||||||
|
running: control.visible
|
||||||
|
onTriggered: handler.requestScan()
|
||||||
|
}
|
||||||
|
|
||||||
|
Scrollable {
|
||||||
|
anchors.fill: parent
|
||||||
|
contentHeight: mainLayout.implicitHeight
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: mainLayout
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
// Wired connection
|
||||||
|
ColumnLayout {
|
||||||
|
id: wiredLayout
|
||||||
|
|
||||||
|
visible: enabledConnections.wwanEnabled && wiredView.count > 0
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
Label {
|
||||||
|
text: qsTr("Wired")
|
||||||
|
color: FishUI.Theme.disabledTextColor
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ListView {
|
||||||
|
id: wiredView
|
||||||
|
|
||||||
|
Layout.fillWidth: true
|
||||||
|
implicitHeight: wiredView.count * control.itemHeight
|
||||||
|
clip: true
|
||||||
|
|
||||||
|
model: NM.TechnologyProxyModel {
|
||||||
|
type: NM.TechnologyProxyModel.WiredType
|
||||||
|
sourceModel: networkModel
|
||||||
|
}
|
||||||
|
|
||||||
|
ScrollBar.vertical: ScrollBar {}
|
||||||
|
|
||||||
|
delegate: WiredItem {
|
||||||
|
height: control.itemHeight
|
||||||
|
width: wiredView.width
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HorizontalDivider {
|
||||||
|
visible: wiredView.visible && enabledConnections.wirelessHwEnabled
|
||||||
|
}
|
||||||
|
|
||||||
|
WifiView {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
visible: enabledConnections.wirelessHwEnabled
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue