Commit bc9b5a98 authored by Aleksi Suomalainen's avatar Aleksi Suomalainen

Merge pull request #16 from locusf/wifi_statusbar

[statusbar] Icon values for different wifi signal strengths.
parents 5d9bade3 a6504686
......@@ -24,6 +24,7 @@ Requires: nemo-qml-plugin-time-qt5
Requires: qt5-qtdeclarative-import-window2
Requires: qt5-qtquickcontrols-nemo
Requires: nemo-qml-plugin-contextkit-qt5
Requires: connman-qt5
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Quick)
BuildRequires: pkgconfig(lipstick-qt5) >= 0.12.0
......
......@@ -32,6 +32,7 @@ import QtQuick 2.1
import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0
import org.freedesktop.contextkit 1.0
import MeeGo.Connman 0.2
Item {
id: root
......@@ -64,6 +65,24 @@ Item {
key: "Cellular.RegistrationStatus"
}
NetworkManager {
id: networkManager
function updateTechnologies() {
if (available && technologiesEnabled) {
wlan.path = networkManager.technologyPathForType("wifi")
}
}
onAvailableChanged: updateTechnologies()
onTechnologiesEnabledChanged: updateTechnologies()
onTechnologiesChanged: updateTechnologies()
}
NetworkTechnology {
id: wlan
}
Row {
spacing: 16
StatusbarItem {
......@@ -71,7 +90,23 @@ Item {
}
StatusbarItem {
source: {
return "image://theme/icon_wifi_normal1"
if (wlan.connected) {
if (networkManager.defaultRoute.type !== "wifi")
return "image://theme/icon_wifi_0"
if (networkManager.defaultRoute.strength >= 59) {
return "image://theme/icon_wifi_normal4"
} else if (networkManager.defaultRoute.strength >= 55) {
return "image://theme/icon_wifi_normal3"
} else if (networkManager.defaultRoute.strength >= 50) {
return "image://theme/icon_wifi_normal2"
} else if (networkManager.defaultRoute.strength >= 40) {
return "image://theme/icon_wifi_normal1"
} else {
return "image://theme/icon_wifi_0"
}
} else {
return "image://theme/icon_wifi_0"
}
}
}
StatusbarItem {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment