Commit 4b3155db authored by Aleksi Suomalainen's avatar Aleksi Suomalainen

[statusbar] Statusbar as Row with StatusbarItems.

parent 699ab01f
...@@ -48,35 +48,6 @@ Item { ...@@ -48,35 +48,6 @@ Item {
z: 200 z: 200
} }
Connections {
target: batteryChargePercentage
onValueChanged: {
if(batteryChargePercentage.value > 85) {
batteryimg.source = "images/battery6.png"
} else if (batteryChargePercentage.value <= 5) {
batteryimg.source = "images/battery0.png"
} else if (batteryChargePercentage.value <= 10) {
batteryimg.source = "images/battery1.png"
} else if (batteryChargePercentage.value <= 25) {
batteryimg.source = "images/battery2.png"
} else if (batteryChargePercentage.value <= 40) {
batteryimg.source = "images/battery3.png"
} else if (batteryChargePercentage.value <= 65) {
batteryimg.source = "images/battery4.png"
} else if (batteryChargePercentage.value <= 80) {
batteryimg.source = "images/battery5.png"
}
}
}
Connections {
target: cellularSignalBars
onValueChanged: {
cellularbars.text = cellularSignalBars.value
}
}
ContextProperty { ContextProperty {
id: batteryChargePercentage id: batteryChargePercentage
key: "Battery.ChargePercentage" key: "Battery.ChargePercentage"
...@@ -93,116 +64,65 @@ Item { ...@@ -93,116 +64,65 @@ Item {
key: "Cellular.RegistrationStatus" key: "Cellular.RegistrationStatus"
} }
Rectangle { Row {
id: cellular spacing: 16
anchors.left: parent.left StatusbarItem {
color: "transparent" source: "image://theme/icon_cell" + cellularSignalBars.value
height: 48
width: 48
anchors.margins: 8
Label {
id: cellularbars
width: 32
height: 32
font.pointSize: 8
} }
} StatusbarItem {
Rectangle { source: {
id: wifi return "image://theme/icon_wifi_normal1"
anchors.left: cellular.right
color: "transparent"
height: 48
width: 48
anchors.margins: 8
}
Rectangle {
id: bluetooth
anchors.left: wifi.right
color: "transparent"
height: 48
width: 48
anchors.margins: 8
Image {
source: bluetoothConnected.value !== undefined && bluetoothConnected.value ? "image://theme/icon-status-bluetooth-connected" : "image://theme/icon-status-bluetooth"
ContextProperty {
id: bluetoothEnabled
key: "Bluetooth.Enabled"
}
ContextProperty {
id: bluetoothConnected
key: "Bluetooth.Connected"
} }
} }
} StatusbarItem {
Rectangle { source: "image://theme/icon_bt_normal"
id: nfc
anchors.left: bluetooth.right
color: "transparent"
height: 48
width: 48
anchors.margins: 8
Image {
source: "image://theme/icon-nfc-enabled"
} }
} StatusbarItem {
Rectangle { source: "image://theme/icon_nfc_normal"
id: gps
anchors.left: nfc.right
color: "transparent"
height: 48
width: 48
anchors.margins: 8
Image {
source: "image://theme/icon-gps-enabled"
} }
} StatusbarItem {
Rectangle { source: "image://theme/icon_gps_normal"
id: playlist
anchors.left: gps.right
color: "transparent"
height: 48
width: 48
anchors.margins: 8
Image {
source: "image://theme/icon-playlist-playpause"
} }
} StatusbarItem {
Rectangle { source: "image://theme/icon_play_pause"
id: clock
anchors.left: playlist.right
color: "transparent"
height: 48
width: 48
anchors.margins: 8
Label {
id: hours
width: 16
height: 16
font.pointSize: 6
text: Qt.formatDateTime(wallClock.time, "hh")
} }
Label { StatusbarItem {
id: minutes Label {
anchors.top: hours.bottom id: hours
anchors.topMargin: 4 width: 16
width: 16 height: 16
height: 16 font.pointSize: 6
font.pointSize: 6 text: Qt.formatDateTime(wallClock.time, "hh")
text: Qt.formatDateTime(wallClock.time, "mm") }
Label {
id: minutes
anchors.top: hours.bottom
anchors.topMargin: 4
width: 16
height: 16
font.pointSize: 6
text: Qt.formatDateTime(wallClock.time, "mm")
}
} }
}
Rectangle { StatusbarItem {
anchors.right: parent.right source: {
height: 48 if(batteryChargePercentage.value > 85) {
width: 48 return "images/battery6.png"
color: "transparent" } else if (batteryChargePercentage.value <= 5) {
anchors.margins: 8 return "images/battery0.png"
Image { } else if (batteryChargePercentage.value <= 10) {
id: batteryimg return "images/battery1.png"
width: 32 } else if (batteryChargePercentage.value <= 25) {
height: 32 return "images/battery2.png"
} else if (batteryChargePercentage.value <= 40) {
return "images/battery3.png"
} else if (batteryChargePercentage.value <= 65) {
return "images/battery4.png"
} else if (batteryChargePercentage.value <= 80) {
return "images/battery5.png"
}
}
} }
} }
} }
import QtQuick 2.0
Item {
height: 48
width: 48
property alias source: icon.source
Image {
id: icon
anchors.centerIn: parent
}
MouseArea {
anchors.fill: parent
onClicked: {
if (icon.source.toString().match("normal")) {
icon.source = icon.source.toString().replace("normal","focused")
} else {
icon.source = icon.source.toString().replace("focused","normal")
}
}
}
}
...@@ -38,5 +38,6 @@ ...@@ -38,5 +38,6 @@
<file>qml/FeedsPage.qml</file> <file>qml/FeedsPage.qml</file>
<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>
</qresource> </qresource>
</RCC> </RCC>
...@@ -44,6 +44,7 @@ OTHER_FILES += qml/*.qml \ ...@@ -44,6 +44,7 @@ OTHER_FILES += qml/*.qml \
qml/NotificationPreview.qml \ qml/NotificationPreview.qml \
qml/scripts/desktop.js \ qml/scripts/desktop.js \
qml/FeedsPage.qml \ qml/FeedsPage.qml \
qml/Statusbar.qml qml/Statusbar.qml \
qml/StatusbarItem.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