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) 2017 Sergey Chupligin <mail@neochapay.ru>
** All rights reserved.
**
** You may use this file under the terms of BSD license as follows:
......@@ -36,6 +37,8 @@ import org.freedesktop.contextkit 1.0
import MeeGo.Connman 0.2
import org.nemomobile.lipstick 0.1
import "statusbar"
Item {
id: root
z: 201
......@@ -67,13 +70,7 @@ Item {
cellularDataTechnology.unsubscribe()
}
}
}
ContextProperty {
id: batteryChargePercentage
key: "Battery.ChargePercentage"
value: "100"
}
}
ContextProperty {
id: cellularSignalBars
......@@ -245,28 +242,6 @@ Item {
}
}
StatusbarItem {
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"
}
}
}
BatteryIndicator{}
}
}
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
Component {
CommonPanel {
name: qsTr("Battery");
switcherEnabled: false
Label {
text: qsTr("Battery level")+ ": " + batteryChargePercentage.value + "%"
text: qsTr("Level")+ ": " + batteryChargePercentage.value + "%"
font.pointSize: 8
anchors.centerIn: parent
}
}
}
......@@ -38,6 +38,9 @@ import QtQuick.Layouts 1.0
Component {
CommonPanel {
id: simpanel
name: qsTr("SimCard")
switcherEnabled: false
property bool needsPin: simManager.pinRequired === OfonoSimManager.SimPin ||
simManager.pinRequired === OfonoSimManager.SimPuk
onNeedsPinChanged: {
......@@ -136,6 +139,7 @@ Component {
visible: !needsPin
text: qsTr("No pin required!")
font.pointSize: 16
anchors.centerIn: parent
}
}
}
......@@ -82,7 +82,7 @@ Component {
Label {
anchors{
leftMargin: 20
vertialCenter: statusImage.verticalCenter
verticalCenter: statusImage.verticalCenter
}
width: root.width
font.pointSize: 8
......
......@@ -70,8 +70,26 @@ notifications.path = /usr/share/lipstick-glacier-home-qt5/qml/notifications
notifications.files = qml/notifications/NotificationItem.qml\
qml/notifications/NotificationPreview.qml
INSTALLS += styles images theme qml qmlcompositor scripts system volumecontrol connectivity notifications
statusbar.path = /usr/share/lipstick-glacier-home-qt5/qml/statusbar
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
QT += quick compositor
......@@ -122,4 +140,5 @@ TRANSLATIONS += i18n/glacer-home.ts
DISTFILES += \
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