Warning, /plasma/libksysguard/faces/facepackages/piechart/contents/ui/FullRepresentation.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2019 Marco Martin <mart@kde.org>
0003     SPDX-FileCopyrightText: 2019 David Edmundson <davidedmundson@kde.org>
0004     SPDX-FileCopyrightText: 2019 Arjen Hiemstra <ahiemstra@heimr.nl>
0005     SPDX-FileCopyrightText: 2019 Kai Uwe Broulik <kde@broulik.de>
0006 
0007     SPDX-License-Identifier: LGPL-2.0-or-later
0008 */
0009 
0010 import QtQuick
0011 import QtQuick.Layouts
0012 
0013 import org.kde.kirigami as Kirigami
0014 
0015 import org.kde.ksysguard.sensors as Sensors
0016 import org.kde.ksysguard.faces as Faces
0017 
0018 import org.kde.quickcharts as Charts
0019 import org.kde.quickcharts.controls as ChartsControls
0020 
0021 Faces.SensorFace {
0022     id: root
0023     readonly property bool showLegend: controller.faceConfiguration.showLegend
0024 
0025     Layout.minimumWidth: Kirigami.Units.gridUnit * 8
0026     Layout.preferredWidth: titleMetrics.width
0027 
0028     contentItem: ColumnLayout {
0029         spacing: Kirigami.Units.largeSpacing
0030         Kirigami.Heading {
0031             id: heading
0032             Layout.fillWidth: true
0033             horizontalAlignment: Text.AlignHCenter
0034             elide: Text.ElideRight
0035             text: root.controller.title
0036             visible: root.controller.showTitle && text.length > 0
0037             level: 2
0038             TextMetrics {
0039                 id: titleMetrics
0040                 font: heading.font
0041                 text: heading.text
0042             }
0043         }
0044 
0045         PieChart {
0046             id: compactRepresentation
0047             Layout.fillWidth: true
0048             Layout.fillHeight: true
0049             Layout.minimumWidth: root.formFactor != Faces.SensorFace.Vertical ? Kirigami.Units.gridUnit * 4 : Kirigami.Units.gridUnit
0050             Layout.minimumHeight: root.formFactor === Faces.SensorFace.Constrained 
0051                 ? 3 * Kirigami.Units.gridUnit
0052                 : 5 * Kirigami.Units.gridUnit
0053             Layout.preferredHeight: 8 * Kirigami.Units.gridUnit
0054             Layout.maximumHeight: Math.max(heading.width, Layout.minimumHeight)
0055             updateRateLimit: root.controller.updateRateLimit
0056         }
0057 
0058         Faces.ExtendedLegend {
0059             Layout.fillWidth: true
0060             Layout.fillHeight: true
0061             Layout.minimumHeight: implicitHeight
0062             visible: root.showLegend
0063             chart: compactRepresentation.chart
0064             sourceModel: root.showLegend ? compactRepresentation.sensorsModel : null
0065             sensorIds: root.showLegend ? root.controller.lowPrioritySensorIds : []
0066             updateRateLimit: root.controller.updateRateLimit
0067         }
0068     }
0069 }