Skip to content

Commit 9b79e96

Browse files
committed
UI Controls: add wifi settings button to status bar
Contributes to #2834
1 parent a22843a commit 9b79e96

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

components/StatusBar.qml

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ FocusScope {
2424
signal leftButtonClicked()
2525
signal rightButtonClicked()
2626
signal auxButtonClicked()
27+
signal wifiButtonClicked()
2728
// PageStack.get(...) returns an Item, so the arg for 'popToPage' needs to be 'Item'. If we make it a 'Page', it works fine on the desktop,
2829
// but shows an unusual failure on the device. There is an error message about "passing incompatible arguments to signals is not supported",
2930
// and the page stack pops 1 too many pages.
@@ -204,7 +205,7 @@ FocusScope {
204205
}
205206
}
206207

207-
KeyNavigation.right: notificationButton
208+
KeyNavigation.right: wifiButton
208209

209210
Connections {
210211
target: root.pageStack
@@ -235,24 +236,19 @@ FocusScope {
235236
visible: !breadcrumbs.visible
236237
spacing: Theme.geometry_statusBar_spacing
237238

238-
CP.IconImage {
239-
anchors.verticalCenter: parent.verticalCenter
240-
color: Theme.color_font_primary
241-
source: {
242-
if (!signalStrength.valid) {
243-
return ""
244-
} else if (signalStrength.value > 75) {
245-
return "qrc:/images/icon_WiFi_4_32.svg"
246-
} else if (signalStrength.value > 50) {
247-
return "qrc:/images/icon_WiFi_3_32.svg"
248-
} else if (signalStrength.value > 25) {
249-
return "qrc:/images/icon_WiFi_2_32.svg"
250-
} else if (signalStrength.value > 0) {
251-
return "qrc:/images/icon_WiFi_1_32.svg"
252-
} else {
253-
return "qrc:/images/icon_WiFi_noconnection_32.svg"
254-
}
255-
}
239+
StatusBarButton {
240+
id: wifiButton
241+
242+
icon.source: !signalStrength.valid ? ""
243+
: signalStrength.value > 75 ? "qrc:/images/icon_WiFi_4_32.svg"
244+
: signalStrength.value > 50 ? "qrc:/images/icon_WiFi_3_32.svg"
245+
: signalStrength.value > 25 ? "qrc:/images/icon_WiFi_2_32.svg"
246+
: signalStrength.value > 0 ? "qrc:/images/icon_WiFi_1_32.svg"
247+
: "qrc:/images/icon_WiFi_noconnection_32.svg"
248+
249+
KeyNavigation.right: notificationButton
250+
251+
onClicked: root.wifiButtonClicked()
256252

257253
VeQuickItem {
258254
id: signalStrength

pages/MainView.qml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,11 @@ FocusScope {
426426
}
427427
}
428428

429+
onWifiButtonClicked: {
430+
Global.pageManager.pushPage("/pages/settings/PageSettingsWifi.qml",
431+
{"title": qsTrId("pagesettingsconnectivity_wifi")})
432+
}
433+
429434
onPopToPage: function(toPage) {
430435
pageManager.popPage(toPage)
431436
}

0 commit comments

Comments
 (0)