Commit a7f0e85e authored by David Redondo's avatar David Redondo 🏎
Browse files

Add linebars

parent bc9fd38a
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name=""/>
<group name="General">
<entry name="showLegend" type="Bool">
<default>true</default>
</entry>
<entry name="rangeFrom" type="Int">
<default>0</default>
</entry>
<entry name="rangeTo" type="Int">
<default>100</default>
</entry>
<entry name="rangeAuto" type="Bool">
<default>true</default>
</entry>
</group>
</kcfg>
[Config]
SupportsSensorsColors=true
SupportsTotalSensors=false
SupportsLowPrioritySensors=true
/*
* Copyright 2021 David Redondo <kde@david-redondo.de>
*
* 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.14
import QtQuick.Controls 2.14
import QtQuick.Layouts 1.14
import org.kde.ksysguard.faces 1.0 as Faces
import org.kde.ksysguard.sensors 1.0 as Sensors
Faces.SensorFace {
id: root
contentItem: LineBars {
colorSource: root.colorSource
sensorDataModel: sensorDataModel
}
}
/*
* Copyright 2019 Marco Martin <mart@kde.org>
*
* 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 QtQuick.Controls 2.2 as QQC2
import org.kde.kirigami 2.8 as Kirigami
Kirigami.FormLayout {
id: root
property alias cfg_showLegend: showSensorsLegendCheckbox.checked
property alias cfg_rangeAuto: rangeAutoCheckbox.checked
property alias cfg_rangeFrom: rangeFromSpin.value
property alias cfg_rangeTo: rangeToSpin.value
QQC2.CheckBox {
id: showSensorsLegendCheckbox
text: i18n("Show Sensors Legend")
}
QQC2.CheckBox {
id: rangeAutoCheckbox
text: i18n("Automatic Data Range")
}
QQC2.SpinBox {
id: rangeFromSpin
editable: true
Kirigami.FormData.label: i18n("From:")
enabled: !rangeAutoCheckbox.checked
}
QQC2.SpinBox {
id: rangeToSpin
from: Math.pow(-2, 31) + 1
to: Math.pow(2, 31) - 1
editable: true
Kirigami.FormData.label: i18n("To:")
enabled: !rangeAutoCheckbox.checked
}
}
/*
* Copyright 2021 David Redondo <kde@david-redondo.de>
*
* 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.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15 as QQC2
import org.kde.kirigami 2.15 as Kirigami
import org.kde.quickcharts 1.0 as Charts
import org.kde.ksysguard.faces 1.0 as Faces
import org.kde.ksysguard.formatter 1.0 as Formatter
import org.kde.ksysguard.sensors 1.0 as Sensors
Faces.SensorFace {
id: root
contentItem: ColumnLayout {
Kirigami.Heading {
Layout.fillWidth: true
text: root.controller.title
level: 2
visible: root.controller.showTitle
horizontalAlignment: Text.AlignHCenter
}
Sensors.SensorDataModel {
id: sensorDataModel
sensors: root.controller.highPrioritySensorIds
sensorColors: root.controller.sensorColors
}
LineBars {
id: chart
Layout.fillWidth: true
Layout.fillHeight: true
colorSource: root.colorSource
sensorDataModel: sensorDataModel
}
Faces.ExtendedLegend {
Layout.fillWidth: true
visible: root.controller.faceConfiguration.showLegend
sourceModel: sensorDataModel
colorSource: root.colorSource
sensorIds: root.controller.lowPrioritySensorIds
}
}
}
/*
* Copyright 2021 David Redondo <kde@david-redondo.de>
*
* 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.15
import QtQml 2.15
import org.kde.ksysguard.sensors 1.0 as Sensors
import org.kde.quickcharts 1.0 as Charts
Charts.BarChart {
id: chart
property var sensorDataModel
direction: Charts.XYChart.ZeroAtEnd
barWidth: 4
stacked: true
yRange {
from: root.controller.faceConfiguration.rangeFrom
to: root.controller.faceConfiguration.rangeTo
automatic: root.controller.faceConfiguration.rangeAuto
}
Instantiator {
model: sensorDataModel.sensors
delegate: Charts.HistoryProxySource {
source: Charts.ModelSource {
model: sensorDataModel
column: index
role: Sensors.SensorDataModel.Value
}
interval: sensorDataModel.ready ? sensorDataModel.headerData(0, Qt.Horizontal, Sensors.SensorDataModel.UpdateInterval) : 0
maximumHistory: chart.width / (chart.barWidth + chart.barWidth / 2)
fillMode: Charts.HistoryProxySource.FillFromStart
}
onObjectAdded: {
chart.insertValueSource(index, object)
}
onObjectRemoved: {
chart.removeValueSource(object)
}
}
}
[Desktop Entry]
Name=History Bars
Type=Service
X-KDE-ServiceTypes=KSysguard/SensorFace
X-KDE-ParentApp=org.kde.plasmashell
X-KDE-PluginInfo-Author=David Redondo
X-KDE-PluginInfo-Email=kde@david-redondo.de
X-KDE-PluginInfo-License=LGPLv2+
X-KDE-PluginInfo-Name=org.kde.linebars
X-KDE-PluginInfo-Version=1.0
X-KDE-PluginInfo-Website=https://kde.org
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