Commit d3114b72 authored by Nate Graham's avatar Nate Graham
Browse files

Merge branch 'Plasma/5.19'

parents c49df1a3 6bccf331
......@@ -77,6 +77,15 @@ ColumnLayout {
lowPrioritySensorsView.load();
}
// When the ui is open in systemsettings and the page is switched around,
// it gets reparented to null. use this to reload its config every time the
// page is current again. So any non saved change to the sensor list gets forgotten.
onParentChanged: {
if (parent) {
loadConfig()
}
}
Component.onCompleted: loadConfig()
Connections {
......@@ -225,8 +234,9 @@ ColumnLayout {
filterCaseSensitivity: Qt.CaseInsensitive
filterString: searchQuery.text
sourceModel: KItemModels.KSortFilterProxyModel {
filterRole: "SensorId"
filterRowCallback: function(row, value) {
filterRowCallback: function(source_row, source_parent) {
//filter only items which were leaf nodes from before we squashed everything
var value = sourceModel.data(sourceModel.index(source_row, 0, source_parent), Sensors.SensorTreeModel.SensorId)
return (value && value.length)
}
sourceModel: KItemModels.KDescendantsProxyModel {
......
......@@ -34,8 +34,10 @@ import org.kde.quickcharts.controls 1.0 as ChartControls
Faces.SensorFace {
id: root
Layout.minimumWidth: formFactor == Faces.SensorFace.Horizontal ? Kirigami.Units.gridUnit / 2 * barChart.barCount : 1
contentItem: ColumnLayout {
BarChart {
id: barChart
Layout.fillWidth: true
Layout.fillHeight: true
Layout.alignment: Qt.AlignCenter
......
......@@ -36,16 +36,23 @@ Faces.SensorFace {
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
Layout.minimumWidth: Math.max(Kirigami.Units.gridUnit * compactRepresentation.barCount, Kirigami.Units.gridUnit * 8)
Layout.preferredWidth: titleMetrics.width + leftPadding + rightPadding
contentItem: ColumnLayout {
Kirigami.Heading {
id: heading
Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
elide: Text.ElideRight
text: root.controller.title
visible: text.length > 0
level: 2
TextMetrics {
id: titleMetrics
font: heading.font
text: heading.text
}
}
BarChart {
......@@ -61,6 +68,7 @@ Faces.SensorFace {
Layout.fillWidth: root.width < implicitWidth * 1.5
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
Layout.fillHeight: true
Layout.minimumHeight: root.formFactor !== Faces.SensorFace.Planar ? implicitHeight : -1
visible: root.showLegend
chart: compactRepresentation
sourceModel: root.showLegend ? compactRepresentation.sensorsModel : null
......
......@@ -34,6 +34,7 @@ Faces.SensorFace {
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
Layout.preferredWidth: titleMetrics.width + leftPadding + rightPadding
contentItem: ColumnLayout {
Kirigami.Heading {
......@@ -43,6 +44,11 @@ Faces.SensorFace {
text: root.controller.title
visible: text.length > 0
level: 2
TextMetrics {
id: titleMetrics
font: heading.font
text: heading.text
}
}
LineChart {
......@@ -57,6 +63,7 @@ Faces.SensorFace {
Layout.fillWidth: root.width < implicitWidth * 1.5
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
Layout.fillHeight: true
Layout.minimumHeight: root.formFactor !== Faces.SensorFace.Planar ? implicitHeight : -1
visible: root.showLegend
chart: compactRepresentation
sourceModel: root.showLegend ? compactRepresentation.sensorsModel : null
......
......@@ -35,11 +35,10 @@ Faces.SensorFace {
id: root
readonly property bool showLegend: controller.faceConfiguration.showLegend
contentItem: ColumnLayout {
// Arbitrary minimumWidth to make easier to align plasmoids in a predictable way
Layout.minimumWidth: Kirigami.Units.gridUnit * 8
Layout.preferredWidth: Kirigami.Units.gridUnit * 8
Layout.minimumWidth: Kirigami.Units.gridUnit * 8
Layout.preferredWidth: titleMetrics.width + leftPadding + rightPadding
contentItem: ColumnLayout {
spacing: Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing
Kirigami.Heading {
Layout.fillWidth: true
......@@ -48,6 +47,11 @@ Faces.SensorFace {
text: root.controller.title
visible: text.length > 0
level: 2
TextMetrics {
id: titleMetrics
font: heading.font
text: heading.text
}
}
PieChart {
......@@ -63,6 +67,7 @@ Faces.SensorFace {
Layout.fillWidth: root.width < implicitWidth * 1.5
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
Layout.fillHeight: true
Layout.minimumHeight: root.formFactor !== Faces.SensorFace.Planar ? implicitHeight : -1
visible: root.showLegend
chart: compactRepresentation.chart
sourceModel: root.showLegend ? compactRepresentation.sensorsModel : null
......
......@@ -35,6 +35,7 @@ Faces.SensorFace {
// Arbitrary minimumWidth to make easier to align plasmoids in a predictable way
Layout.minimumWidth: Kirigami.Units.gridUnit * 8
Layout.preferredWidth: titleMetrics.width + leftPadding + rightPadding
contentItem: ColumnLayout {
......@@ -45,6 +46,11 @@ Faces.SensorFace {
text: root.controller.title
visible: text.length > 0
level: 2
TextMetrics {
id: titleMetrics
font: heading.font
text: heading.text
}
}
Item { Layout.fillWidth: true; Layout.fillHeight: true }
......
......@@ -382,9 +382,11 @@ void SensorTreeModel::init()
connect(query, &SensorQuery::finished, [query, this]() {
query->deleteLater();
const auto result = query->result();
beginResetModel();
for (auto pair : result) {
d->addSensor(pair.first, pair.second);
}
endResetModel();
});
query->execute();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment