Changeset View
Changeset View
Standalone View
Standalone View
Modules/energy/package/contents/ui/main.qml
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | 33 | KCM.SimpleKCM { | |||
---|---|---|---|---|---|
50 | property int historyType: HistoryModel.ChargeType | 50 | property int historyType: HistoryModel.ChargeType | ||
51 | 51 | | |||
52 | readonly property var details: [ | 52 | readonly property var details: [ | ||
53 | { | 53 | { | ||
54 | title: i18n("Battery"), | 54 | title: i18n("Battery"), | ||
55 | data: [ | 55 | data: [ | ||
56 | {label: i18n("Rechargeable"), value: "rechargeable"}, | 56 | {label: i18n("Rechargeable"), value: "rechargeable"}, | ||
57 | {label: i18n("Charge state"), value: "chargeState", modifier: "chargeState"}, | 57 | {label: i18n("Charge state"), value: "chargeState", modifier: "chargeState"}, | ||
58 | {label: i18n("Capacity degradation"), value: "capacity", unit: i18n("%"), precision: 0} | 58 | {label: i18n("Health"), value: "capacity", unit: i18n("%"), precision: 0} | ||
59 | ] | 59 | ] | ||
60 | }, | 60 | }, | ||
61 | { | 61 | { | ||
62 | title: i18n("Energy"), | 62 | title: i18n("Energy"), | ||
63 | data: [ | 63 | data: [ | ||
64 | {label: i18nc("current power draw from the battery in W", "Consumption"), value: "energyRate", unit: i18nc("Watt", "W"), precision: 2}, | 64 | {label: i18nc("current power draw from the battery in W", "Consumption"), value: "energyRate", unit: i18nc("Watt", "W"), precision: 2}, | ||
65 | {label: i18n("Voltage"), value: "voltage", unit: i18nc("Volt", "V"), precision: 2}, | 65 | {label: i18n("Voltage"), value: "voltage", unit: i18nc("Volt", "V"), precision: 2}, | ||
66 | {label: i18n("Remaining energy"), value: "energy", unit: i18nc("Watt-hours", "Wh"), precision: 2}, | 66 | {label: i18n("Remaining energy"), value: "energy", unit: i18nc("Watt-hours", "Wh"), precision: 2}, | ||
▲ Show 20 Lines • Show All 352 Lines • ▼ Show 20 Line(s) | 417 | Repeater { | |||
419 | model: modelData.data || [] | 419 | model: modelData.data || [] | ||
420 | 420 | | |||
421 | QQC2.Label { | 421 | QQC2.Label { | ||
422 | id: valueLabel | 422 | id: valueLabel | ||
423 | Kirigami.FormData.label: i18n("%1:", modelData.label) | 423 | Kirigami.FormData.label: i18n("%1:", modelData.label) | ||
424 | text: { | 424 | text: { | ||
425 | var value = currentBattery[modelData.value] | 425 | var value = currentBattery[modelData.value] | ||
426 | 426 | | |||
427 | // There's no "degradation" value we can look up, so | | |||
428 | // instead, process the capacity value to produce it | | |||
429 | if (modelData.value == "capacity") { | | |||
430 | value = 100 - value | | |||
431 | } | | |||
432 | | ||||
433 | if (typeof value === "boolean") { | 427 | if (typeof value === "boolean") { | ||
434 | if (value) { | 428 | if (value) { | ||
435 | return i18n("Yes") | 429 | return i18n("Yes") | ||
436 | } else { | 430 | } else { | ||
437 | return i18n("No") | 431 | return i18n("No") | ||
438 | } | 432 | } | ||
439 | } | 433 | } | ||
440 | 434 | | |||
Show All 27 Lines |