mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-28 06:33:09 +00:00
powermanagement-kcm: Port to FormCard
This commit is contained in:
parent
dc047a0eb9
commit
8030c73c67
1 changed files with 134 additions and 157 deletions
|
|
@ -1,20 +1,18 @@
|
||||||
/*
|
// SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||||
SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
// SPDX-FileCopyrightText: 2023 Carl Schwan <carl@carlschwan.eu>
|
||||||
|
// SPDX-License-Identifier: LGPL-2.0-or-later
|
||||||
|
|
||||||
SPDX-License-Identifier: LGPL-2.0-or-later
|
import QtQuick
|
||||||
*/
|
import QtQuick.Controls as QQC2
|
||||||
|
import QtQuick.Layouts
|
||||||
|
|
||||||
import QtQuick 2.2
|
import org.kde.kirigami as Kirigami
|
||||||
import QtQuick.Controls 2.10 as QQC2
|
import org.kde.plasma.components 3 as PlasmaComponents
|
||||||
import QtQuick.Layouts 1.11
|
|
||||||
|
|
||||||
import org.kde.kirigami 2.10 as Kirigami
|
|
||||||
import org.kde.plasma.components 3.0 as PlasmaComponents
|
|
||||||
import org.kde.kcmutils
|
import org.kde.kcmutils
|
||||||
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm
|
import org.kde.kirigamiaddons.formcard 1 as FormCard
|
||||||
import org.kde.kcm.power.mobile.private 1.0
|
import org.kde.kcm.power.mobile.private
|
||||||
|
|
||||||
Kirigami.ScrollablePage {
|
FormCard.FormCardPage {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property QtObject battery
|
property QtObject battery
|
||||||
|
|
@ -24,36 +22,24 @@ Kirigami.ScrollablePage {
|
||||||
|
|
||||||
title: i18n("Battery Information")
|
title: i18n("Battery Information")
|
||||||
|
|
||||||
leftPadding: 0
|
data: HistoryModel {
|
||||||
rightPadding: 0
|
|
||||||
topPadding: Kirigami.Units.gridUnit
|
|
||||||
bottomPadding: Kirigami.Units.gridUnit
|
|
||||||
|
|
||||||
HistoryModel {
|
|
||||||
id: history
|
id: history
|
||||||
|
|
||||||
duration: 86400 // last 24 hours
|
duration: 86400 // last 24 hours
|
||||||
device: currentUdi
|
device: currentUdi
|
||||||
type: HistoryModel.ChargeType
|
type: HistoryModel.ChargeType
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
FormCard.FormHeader {
|
||||||
width: parent.width
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
MobileForm.FormCard {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
visible: history.count > 1
|
|
||||||
|
|
||||||
contentItem: ColumnLayout {
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
MobileForm.FormCardHeader {
|
|
||||||
title: i18n("Usage Graph")
|
title: i18n("Usage Graph")
|
||||||
|
visible: history.count > 1
|
||||||
}
|
}
|
||||||
|
|
||||||
MobileForm.AbstractFormDelegate {
|
FormCard.FormCard {
|
||||||
Layout.fillWidth: true
|
visible: history.count > 1
|
||||||
background: Item {}
|
|
||||||
|
FormCard.AbstractFormDelegate {
|
||||||
|
background: null
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
contentItem: Flickable {
|
contentItem: Flickable {
|
||||||
|
|
@ -86,28 +72,21 @@ Kirigami.ScrollablePage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
MobileForm.FormCard {
|
FormCard.FormHeader {
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.topMargin: Kirigami.Units.gridUnit
|
|
||||||
|
|
||||||
contentItem: ColumnLayout {
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
MobileForm.FormCardHeader {
|
|
||||||
title: i18n("Information")
|
title: i18n("Information")
|
||||||
}
|
}
|
||||||
|
|
||||||
MobileForm.FormTextDelegate {
|
FormCard.FormCard {
|
||||||
|
FormCard.FormTextDelegate {
|
||||||
id: isRechargeableDelegate
|
id: isRechargeableDelegate
|
||||||
text: i18n("Is Rechargeable")
|
text: i18n("Is Rechargeable")
|
||||||
description: battery.rechargeable ? i18n("Yes") : i18n("No")
|
description: battery.rechargeable ? i18n("Yes") : i18n("No")
|
||||||
}
|
}
|
||||||
|
|
||||||
MobileForm.FormDelegateSeparator {}
|
FormCard.FormDelegateSeparator {}
|
||||||
|
|
||||||
MobileForm.FormTextDelegate {
|
FormCard.FormTextDelegate {
|
||||||
id: chargeStateDelegate
|
id: chargeStateDelegate
|
||||||
text: i18n("Charge State")
|
text: i18n("Charge State")
|
||||||
description: {
|
description: {
|
||||||
|
|
@ -121,49 +100,49 @@ Kirigami.ScrollablePage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MobileForm.FormDelegateSeparator {}
|
FormCard.FormDelegateSeparator {}
|
||||||
|
|
||||||
MobileForm.FormTextDelegate {
|
FormCard.FormTextDelegate {
|
||||||
id: currentChargeDelegate
|
id: currentChargeDelegate
|
||||||
text: i18n("Current Charge")
|
text: i18n("Current Charge")
|
||||||
description: i18nc("%1 is percentage value", "%1 %", Number(battery.chargePercent).toLocaleString(Qt.locale(), "f", 0))
|
description: i18nc("%1 is percentage value", "%1 %", Number(battery.chargePercent).toLocaleString(Qt.locale(), "f", 0))
|
||||||
}
|
}
|
||||||
|
|
||||||
MobileForm.FormDelegateSeparator {}
|
FormCard.FormDelegateSeparator {}
|
||||||
|
|
||||||
MobileForm.FormTextDelegate {
|
FormCard.FormTextDelegate {
|
||||||
id: healthDelegate
|
id: healthDelegate
|
||||||
text: i18n("Health")
|
text: i18n("Health")
|
||||||
description: i18nc("%1 is percentage value", "%1 %", Number(battery.capacity).toLocaleString(Qt.locale(), "f", 0))
|
description: i18nc("%1 is percentage value", "%1 %", Number(battery.capacity).toLocaleString(Qt.locale(), "f", 0))
|
||||||
}
|
}
|
||||||
|
|
||||||
MobileForm.FormDelegateSeparator {}
|
FormCard.FormDelegateSeparator {}
|
||||||
|
|
||||||
MobileForm.FormTextDelegate {
|
FormCard.FormTextDelegate {
|
||||||
id: vendorDelegate
|
id: vendorDelegate
|
||||||
text: i18n("Vendor")
|
text: i18n("Vendor")
|
||||||
description: root.vendor
|
description: root.vendor
|
||||||
}
|
}
|
||||||
|
|
||||||
MobileForm.FormDelegateSeparator {}
|
FormCard.FormDelegateSeparator {}
|
||||||
|
|
||||||
MobileForm.FormTextDelegate {
|
FormCard.FormTextDelegate {
|
||||||
id: modelDelegate
|
id: modelDelegate
|
||||||
text: i18n("Model")
|
text: i18n("Model")
|
||||||
description: root.product
|
description: root.product
|
||||||
}
|
}
|
||||||
|
|
||||||
MobileForm.FormDelegateSeparator {}
|
FormCard.FormDelegateSeparator {}
|
||||||
|
|
||||||
MobileForm.FormTextDelegate {
|
FormCard.FormTextDelegate {
|
||||||
id: serialDelegate
|
id: serialDelegate
|
||||||
text: i18n("Serial Number")
|
text: i18n("Serial Number")
|
||||||
description: battery.serial
|
description: battery.serial
|
||||||
}
|
}
|
||||||
|
|
||||||
MobileForm.FormDelegateSeparator {}
|
FormCard.FormDelegateSeparator {}
|
||||||
|
|
||||||
MobileForm.FormTextDelegate {
|
FormCard.FormTextDelegate {
|
||||||
id: technologyDelegate
|
id: technologyDelegate
|
||||||
text: i18n("Technology")
|
text: i18n("Technology")
|
||||||
description: {
|
description: {
|
||||||
|
|
@ -180,5 +159,3 @@ Kirigami.ScrollablePage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue