diff --git a/faces/facepackages/barchart/contents/ui/FullRepresentation.qml b/faces/facepackages/barchart/contents/ui/FullRepresentation.qml index 6a68751..b2327c0 100644 --- a/faces/facepackages/barchart/contents/ui/FullRepresentation.qml +++ b/faces/facepackages/barchart/contents/ui/FullRepresentation.qml @@ -1,75 +1,75 @@ /* * Copyright 2019 Marco Martin * Copyright 2019 David Edmundson * Copyright 2019 Arjen Hiemstra * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.9 import QtQuick.Layouts 1.1 import org.kde.kirigami 2.8 as Kirigami import org.kde.ksysguard.sensors 1.0 as Sensors import org.kde.ksysguard.faces 1.0 as Faces import org.kde.quickcharts 1.0 as Charts import org.kde.quickcharts.controls 1.0 as ChartControls Faces.SensorFace { id: root readonly property bool showLegend: controller.faceConfiguration.showLegend // Arbitrary minimumWidth to make easier to align plasmoids in a predictable way Layout.minimumWidth: Kirigami.Units.gridUnit * 8 contentItem: ColumnLayout { Kirigami.Heading { Layout.fillWidth: true horizontalAlignment: Text.AlignHCenter elide: Text.ElideRight text: root.controller.title visible: text.length > 0 level: 2 } BarChart { id: compactRepresentation Layout.fillWidth: true Layout.fillHeight: true Layout.minimumHeight: 5 * Kirigami.Units.gridUnit Layout.preferredHeight: 8 * Kirigami.Units.gridUnit Layout.maximumHeight: Math.max(root.width, Layout.minimumHeight) } Faces.ExtendedLegend { Layout.fillWidth: root.width < implicitWidth * 1.5 Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft Layout.fillHeight: true visible: root.showLegend chart: compactRepresentation sourceModel: root.showLegend ? compactRepresentation.sensorsModel : null - colorSource: globalColorSource + colorSource: root.colorSource sensorIds: root.showLegend ? root.controller.lowPrioritySensorIds : [] } Item { Layout.fillHeight: true } } } diff --git a/faces/facepackages/textonly/contents/ui/FullRepresentation.qml b/faces/facepackages/textonly/contents/ui/FullRepresentation.qml index 3ec675c..77de5bd 100644 --- a/faces/facepackages/textonly/contents/ui/FullRepresentation.qml +++ b/faces/facepackages/textonly/contents/ui/FullRepresentation.qml @@ -1,78 +1,78 @@ /* * Copyright 2019 Marco Martin * Copyright 2019 David Edmundson * Copyright 2019 Arjen Hiemstra * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.9 import QtQuick.Layouts 1.1 import org.kde.kirigami 2.8 as Kirigami import org.kde.ksysguard.sensors 1.0 as Sensors import org.kde.ksysguard.faces 1.0 as Faces import org.kde.quickcharts 1.0 as Charts import org.kde.quickcharts.controls 1.0 as ChartsControls Faces.SensorFace { id: root // Arbitrary minimumWidth to make easier to align plasmoids in a predictable way Layout.minimumWidth: Kirigami.Units.gridUnit * 8 contentItem: ColumnLayout { Kirigami.Heading { Layout.fillWidth: true horizontalAlignment: Text.AlignHCenter elide: Text.ElideRight text: root.controller.title visible: text.length > 0 level: 2 } Item { Layout.fillWidth: true; Layout.fillHeight: true } Repeater { model: root.controller.highPrioritySensorIds.concat(root.controller.lowPrioritySensorIds) ChartsControls.LegendDelegate { readonly property bool isTextOnly: index >= root.controller.highPrioritySensorIds.length Layout.fillWidth: true Layout.minimumHeight: isTextOnly ? 0 : implicitHeight name: sensor.shortName value: sensor.formattedValue colorVisible: !isTextOnly - color: !isTextOnly ? globalColorSource.array[index] : "transparent" + color: !isTextOnly ? root.colorSource.map[modelData] : "transparent" layoutWidth: root.width valueWidth: Kirigami.Units.gridUnit * 2 Sensors.Sensor { id: sensor sensorId: modelData } } } Item { Layout.fillWidth: true; Layout.fillHeight: true } } }