Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[WiFi] networks list ended
  • Loading branch information
neochapay committed Apr 2, 2017
1 parent 1242bbb commit 9ee20b8
Showing 1 changed file with 39 additions and 29 deletions.
68 changes: 39 additions & 29 deletions qml/plugins/wifi/wifi.qml
Expand Up @@ -37,37 +37,41 @@ Page {
}

model: networkingModel
delegate: Item {
width: parent.width
delegate: ListViewItemWithActions{
height: 80


Image {
id: statusImage
width: 56
height: 56
fillMode: Image.PreserveAspectFit

anchors{
left: parent.left
verticalCenter: parent.verticalCenter
label: modelData.name

description: {
var state = modelData.state;
var security = modelData.security[0];

if ((state == "online") || (state == "ready")) {
return qsTr("connected");
} else if (state == "association" || state == "configuration") {
return qsTr("connecting")+"...";
} else {
if (security == "none") {
return qsTr("open");
} else {
return qsTr("secure");
}
}

source: (getStrengthIndex(modelData.strength) === "0")? "image://theme/icon_wifi_0" : "image://theme/icon_wifi_focused" + getStrengthIndex(modelData.strength)
}

Label {
anchors{
left: statusImage.right
leftMargin: 20
verticalCenter: statusImage.verticalCenter
icon: (getStrengthIndex(modelData.strength) === "0")? "image://theme/icon_wifi_0" : "image://theme/icon_wifi_focused" + getStrengthIndex(modelData.strength)

onClicked:{
if (modelData.state == "idle" || modelData.state == "failure")
{
modelData.requestConnect();
networkingModel.networkName.text = modelData.name;
} else {
console.log("Show network status page");
for (var key in modelData.ipv4)
{
console.log(key + " -> " + modelData.ipv4[key]);
}
}
width: root.width
font.pointSize: 20
text: modelData.name
wrapMode: Text.Wrap
}

}
}

Expand All @@ -76,11 +80,17 @@ Page {

if (strength >= 59) {
strengthIndex = "4"
} else if (strength >= 55) {
}
else if (strength >= 55)
{
strengthIndex = "3"
} else if (strength >= 50) {
}
else if (strength >= 50)
{
strengthIndex = "2"
} else if (strength >= 40) {
}
else if (strength >= 40)
{
strengthIndex = "1"
}
return strengthIndex
Expand Down

0 comments on commit 9ee20b8

Please sign in to comment.