Commit 28a33bf8 authored by Aleksi Suomalainen's avatar Aleksi Suomalainen

[statusbar] Wifi panel added for statusbar

parent b12c667c
...@@ -75,6 +75,7 @@ Item { ...@@ -75,6 +75,7 @@ Item {
onAvailableChanged: updateTechnologies() onAvailableChanged: updateTechnologies()
onTechnologiesEnabledChanged: updateTechnologies() onTechnologiesEnabledChanged: updateTechnologies()
onTechnologiesChanged: updateTechnologies() onTechnologiesChanged: updateTechnologies()
} }
NetworkTechnology { NetworkTechnology {
...@@ -91,6 +92,23 @@ Item { ...@@ -91,6 +92,23 @@ Item {
key: "Cellular.DataTechnology" key: "Cellular.DataTechnology"
} }
TechnologyModel {
id: wifimodel
name: "wifi"
onPoweredChanged: {
if (powered)
wifimodel.requestScan()
}
}
Loader {
id: panel_loader
anchors.bottom: root.top
height: 240
width: parent.width
visible: false
}
Row { Row {
spacing: 16 spacing: 16
StatusbarItem { StatusbarItem {
...@@ -140,6 +158,7 @@ Item { ...@@ -140,6 +158,7 @@ Item {
return "image://theme/icon_wifi_0" return "image://theme/icon_wifi_0"
} }
} }
panel: WifiPanel {}
} }
StatusbarItem { StatusbarItem {
source: "image://theme/icon_bt_normal" source: "image://theme/icon_bt_normal"
......
...@@ -4,7 +4,8 @@ Item { ...@@ -4,7 +4,8 @@ Item {
height: 48 height: 48
width: 48 width: 48
property alias source: icon.source property alias source: icon.source
property string panel_source
property Component panel
Image { Image {
id: icon id: icon
anchors.centerIn: parent anchors.centerIn: parent
...@@ -12,6 +13,15 @@ Item { ...@@ -12,6 +13,15 @@ Item {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
if (panel_source !== "" && !panel) {
panel_loader.source = panel_source
panel_loader.visible = !panel_loader.visible
}
if (panel && panel_source === "") {
panel_loader.sourceComponent = panel
panel_loader.visible = !panel_loader.visible
}
if (icon.source.toString().match("normal")) { if (icon.source.toString().match("normal")) {
icon.source = icon.source.toString().replace("normal","focused") icon.source = icon.source.toString().replace("normal","focused")
} else { } else {
......
/****************************************************************************************
**
** Copyright (C) 2014 Aleksi Suomalainen <suomalainen.aleksi@gmail.com>
** All rights reserved.
**
** You may use this file under the terms of BSD license as follows:
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** * Neither the name of the author nor the
** names of its contributors may be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
****************************************************************************************/
import QtQuick 2.1
import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0
Component {
Rectangle {
height: 240
width: root.width
color: "#313131"
opacity: 0.5
Column {
Repeater {
model: wifimodel
delegate: Item {
width: root.width
height: 40
function getStrengthIndex(strength) {
var strengthIndex = "0"
if (strength >= 59) {
strengthIndex = "4"
} else if (strength >= 55) {
strengthIndex = "3"
} else if (strength >= 50) {
strengthIndex = "2"
} else if (strength >= 40) {
strengthIndex = "1"
}
return strengthIndex
}
Row {
spacing: 12
Image {
source: "image://theme/icon_wifi_focused" + getStrengthIndex(modelData.strength)
}
Label {
anchors.leftMargin: 20
width: root.width
font.pointSize: 8
text: modelData.name
wrapMode: Text.Wrap
}
}
}
}
}
}
}
...@@ -39,5 +39,6 @@ ...@@ -39,5 +39,6 @@
<file>qml/Statusbar.qml</file> <file>qml/Statusbar.qml</file>
<file>qml/images/wallpaper-portrait-bubbles.png</file> <file>qml/images/wallpaper-portrait-bubbles.png</file>
<file>qml/StatusbarItem.qml</file> <file>qml/StatusbarItem.qml</file>
<file>qml/WifiPanel.qml</file>
</qresource> </qresource>
</RCC> </RCC>
...@@ -45,6 +45,7 @@ OTHER_FILES += qml/*.qml \ ...@@ -45,6 +45,7 @@ OTHER_FILES += qml/*.qml \
qml/scripts/desktop.js \ qml/scripts/desktop.js \
qml/FeedsPage.qml \ qml/FeedsPage.qml \
qml/Statusbar.qml \ qml/Statusbar.qml \
qml/StatusbarItem.qml qml/StatusbarItem.qml \
qml/WifiPanel.qml
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