Changeset View
Changeset View
Standalone View
Standalone View
faces/facepackages/linechart/contents/ui/FullRepresentation.qml
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright 2019 Marco Martin <mart@kde.org> | ||||
3 | * Copyright 2019 David Edmundson <davidedmundson@kde.org> | ||||
4 | * Copyright 2019 Arjen Hiemstra <ahiemstra@heimr.nl> | ||||
5 | * | ||||
6 | * This program is free software; you can redistribute it and/or modify | ||||
7 | * it under the terms of the GNU Library General Public License as | ||||
8 | * published by the Free Software Foundation; either version 2, or | ||||
9 | * (at your option) any later version. | ||||
10 | * | ||||
11 | * This program is distributed in the hope that it will be useful, | ||||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
14 | * GNU General Public License for more details | ||||
15 | * | ||||
16 | * You should have received a copy of the GNU Library General Public | ||||
17 | * License along with this program; if not, write to the | ||||
18 | * Free Software Foundation, Inc., | ||||
19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
20 | */ | ||||
21 | | ||||
22 | import QtQuick 2.9 | ||||
23 | import QtQuick.Layouts 1.1 | ||||
24 | | ||||
25 | import org.kde.kirigami 2.8 as Kirigami | ||||
26 | | ||||
27 | import org.kde.ksysguard.sensors 1.0 as Sensors | ||||
28 | import org.kde.ksysguard.faces 1.0 as Faces | ||||
29 | | ||||
30 | import org.kde.quickcharts 1.0 as Charts | ||||
31 | | ||||
32 | Faces.SensorFace { | ||||
33 | id: root | ||||
34 | readonly property bool showLegend: controller.faceConfiguration.showLegend | ||||
35 | // Arbitrary minimumWidth to make easier to align plasmoids in a predictable way | ||||
36 | Layout.minimumWidth: Kirigami.Units.gridUnit * 8 | ||||
37 | | ||||
38 | contentItem: ColumnLayout { | ||||
39 | Kirigami.Heading { | ||||
40 | Layout.fillWidth: true | ||||
41 | horizontalAlignment: Text.AlignHCenter | ||||
42 | elide: Text.ElideRight | ||||
43 | text: root.controller.title | ||||
44 | visible: text.length > 0 | ||||
45 | level: 2 | ||||
46 | } | ||||
47 | | ||||
48 | LineChart { | ||||
49 | id: compactRepresentation | ||||
50 | Layout.fillWidth: true | ||||
51 | Layout.fillHeight: true | ||||
52 | Layout.minimumHeight: 3 * Kirigami.Units.gridUnit | ||||
53 | Layout.preferredHeight: 5 * Kirigami.Units.gridUnit | ||||
54 | } | ||||
55 | | ||||
56 | Faces.ExtendedLegend { | ||||
57 | Layout.fillWidth: root.width < implicitWidth * 1.5 | ||||
58 | Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft | ||||
59 | Layout.fillHeight: true | ||||
60 | visible: root.showLegend | ||||
61 | chart: compactRepresentation | ||||
62 | sourceModel: root.showLegend ? compactRepresentation.sensorsModel : null | ||||
63 | colorSource: root.colorSource | ||||
64 | sensorIds: root.showLegend ? root.controller.lowPrioritySensorIds : [] | ||||
65 | } | ||||
66 | } | ||||
67 | } |