mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-02 17:54:45 +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 QtQuick.Controls 2.10 as QQC2
|
||||
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.kirigami as Kirigami
|
||||
import org.kde.plasma.components 3 as PlasmaComponents
|
||||
import org.kde.kcmutils
|
||||
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm
|
||||
import org.kde.kcm.power.mobile.private 1.0
|
||||
import org.kde.kirigamiaddons.formcard 1 as FormCard
|
||||
import org.kde.kcm.power.mobile.private
|
||||
|
||||
Kirigami.ScrollablePage {
|
||||
FormCard.FormCardPage {
|
||||
id: root
|
||||
|
||||
property QtObject battery
|
||||
|
|
@ -24,36 +22,24 @@ Kirigami.ScrollablePage {
|
|||
|
||||
title: i18n("Battery Information")
|
||||
|
||||
leftPadding: 0
|
||||
rightPadding: 0
|
||||
topPadding: Kirigami.Units.gridUnit
|
||||
bottomPadding: Kirigami.Units.gridUnit
|
||||
|
||||
HistoryModel {
|
||||
data: HistoryModel {
|
||||
id: history
|
||||
|
||||
duration: 86400 // last 24 hours
|
||||
device: currentUdi
|
||||
type: HistoryModel.ChargeType
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
width: parent.width
|
||||
spacing: 0
|
||||
|
||||
MobileForm.FormCard {
|
||||
Layout.fillWidth: true
|
||||
visible: history.count > 1
|
||||
|
||||
contentItem: ColumnLayout {
|
||||
spacing: 0
|
||||
|
||||
MobileForm.FormCardHeader {
|
||||
FormCard.FormHeader {
|
||||
title: i18n("Usage Graph")
|
||||
visible: history.count > 1
|
||||
}
|
||||
|
||||
MobileForm.AbstractFormDelegate {
|
||||
Layout.fillWidth: true
|
||||
background: Item {}
|
||||
FormCard.FormCard {
|
||||
visible: history.count > 1
|
||||
|
||||
FormCard.AbstractFormDelegate {
|
||||
background: null
|
||||
clip: true
|
||||
|
||||
contentItem: Flickable {
|
||||
|
|
@ -86,28 +72,21 @@ Kirigami.ScrollablePage {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MobileForm.FormCard {
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: Kirigami.Units.gridUnit
|
||||
|
||||
contentItem: ColumnLayout {
|
||||
spacing: 0
|
||||
|
||||
MobileForm.FormCardHeader {
|
||||
FormCard.FormHeader {
|
||||
title: i18n("Information")
|
||||
}
|
||||
|
||||
MobileForm.FormTextDelegate {
|
||||
FormCard.FormCard {
|
||||
FormCard.FormTextDelegate {
|
||||
id: isRechargeableDelegate
|
||||
text: i18n("Is Rechargeable")
|
||||
description: battery.rechargeable ? i18n("Yes") : i18n("No")
|
||||
}
|
||||
|
||||
MobileForm.FormDelegateSeparator {}
|
||||
FormCard.FormDelegateSeparator {}
|
||||
|
||||
MobileForm.FormTextDelegate {
|
||||
FormCard.FormTextDelegate {
|
||||
id: chargeStateDelegate
|
||||
text: i18n("Charge State")
|
||||
description: {
|
||||
|
|
@ -121,49 +100,49 @@ Kirigami.ScrollablePage {
|
|||
}
|
||||
}
|
||||
|
||||
MobileForm.FormDelegateSeparator {}
|
||||
FormCard.FormDelegateSeparator {}
|
||||
|
||||
MobileForm.FormTextDelegate {
|
||||
FormCard.FormTextDelegate {
|
||||
id: currentChargeDelegate
|
||||
text: i18n("Current Charge")
|
||||
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
|
||||
text: i18n("Health")
|
||||
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
|
||||
text: i18n("Vendor")
|
||||
description: root.vendor
|
||||
}
|
||||
|
||||
MobileForm.FormDelegateSeparator {}
|
||||
FormCard.FormDelegateSeparator {}
|
||||
|
||||
MobileForm.FormTextDelegate {
|
||||
FormCard.FormTextDelegate {
|
||||
id: modelDelegate
|
||||
text: i18n("Model")
|
||||
description: root.product
|
||||
}
|
||||
|
||||
MobileForm.FormDelegateSeparator {}
|
||||
FormCard.FormDelegateSeparator {}
|
||||
|
||||
MobileForm.FormTextDelegate {
|
||||
FormCard.FormTextDelegate {
|
||||
id: serialDelegate
|
||||
text: i18n("Serial Number")
|
||||
description: battery.serial
|
||||
}
|
||||
|
||||
MobileForm.FormDelegateSeparator {}
|
||||
FormCard.FormDelegateSeparator {}
|
||||
|
||||
MobileForm.FormTextDelegate {
|
||||
FormCard.FormTextDelegate {
|
||||
id: technologyDelegate
|
||||
text: i18n("Technology")
|
||||
description: {
|
||||
|
|
@ -180,5 +159,3 @@ Kirigami.ScrollablePage {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue