Commit 2d97851b authored by Andrew Lake's avatar Andrew Lake
Browse files

use new icons in battery.svgz theme file. Also minor updates to improve icon...

use new icons in battery.svgz theme file. Also minor updates to improve icon with text vertical alignment.

REVIEW:118644
BUG:335377
parent 851241a0
......@@ -25,6 +25,7 @@ Item {
property bool hasBattery
property int percent
property bool pluggedIn
property string batteryType
PlasmaCore.Svg {
id: svg
......@@ -36,6 +37,7 @@ Item {
anchors.fill: parent
svg: svg
elementId: "Battery"
visible: elementForType(batteryType) == ""
}
PlasmaCore.SvgItem {
......@@ -43,7 +45,7 @@ Item {
anchors.fill: parent
svg: svg
elementId: hasBattery ? fillElement(percent) : "Unavailable"
visible: elementId != ""
visible: elementId != "" && elementForType(batteryType) == ""
}
function fillElement(p) {
......@@ -95,6 +97,32 @@ Item {
anchors.fill: parent
svg: svg
elementId: "AcAdapter"
visible: pluggedIn
visible: pluggedIn && elementForType(batteryType) == ""
}
PlasmaCore.SvgItem {
id: otherBatteriesSvg
anchors.fill: parent
svg: svg
elementId: elementForType(batteryType)
visible: elementId != ""
}
function elementForType(t) {
switch(t) {
case "Mouse":
return "MouseCharge";
case "Keyboard":
return "KeyboardCharge";
case "Pda":
return "PhoneCharge";
case "Phone":
return "PhoneCharge";
case "UPS":
return "UPSCharge";
default:
return "";
}
}
}
......@@ -67,15 +67,18 @@ Item {
right: parent.right
}
PlasmaCore.IconItem {
BatteryIcon {
id: batteryIcon
width: units.iconSizes.medium
width: units.iconSizes.large
height: width
anchors {
verticalCenter: parent.verticalCenter
left: parent.left
}
source: Logic.iconForBattery(model, charging)
batteryType: model["Type"]
percent: model["Percent"]
hasBattery: model["Plugged in"]
pluggedIn: model["State"] == "Charging" && model["Is Power Supply"]
}
SequentialAnimation {
......@@ -106,7 +109,7 @@ Item {
id: batteryNameLabel
anchors {
verticalCenter: isPresent ? undefined : batteryIcon.verticalCenter
top: isPresent ? parent.top : undefined
bottom: isPresent ? batteryIcon.verticalCenter : undefined
left: batteryIcon.right
leftMargin: units.gridUnit
}
......@@ -119,19 +122,18 @@ Item {
id: batteryStatusLabel
anchors {
top: batteryNameLabel.top
left: batteryNameLabel.right
leftMargin: Math.round(units.gridUnit / 3)
right: batteryPercentBar.right
}
text: Logic.stringForBatteryState(model)
height: implicitHeight
visible: model["Is Power Supply"]
color: "#77"+(theme.textColor.toString().substr(1))
color: "#AA"+(theme.textColor.toString().substr(1))
}
Components.ProgressBar {
id: batteryPercentBar
anchors {
bottom: parent.bottom
top: batteryIcon.verticalCenter
left: batteryNameLabel.left
right: parent.right
rightMargin: Math.round(units.gridUnit * 2.5)
......
......@@ -29,27 +29,31 @@ FocusScope {
width: parent.width
height: Math.max(brightnessIcon.height, brightnessLabel.height + brightnessSlider.height) + units.gridUnit
property alias icon: brightnessIcon.icon
property alias icon: brightnessIcon.elementId
property alias label: brightnessLabel.text
property alias value: brightnessSlider.value
property int percentage: 0
signal changed(int screenBrightness)
KQuickControlsAddons.QIconItem {
PlasmaCore.SvgItem {
id: brightnessIcon
width: units.iconSizes.medium
width: units.iconSizes.large
height: width
anchors {
top: parent.top
left: parent.left
}
svg: PlasmaCore.Svg {
id: svg
imagePath: "icons/battery"
}
}
Components.Label {
id: brightnessLabel
anchors {
top: parent.top
bottom: brightnessIcon.verticalCenter
left: brightnessIcon.right
leftMargin: units.gridUnit
}
......@@ -59,7 +63,7 @@ FocusScope {
Components.Slider {
id: brightnessSlider
anchors {
top: brightnessLabel.bottom
top: brightnessIcon.verticalCenter
left: brightnessLabel.left
right: parent.right
rightMargin: Math.round(units.gridUnit * 2.5)
......
......@@ -114,7 +114,7 @@ FocusScope {
BrightnessItem {
id: brightnessSlider
icon: "video-display"
icon: "DisplayBrightness"
label: i18n("Display Brightness")
visible: isBrightnessAvailable
onChanged: brightnessChanged(value)
......@@ -125,7 +125,7 @@ FocusScope {
BrightnessItem {
id: keyboardBrightnessSlider
icon: "input-keyboard"
icon: "KeyboardBrightness"
label: i18n("Keyboard Brightness")
visible: isKeyboardBrightnessAvailable
onChanged: keyboardBrightnessChanged(value)
......
Supports Markdown
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