Warning, /plasma/libksysguard/faces/facepackages/horizontalbars/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 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 import QtQuick
0010 import QtQuick.Layouts
0011 
0012 import org.kde.kirigami as Kirigami
0013 
0014 import org.kde.ksysguard.sensors as Sensors
0015 import org.kde.ksysguard.faces as Faces
0016 
0017 import org.kde.quickcharts as Charts
0018 import org.kde.quickcharts.controls as ChartsControls
0019 
0020 Faces.SensorFace {
0021     id: root
0022 
0023     // Arbitrary minimumWidth to make easier to align plasmoids in a predictable way
0024     Layout.minimumWidth: Kirigami.Units.gridUnit * 8
0025     Layout.preferredWidth: titleMetrics.width
0026 
0027     contentItem: ColumnLayout {
0028         spacing: Kirigami.Units.smallSpacing
0029 
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         Item { Layout.fillWidth: true; Layout.fillHeight: true }
0046 
0047         Repeater {
0048             model: root.controller.highPrioritySensorIds
0049 
0050             ColumnLayout {
0051                 Layout.fillWidth: true
0052                 Layout.bottomMargin: Kirigami.Units.smallSpacing
0053                 spacing: 0
0054                 Bar {
0055                     sensor: sensor
0056                     controller: root.controller
0057                     color: root.colorSource.map[modelData]
0058                 }
0059                 ChartsControls.LegendDelegate {
0060                     readonly property bool isTextOnly: index >= root.controller.highPrioritySensorIds.length
0061 
0062                     Layout.fillWidth: true
0063                     Layout.minimumHeight: isTextOnly ? 0 : implicitHeight
0064 
0065                     name: root.controller.sensorLabels[sensor.sensorId] || sensor.name
0066                     shortName: root.controller.sensorLabels[sensor.sensorId] || sensor.shortName
0067                     value: sensor.formattedValue
0068                     indicator: Item {}
0069 
0070                     maximumValueWidth: Kirigami.Units.gridUnit * 2
0071 
0072                     Sensors.Sensor {
0073                         id: sensor
0074                         sensorId: modelData
0075                         updateRateLimit: root.controller.updateRateLimit
0076                     }
0077                 }
0078             }
0079         }
0080         Kirigami.Separator {
0081             Layout.fillWidth: true
0082             visible: root.controller.lowPrioritySensorIds.length > 0
0083         }
0084         Repeater {
0085             model: root.controller.lowPrioritySensorIds
0086             ChartsControls.LegendDelegate {
0087 
0088                 Layout.fillWidth: true
0089                 Layout.minimumHeight: implicitHeight
0090 
0091                 name: root.controller.sensorLabels[sensor.sensorId] || sensor.shortName
0092                 value: sensor.formattedValue
0093                 indicator: Item {}
0094 
0095                 maximumValueWidth: Kirigami.Units.gridUnit * 2
0096 
0097                 Sensors.Sensor {
0098                     id: sensor
0099                     sensorId: modelData
0100                     updateRateLimit: root.controller.updateRateLimit
0101                 }
0102             }
0103         }
0104 
0105 
0106         Item { Layout.fillWidth: true; Layout.fillHeight: true }
0107     }
0108 }