Commit 659bdf70 authored by Sergey Chupligin's avatar Sergey Chupligin

[StatusBar] Update dir structure add animation of charging

parent f3242fa6
/**************************************************************************************** /****************************************************************************************
** **
** Copyright (C) 2014 Aleksi Suomalainen <suomalainen.aleksi@gmail.com> ** Copyright (C) 2014 Aleksi Suomalainen <suomalainen.aleksi@gmail.com>
** Copyright (C) 2017 Sergey Chupligin <mail@neochapay.ru>
** All rights reserved. ** All rights reserved.
** **
** You may use this file under the terms of BSD license as follows: ** You may use this file under the terms of BSD license as follows:
...@@ -36,6 +37,8 @@ import org.freedesktop.contextkit 1.0 ...@@ -36,6 +37,8 @@ import org.freedesktop.contextkit 1.0
import MeeGo.Connman 0.2 import MeeGo.Connman 0.2
import org.nemomobile.lipstick 0.1 import org.nemomobile.lipstick 0.1
import "statusbar"
Item { Item {
id: root id: root
z: 201 z: 201
...@@ -69,12 +72,6 @@ Item { ...@@ -69,12 +72,6 @@ Item {
} }
} }
ContextProperty {
id: batteryChargePercentage
key: "Battery.ChargePercentage"
value: "100"
}
ContextProperty { ContextProperty {
id: cellularSignalBars id: cellularSignalBars
key: "Cellular.SignalBars" key: "Cellular.SignalBars"
...@@ -245,28 +242,6 @@ Item { ...@@ -245,28 +242,6 @@ Item {
} }
} }
StatusbarItem { BatteryIndicator{}
iconSize: root.height/2
panel: BatteryPanel {}
source: {
if(batteryChargePercentage.value > 85) {
return "/usr/share/lipstick-glacier-home-qt5/qml/images/battery6.png"
} else if (batteryChargePercentage.value <= 5) {
return "/usr/share/lipstick-glacier-home-qt5/qml/images/battery0.png"
} else if (batteryChargePercentage.value <= 10) {
return "/usr/share/lipstick-glacier-home-qt5/qml/images/battery1.png"
} else if (batteryChargePercentage.value <= 25) {
return "/usr/share/lipstick-glacier-home-qt5/qml/images/battery2.png"
} else if (batteryChargePercentage.value <= 40) {
return "/usr/share/lipstick-glacier-home-qt5/qml/imagesbattery3.png"
} else if (batteryChargePercentage.value <= 65) {
return "/usr/share/lipstick-glacier-home-qt5/qml/images/battery4.png"
} else if (batteryChargePercentage.value <= 80) {
return "/usr/share/lipstick-glacier-home-qt5/qml/images/battery5.png"
} else {
return "/usr/share/lipstick-glacier-home-qt5/qml/images/battery6.png"
}
}
}
} }
} }
import QtQuick 2.0
import org.freedesktop.contextkit 1.0
StatusbarItem {
id: batteryIndicator
property int chargeValue: 0
ContextProperty {
id: batteryChargePercentage
key: "Battery.ChargePercentage"
value: "100"
}
ContextProperty {
id: batteryStateContextProperty
key: "Battery.State"
onValueChanged: {
if(batteryStateContextProperty.value == "charging")
{
chargingTimer.start()
}
else
{
chargingTimer.stop()
chargeIcon();
}
}
}
iconSize: root.height/2
panel: BatteryPanel {}
source: "/usr/share/lipstick-glacier-home-qt5/qml/images/battery"+chargeValue+".png"
Timer{
id: chargingTimer
interval: 500
repeat: true
running: false
onTriggered: {
if(batteryIndicator.chargeValue == 6)
{
batteryIndicator.chargeValue = 0
}
else
{
batteryIndicator.chargeValue++
}
}
}
Component.onCompleted: {
chargeIcon();
}
function chargeIcon()
{
if(batteryChargePercentage.value > 85) {
batteryIndicator.chargeValue = 6
} else if (batteryChargePercentage.value <= 5) {
batteryIndicator.chargeValue = 0
} else if (batteryChargePercentage.value <= 10) {
batteryIndicator.chargeValue = 1
} else if (batteryChargePercentage.value <= 25) {
batteryIndicator.chargeValue = 2
} else if (batteryChargePercentage.value <= 40) {
batteryIndicator.chargeValue = 3
} else if (batteryChargePercentage.value <= 65) {
batteryIndicator.chargeValue = 4
} else if (batteryChargePercentage.value <= 80) {
batteryIndicator.chargeValue = 5
} else {
batteryIndicator.chargeValue = 6
}
}
}
...@@ -35,9 +35,13 @@ import QtQuick.Controls.Styles.Nemo 1.0 ...@@ -35,9 +35,13 @@ import QtQuick.Controls.Styles.Nemo 1.0
Component { Component {
CommonPanel { CommonPanel {
name: qsTr("Battery");
switcherEnabled: false
Label { Label {
text: qsTr("Battery level")+ ": " + batteryChargePercentage.value + "%" text: qsTr("Level")+ ": " + batteryChargePercentage.value + "%"
font.pointSize: 8 font.pointSize: 8
anchors.centerIn: parent
} }
} }
} }
...@@ -38,6 +38,9 @@ import QtQuick.Layouts 1.0 ...@@ -38,6 +38,9 @@ import QtQuick.Layouts 1.0
Component { Component {
CommonPanel { CommonPanel {
id: simpanel id: simpanel
name: qsTr("SimCard")
switcherEnabled: false
property bool needsPin: simManager.pinRequired === OfonoSimManager.SimPin || property bool needsPin: simManager.pinRequired === OfonoSimManager.SimPin ||
simManager.pinRequired === OfonoSimManager.SimPuk simManager.pinRequired === OfonoSimManager.SimPuk
onNeedsPinChanged: { onNeedsPinChanged: {
...@@ -136,6 +139,7 @@ Component { ...@@ -136,6 +139,7 @@ Component {
visible: !needsPin visible: !needsPin
text: qsTr("No pin required!") text: qsTr("No pin required!")
font.pointSize: 16 font.pointSize: 16
anchors.centerIn: parent
} }
} }
} }
...@@ -82,7 +82,7 @@ Component { ...@@ -82,7 +82,7 @@ Component {
Label { Label {
anchors{ anchors{
leftMargin: 20 leftMargin: 20
vertialCenter: statusImage.verticalCenter verticalCenter: statusImage.verticalCenter
} }
width: root.width width: root.width
font.pointSize: 8 font.pointSize: 8
......
...@@ -70,8 +70,26 @@ notifications.path = /usr/share/lipstick-glacier-home-qt5/qml/notifications ...@@ -70,8 +70,26 @@ notifications.path = /usr/share/lipstick-glacier-home-qt5/qml/notifications
notifications.files = qml/notifications/NotificationItem.qml\ notifications.files = qml/notifications/NotificationItem.qml\
qml/notifications/NotificationPreview.qml qml/notifications/NotificationPreview.qml
statusbar.path = /usr/share/lipstick-glacier-home-qt5/qml/statusbar
INSTALLS += styles images theme qml qmlcompositor scripts system volumecontrol connectivity notifications statusbar.files = qml/statusbar/BatteryPanel.qml\
qml/statusbar/BatteryIndicator.qml \
qml/statusbar/CommonPanel.qml\
qml/statusbar/SimPanel.qml\
qml/statusbar/WifiPanel.qml\
qml/statusbar/StatusbarItem.qml\
qml/statusbar/NumButton.qml
INSTALLS += styles \
images \
theme \
qml \
qmlcompositor\
scripts\
system\
volumecontrol\
connectivity\
notifications\
statusbar
CONFIG += qt link_pkgconfig CONFIG += qt link_pkgconfig
QT += quick compositor QT += quick compositor
...@@ -122,4 +140,5 @@ TRANSLATIONS += i18n/glacer-home.ts ...@@ -122,4 +140,5 @@ TRANSLATIONS += i18n/glacer-home.ts
DISTFILES += \ DISTFILES += \
i18n/glacer-home.ts \ i18n/glacer-home.ts \
qml/connectivity/ConnectionSelector.qml qml/connectivity/ConnectionSelector.qml \
qml/statusbar/BatteryIndicator.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