Warning, /plasma/libksysguard/faces/facepackages/piechart/contents/ui/UsedTotalDisplay.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2020 Arjen Hiemstra <ahiemstra@heimr.nl> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 0008 import QtQuick.Controls 0009 import QtQuick.Layouts 0010 0011 import org.kde.kirigami as Kirigami 0012 0013 import org.kde.ksysguard.formatter as Formatter 0014 import org.kde.ksysguard.sensors as Sensors 0015 0016 Item { 0017 id: root 0018 0019 property alias usedSensor: usedSensorObject.sensorId 0020 property alias totalSensor: totalSensorObject.sensorId 0021 0022 property int updateRateLimit 0023 0024 property real contentMargin: 10 0025 0026 ColumnLayout { 0027 id: layout 0028 0029 anchors.centerIn: parent 0030 width: Math.min(parent.width, parent.height) * 0.75 0031 0032 spacing: 0 0033 0034 Label { 0035 id: usedLabel 0036 0037 Layout.fillWidth: true 0038 0039 text: chart.sensorsModel.sensorLabels[usedSensor] || (usedSensorObject.name + (usedSensorObject.shortName.length > 0 ? "\x9C" + usedSensorObject.shortName : "")) 0040 horizontalAlignment: Text.AlignHCenter 0041 font: Kirigami.Theme.smallFont 0042 color: Kirigami.Theme.disabledTextColor 0043 visible: totalValue.visible 0044 elide: Text.ElideRight 0045 0046 opacity: layout.y > root.contentMargin ? 1 : 0 0047 } 0048 0049 Label { 0050 id: usedValue 0051 Layout.fillWidth: true 0052 text: usedSensorObject.formattedValue 0053 horizontalAlignment: Text.AlignHCenter 0054 0055 fontSizeMode: Text.HorizontalFit 0056 minimumPointSize: 7 0057 } 0058 0059 Kirigami.Separator { 0060 Layout.alignment: Qt.AlignHCenter; 0061 Layout.preferredWidth: Math.max(usedValue.contentWidth, totalValue.contentWidth) 0062 visible: totalValue.visible 0063 } 0064 0065 Label { 0066 id: totalValue 0067 0068 Layout.fillWidth: true 0069 0070 text: totalSensorObject.formattedValue 0071 horizontalAlignment: Text.AlignHCenter 0072 visible: root.totalSensor.length > 0 && contentWidth < layout.width 0073 } 0074 0075 Label { 0076 id: totalLabel 0077 0078 Layout.fillWidth: true 0079 0080 text: chart.sensorsModel.sensorLabels[totalSensor] || (totalSensorObject.name + (totalSensorObject.shortName.length > 0 ? "\x9C" + totalSensorObject.shortName : "")) 0081 horizontalAlignment: Text.AlignHCenter 0082 font: Kirigami.Theme.smallFont 0083 color: Kirigami.Theme.disabledTextColor 0084 visible: totalValue.visible 0085 elide: Text.ElideRight 0086 0087 opacity: layout.y + layout.height < root.height - root.contentMargin ? 1 : 0 0088 } 0089 0090 Sensors.Sensor { 0091 id: usedSensorObject 0092 updateRateLimit: root.updateRateLimit 0093 } 0094 0095 Sensors.Sensor { 0096 id: totalSensorObject 0097 updateRateLimit: root.updateRateLimit 0098 } 0099 } 0100 }