Commit 61263bc7 authored by eekkelund's avatar eekkelund

[StatusBar] Add powersave options to Battery statusbar

parent 575c68d5
......@@ -161,17 +161,18 @@ Page {
width: parent.width
height: parent.height
z: 200
}
DeviceLockUI {
id: codePad
visible: DeviceLock.state == DeviceLock.Locked && codepadVisible
width: lockScreen.width
height:lockScreen.height / 2
anchors {
verticalCenter: lockScreen.verticalCenter
}
z: 200
DeviceLockUI {
id: codePad
visible: DeviceLock.state == DeviceLock.Locked && codepadVisible
width: lockScreen.width
height:lockScreen.height / 2
anchors {
verticalCenter: lockScreen.verticalCenter
}
z: 200
}
}
}
......@@ -97,15 +97,6 @@ MouseArea {
script: switcherItemRoot.close()
}
}
/* Label {
anchors {
top: parent.top
horizontalCenter: parent.horizontalCenter
topMargin: Theme.itemSpacingHuge
}
font.pointSize: Theme.fontSizeTiny
text: Lipstick.compositor.windowForId(model.window).title
}*/
CloseButton {
id: closeButton
......
......@@ -32,16 +32,126 @@
import QtQuick 2.1
import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0
import QtQuick.Layouts 1.0
import org.nemomobile.dbus 2.0
Component {
CommonPanel {
name: qsTr("Battery");
switcherEnabled: false
ColumnLayout {
anchors.fill: parent
spacing: Theme.itemSpacingSmall
Label {
id:percentageLabel
text: qsTr("Level")+ ": " + batteryChargePercentage.value + "%"
font.pixelSize: Theme.fontSizeSmall
anchors.leftMargin: Theme.itemSpacingSmall
anchors.horizontalCenter: parent.horizontalCenter
}
Item {
id:powerSaveWrapper
//Copyright Andrey Kozhevnikov https://github.com/CODeRUS/jolla-settings-powersave/blob/master/settings/mainpage.qml
Layout.fillWidth: true
Layout.fillHeight: true
Label {
text: qsTr("Level")+ ": " + batteryChargePercentage.value + "%"
font.pixelSize: Theme.fontSizeMedium
anchors.centerIn: parent
property string key_threshold_value: "/system/osso/dsm/energymanagement/psm_threshold"
property string key_powersave_enable: "/system/osso/dsm/energymanagement/enable_power_saving"
property string key_powersave_force: "/system/osso/dsm/energymanagement/force_power_saving"
property variant threshold_value
property variant powersave_enable
property variant powersave_force
property var values: {
"/system/osso/dsm/energymanagement/psm_threshold": 50,
"/system/osso/dsm/energymanagement/enable_power_saving": true,
"/system/osso/dsm/energymanagement/force_power_saving": true
}
DBusInterface {
id: mceRequestIface
service: 'com.nokia.mce'
path: '/com/nokia/mce/request'
iface: 'com.nokia.mce.request'
bus: DBus.SystemBus
function setValue(key, value) {
typedCall('set_config', [{"type":"s", "value":key}, {"type":"v", "value":value}])
}
function getValue(key) {
typedCall('get_config', [{"type":"s", "value":key}], function (value) {
var temp = powerSaveWrapper.values
temp[key] = value
powerSaveWrapper.values = temp
})
}
Component.onCompleted: {
getValue(powerSaveWrapper.key_threshold_value)
getValue(powerSaveWrapper.key_powersave_enable)
getValue(powerSaveWrapper.key_powersave_force)
}
}
DBusInterface {
id: mceSignalIface
service: 'com.nokia.mce'
path: '/com/nokia/mce/signal'
iface: 'com.nokia.mce.signal'
bus: DBus.SystemBus
signalsEnabled: true
function config_change_ind(key, value) {
if (key in powerSaveWrapper.values) {
var temp = powerSaveWrapper.values
temp[key] = value
powerSaveWrapper.values = temp
}
}
}
CheckBox {
id:enablePowerSave
property string entryPath: "system_settings/info/powersave/powersave_enable"
checked: powerSaveWrapper.values[powerSaveWrapper.key_powersave_enable]
text: qsTr("Enable powersave mode")
onClicked: mceRequestIface.setValue(powerSaveWrapper.key_powersave_enable, checked)
}
Slider {
id: powerSaveSlider
width: parent.width -Theme.itemHeightMedium
anchors.top:enablePowerSave.bottom
anchors.topMargin: Theme.itemSpacingSmall
property string entryPath: "system_settings/info/powersave/powersave_threshold"
minimumValue: 1
maximumValue: 99
//label: "Battery threshold"
showValue: true
stepSize: 1
value: powerSaveWrapper.values[powerSaveWrapper.key_threshold_value] ? powerSaveWrapper.values[powerSaveWrapper.key_threshold_value] : 0
onPressedChanged: if(!pressed) mceRequestIface.typedCall('set_config', [{"type": "s", "value": powerSaveWrapper.key_threshold_value},
{"type": "v", "value": parseInt(value)}])
}
CheckBox {
id:forcePowerSave
anchors.top:powerSaveSlider.bottom
anchors.topMargin: Theme.itemSpacingSmall
property string entryPath: "system_settings/info/powersave/powersave_force"
checked: powerSaveWrapper.values[powerSaveWrapper.key_powersave_force]
onClicked: mceRequestIface.setValue(powerSaveWrapper.key_powersave_force, checked)
text: qsTr("Force powersave mode")
}
}
}
}
}
......@@ -83,6 +83,7 @@ Rectangle {
top: commonPanel.top
topMargin: Theme.itemSpacingLarge
}
height: nameLabel.height
width: parent.width
Label{
id: nameLabel
......@@ -115,7 +116,7 @@ Rectangle {
left: parent.left
leftMargin: Theme.itemSpacingLarge
top: actionColumn.bottom
topMargin: Theme.itemSpacingHuge*1.5
topMargin: Theme.itemSpacingMedium
}
}
//Just placeholder until IconButton will get merged
......
......@@ -139,7 +139,7 @@ Component {
visible: !needsPin
text: qsTr("No pin required!")
font.pixelSize:Theme.fontSizeMedium
anchors.centerIn: parent
anchors.horizontalCenter: parent.horizontalCenter
}
}
}
......@@ -54,6 +54,7 @@ Component {
]
Repeater {
anchors.top: parent.top
model: wifimodel
delegate: Item {
width: wifiPanel.width
......
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