WiFi: small improvements to UI and service
This commit is contained in:
parent
f3d1d15b61
commit
1cab452352
2 changed files with 28 additions and 26 deletions
|
|
@ -10,7 +10,7 @@ import qs.Widgets
|
||||||
NPanel {
|
NPanel {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
panelWidth: 440 * scaling
|
panelWidth: 400 * scaling
|
||||||
panelHeight: 500 * scaling
|
panelHeight: 500 * scaling
|
||||||
panelKeyboardFocus: true
|
panelKeyboardFocus: true
|
||||||
|
|
||||||
|
|
@ -269,14 +269,6 @@ NPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loading indicator
|
|
||||||
NBusyIndicator {
|
|
||||||
visible: NetworkService.connectingSsid === modelData.ssid
|
|
||||||
running: NetworkService.connectingSsid === modelData.ssid
|
|
||||||
color: Color.mPrimary
|
|
||||||
size: Style.baseWidgetSize * 0.6 * scaling
|
|
||||||
}
|
|
||||||
|
|
||||||
// Right-aligned items container
|
// Right-aligned items container
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||||
|
|
@ -330,6 +322,14 @@ NPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Loading indicator
|
||||||
|
NBusyIndicator {
|
||||||
|
visible: NetworkService.connectingSsid === modelData.ssid
|
||||||
|
running: NetworkService.connectingSsid === modelData.ssid
|
||||||
|
color: Color.mPrimary
|
||||||
|
size: Style.baseWidgetSize * 0.6 * scaling
|
||||||
|
}
|
||||||
|
|
||||||
// Action buttons
|
// Action buttons
|
||||||
RowLayout {
|
RowLayout {
|
||||||
spacing: Style.marginXS * scaling
|
spacing: Style.marginXS * scaling
|
||||||
|
|
@ -341,7 +341,6 @@ NPanel {
|
||||||
fontSize: Style.fontSizeXS * scaling
|
fontSize: Style.fontSizeXS * scaling
|
||||||
text: modelData.existing ? "Connect" : (NetworkService.isSecured(
|
text: modelData.existing ? "Connect" : (NetworkService.isSecured(
|
||||||
modelData.security) ? "Password" : "Connect")
|
modelData.security) ? "Password" : "Connect")
|
||||||
icon: "wifi"
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (modelData.existing || !NetworkService.isSecured(modelData.security)) {
|
if (modelData.existing || !NetworkService.isSecured(modelData.security)) {
|
||||||
NetworkService.connectNetwork(modelData.ssid, modelData.security)
|
NetworkService.connectNetwork(modelData.ssid, modelData.security)
|
||||||
|
|
@ -361,7 +360,6 @@ NPanel {
|
||||||
fontSize: Style.fontSizeXS * scaling
|
fontSize: Style.fontSizeXS * scaling
|
||||||
backgroundColor: Color.mError
|
backgroundColor: Color.mError
|
||||||
text: "Disconnect"
|
text: "Disconnect"
|
||||||
icon: "cancel"
|
|
||||||
onClicked: NetworkService.disconnectNetwork(modelData.ssid)
|
onClicked: NetworkService.disconnectNetwork(modelData.ssid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -384,9 +382,9 @@ NPanel {
|
||||||
Rectangle {
|
Rectangle {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
radius: Style.radiusXS * scaling
|
radius: Style.radiusS * scaling
|
||||||
color: Color.mSurface
|
color: Color.mSurface
|
||||||
border.color: passwordInputField.activeFocus ? Color.mPrimary : Color.mOutline
|
border.color: passwordInputField.activeFocus ? Color.mSecondary : Color.mOutline
|
||||||
border.width: Math.max(1, Style.borderS * scaling)
|
border.width: Math.max(1, Style.borderS * scaling)
|
||||||
|
|
||||||
TextInput {
|
TextInput {
|
||||||
|
|
@ -396,15 +394,16 @@ NPanel {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.leftMargin: Style.marginM * scaling
|
anchors.leftMargin: Style.marginM * scaling
|
||||||
anchors.rightMargin: Style.marginM * scaling
|
anchors.rightMargin: Style.marginM * scaling
|
||||||
height: parent.height - (Style.marginS * scaling * 2)
|
height: parent.height
|
||||||
text: passwordInput
|
text: passwordInput
|
||||||
font.pointSize: Style.fontSizeS * scaling
|
font.pointSize: Style.fontSizeM * scaling
|
||||||
color: Color.mOnSurface
|
color: Color.mOnSurface
|
||||||
verticalAlignment: TextInput.AlignVCenter
|
verticalAlignment: TextInput.AlignVCenter
|
||||||
clip: true
|
clip: true
|
||||||
focus: modelData.ssid === passwordPromptSsid && showPasswordPrompt
|
focus: modelData.ssid === passwordPromptSsid && showPasswordPrompt
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
echoMode: TextInput.Password
|
echoMode: TextInput.Password
|
||||||
|
passwordCharacter: "●"
|
||||||
onTextChanged: passwordInput = text
|
onTextChanged: passwordInput = text
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
if (passwordInput) {
|
if (passwordInput) {
|
||||||
|
|
|
||||||
|
|
@ -180,12 +180,14 @@ Singleton {
|
||||||
|
|
||||||
stderr: StdioCollector {
|
stderr: StdioCollector {
|
||||||
onStreamFinished: {
|
onStreamFinished: {
|
||||||
if (text.includes("no such connection profile")) {
|
if (text.trim()) {
|
||||||
Logger.log("Network", `Network profile not found: ${forgetProcess.ssid}`)
|
if (text.includes("no such connection profile")) {
|
||||||
} else {
|
Logger.log("Network", `Network profile not found: ${forgetProcess.ssid}`)
|
||||||
Logger.warn("Network", `Error forgetting network: ${text}`)
|
} else {
|
||||||
|
Logger.warn("Network", `Error forgetting network: ${text}`)
|
||||||
|
}
|
||||||
|
refreshNetworks()
|
||||||
}
|
}
|
||||||
refreshNetworks()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -341,7 +343,9 @@ Singleton {
|
||||||
|
|
||||||
stderr: StdioCollector {
|
stderr: StdioCollector {
|
||||||
onStreamFinished: {
|
onStreamFinished: {
|
||||||
handleConnectionError(connectProcess.ssid, text)
|
if (text.trim()) {
|
||||||
|
handleConnectionError(connectProcess.ssid, text)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -360,7 +364,9 @@ Singleton {
|
||||||
|
|
||||||
stderr: StdioCollector {
|
stderr: StdioCollector {
|
||||||
onStreamFinished: {
|
onStreamFinished: {
|
||||||
handleConnectionError(upConnectionProcess.profileName, text)
|
if (text.trim()) {
|
||||||
|
handleConnectionError(upConnectionProcess.profileName, text)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -413,9 +419,6 @@ Singleton {
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleConnectionError(ssid, error) {
|
function handleConnectionError(ssid, error) {
|
||||||
if (error === "")
|
|
||||||
return
|
|
||||||
|
|
||||||
connectingSsid = ""
|
connectingSsid = ""
|
||||||
connectStatus = "error"
|
connectStatus = "error"
|
||||||
connectStatusSsid = ssid
|
connectStatusSsid = ssid
|
||||||
|
|
@ -529,7 +532,7 @@ Singleton {
|
||||||
root.isLoading = false
|
root.isLoading = false
|
||||||
scanProcess.existingProfiles = {}
|
scanProcess.existingProfiles = {}
|
||||||
|
|
||||||
Logger.log("Network", `Found ${Object.keys(networksMap).length} wireless networks`)
|
//Logger.log("Network", `Found ${Object.keys(networksMap).length} wireless networks`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue