Changeset View
Changeset View
Standalone View
Standalone View
lookandfeel/contents/components/Battery.qml
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright 2016 Kai Uwe Broulik <kde@privat.broulik.de> | ||||
3 | * | ||||
4 | * This program is free software; you can redistribute it and/or modify | ||||
5 | * it under the terms of the GNU Library General Public License as | ||||
6 | * published by the Free Software Foundation; either version 2 or | ||||
7 | * (at your option) any later version. | ||||
8 | * | ||||
9 | * This program is distributed in the hope that it will be useful, | ||||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
12 | * GNU General Public License for more details | ||||
13 | * | ||||
14 | * You should have received a copy of the GNU Library General Public | ||||
15 | * License along with this program; if not, write to the | ||||
16 | * Free Software Foundation, Inc., | ||||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
18 | */ | ||||
19 | | ||||
20 | import QtQuick 2.2 | ||||
21 | | ||||
22 | import org.kde.plasma.core 2.0 as PlasmaCore | ||||
23 | import org.kde.plasma.components 2.0 as PlasmaComponents | ||||
24 | import org.kde.plasma.workspace.components 2.0 as PW | ||||
25 | | ||||
26 | Row { | ||||
27 | spacing: units.smallSpacing | ||||
28 | visible: pmSource.data["Battery"]["Has Cumulative"] | ||||
29 | | ||||
30 | PlasmaCore.DataSource { | ||||
31 | id: pmSource | ||||
32 | engine: "powermanagement" | ||||
33 | connectedSources: ["Battery", "AC Adapter"] | ||||
34 | } | ||||
35 | | ||||
36 | PW.BatteryIcon { | ||||
37 | id: battery | ||||
38 | hasBattery: true | ||||
39 | percent: pmSource.data["Battery"]["Percent"] | ||||
40 | pluggedIn: pmSource.data["AC Adapter"] ? pmSource.data["AC Adapter"]["Plugged in"] : false | ||||
41 | | ||||
42 | height: batteryLabel.height | ||||
43 | width: height | ||||
44 | } | ||||
45 | | ||||
46 | PlasmaComponents.Label { | ||||
47 | id: batteryLabel | ||||
48 | height: undefined | ||||
49 | text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","%1%", battery.percent) | ||||
50 | } | ||||
51 | } |