diff --git a/applets/systemmonitor/CMakeLists.txt b/applets/systemmonitor/CMakeLists.txt
--- a/applets/systemmonitor/CMakeLists.txt
+++ b/applets/systemmonitor/CMakeLists.txt
@@ -1,15 +1,10 @@
-install(DIRECTORY common/ DESTINATION ${PLASMA_DATA_INSTALL_DIR}/plasmoids/org.kde.plasma.systemmonitor.net)
-plasma_install_package(net org.kde.plasma.systemmonitor.net)
+add_subdirectory(systemmonitor)
-install(DIRECTORY common/ DESTINATION ${PLASMA_DATA_INSTALL_DIR}/plasmoids/org.kde.plasma.systemmonitor.cpu)
+# Systemmonitor presets
+plasma_install_package(coreusage org.kde.plasma.systemmonitor.cpucore)
plasma_install_package(cpu org.kde.plasma.systemmonitor.cpu)
-
-install(DIRECTORY common/ DESTINATION ${PLASMA_DATA_INSTALL_DIR}/plasmoids/org.kde.plasma.systemmonitor.diskactivity)
-plasma_install_package(diskactivity org.kde.plasma.systemmonitor.diskactivity)
-
-install(DIRECTORY common/ DESTINATION ${PLASMA_DATA_INSTALL_DIR}/plasmoids/org.kde.plasma.systemmonitor.memory)
plasma_install_package(memory org.kde.plasma.systemmonitor.memory)
-
-install(DIRECTORY common/ DESTINATION ${PLASMA_DATA_INSTALL_DIR}/plasmoids/org.kde.plasma.systemmonitor.diskusage)
plasma_install_package(diskusage org.kde.plasma.systemmonitor.diskusage)
+plasma_install_package(diskactivity org.kde.plasma.systemmonitor.diskactivity)
+plasma_install_package(net org.kde.plasma.systemmonitor.net)
diff --git a/applets/systemmonitor/common/contents/config/main.xml b/applets/systemmonitor/common/contents/config/main.xml
deleted file mode 100644
--- a/applets/systemmonitor/common/contents/config/main.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- 2000
-
-
-
-
-
-
-
- 1
-
-
-
-
diff --git a/applets/systemmonitor/common/contents/ui/Applet.qml b/applets/systemmonitor/common/contents/ui/Applet.qml
deleted file mode 100644
--- a/applets/systemmonitor/common/contents/ui/Applet.qml
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright 2014 Marco Martin
- *
- *
- * 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.0
-import QtQuick.Layouts 1.1
-import org.kde.plasma.plasmoid 2.0
-import org.kde.plasma.core 2.0 as PlasmaCore
-import org.kde.plasma.components 2.0 as PlasmaComponents
-import org.kde.plasma.extras 2.0 as PlasmaExtras
-
-Item {
- id: rootItem
-
- signal sourceAdded(string source)
- property Component delegate
-
- width: units.gridUnit * 10
- height: units.gridUnit * 10
- Plasmoid.preferredRepresentation: plasmoid.fullRepresentation
- Layout.minimumWidth: units.gridUnit * 12 * (plasmoid.formFactor === PlasmaCore.Types.Horizontal ? sourcesModel.count : 1)
- Layout.minimumHeight: units.gridUnit * 4 * (plasmoid.formFactor === PlasmaCore.Types.Vertical ? sourcesModel.count : 1)
-
- Layout.preferredHeight: Layout.minimumHeight
-
- function addSource(source1, friendlyName1, source2, friendlyName2) {
- var found = false;
- for (var i = 0; i < sourcesModel.count; ++i) {
- var obj = sourcesModel.get(i);
- if (obj.source1 === encodeURIComponent(source1) &&
- obj.source2 === encodeURIComponent(source2)) {
- found = true;
- break;
- }
- }
- if (found) {
- return;
- }
-
- smSource.connectSource(source1);
- if (source2) {
- smSource.connectSource(source2);
- }
-
- sourcesModel.append(
- {"source1": encodeURIComponent(source1),
- "friendlyName1": friendlyName1,
- "source2": encodeURIComponent(source2),
- "friendlyName2": friendlyName2,
- "dataSource": smSource});
- }
-
- function showSource(source) {
- if (plasmoid.configuration.sources && plasmoid.configuration.sources.length > 0) {
- return plasmoid.configuration.sources.indexOf(encodeURIComponent(source)) !== -1;
- } else {
- return sourceDefaultEnable(source);
- }
- }
-
- function sourceDefaultEnable(source) {
- return true;
- }
-
- ListModel {
- id: sourcesModel
- }
-
- Component.onCompleted: {
- for (var i in smSource.sources) {
- smSource.sourceAdded(smSource.sources[i]);
- }
- }
-
- PlasmaCore.DataSource {
- id: smSource
-
- engine: "systemmonitor"
- interval: plasmoid.configuration.updateInterval
- onSourceAdded: {
- if (showSource(source)) {
- rootItem.sourceAdded(source);
- }
- }
- onSourceRemoved: {
- for (var i = sourcesModel.count - 1; i >= 0; --i) {
- var obj = sourcesModel.get(i);
- if (obj.source1 === source || obj.source2 === source) {
- sourcesModel.remove(i);
- }
- }
- smSource.disconnectSource(source);
- }
- }
- Connections {
- target: plasmoid.configuration
- onSourcesChanged: {
- if (plasmoid.configuration.sources.length === 0) {
- for (var i in smSource.sources) {
- var source = smSource.sources[i];
- smSource.sourceAdded(source);
- }
-
- } else {
- var sourcesToRemove = [];
-
- for (var i = sourcesModel.count - 1; i >= 0; --i) {
- var obj = sourcesModel.get(i);
-
- if (plasmoid.configuration.sources.indexOf(encodeURIComponent(obj.source1)) === -1) {
- sourcesToRemove.push(obj.source1);
- }
- }
-
- for (i = 0; i < sourcesToRemove.length; ++i) {
- smSource.sourceRemoved(sourcesToRemove[i]);
- }
-
-
- for (var i in plasmoid.configuration.sources) {
- var source = decodeURIComponent(plasmoid.configuration.sources[i]);
- smSource.sourceAdded(source);
- }
- }
- }
- }
-
- PlasmaExtras.Heading {
- id: heading
- width: parent.width
- level: 2
- text: plasmoid.title
- visible: plasmoid.formFactor !== PlasmaCore.Types.Horizontal && plasmoid.formFactor !== PlasmaCore.Types.Vertical
- }
-
- GridLayout {
- rows: 1
- columns: 1
- flow: plasmoid.formFactor !== PlasmaCore.Types.Horizontal ? GridLayout.LeftToRight : GridLayout.TopToBottom
- anchors {
- top: heading.visible ? heading.bottom : parent.top
- bottom: parent.bottom
- }
- width: parent.width
-
- Repeater {
- model: sourcesModel
- delegate: rootItem.delegate
- }
- }
-}
diff --git a/applets/systemmonitor/common/contents/ui/ConfigGeneral.qml b/applets/systemmonitor/common/contents/ui/ConfigGeneral.qml
deleted file mode 100644
--- a/applets/systemmonitor/common/contents/ui/ConfigGeneral.qml
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Copyright 2013 Bhushan Shah
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, 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 General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
- */
-
-import QtQuick 2.5
-import QtQuick.Controls 2.5 as QQC2
-import QtQuick.Layouts 1.3
-
-import org.kde.kirigami 2.5 as Kirigami
-import org.kde.plasma.core 2.0 as PlasmaCore
-
-
-Item {
- id: iconsPage
- width: childrenRect.width
- height: childrenRect.height
- implicitWidth: formLayout.implicitWidth
- implicitHeight: formLayout.implicitHeight
-
- property var cfg_sources: []
-
- function sourcesChanged() {
- if (! cfg_sources) { cfg_sources = [] }
- if (cfg_sources.length == 0) {
- for (var i in dataSourcesColumn.children) {
- var child = dataSourcesColumn.children[i];
- if (child.checked !== undefined) {
- child.checked = sourceDefaultEnable(child.source);
- }
- }
- } else {
- for (var i in dataSourcesColumn.children) {
- var child = dataSourcesColumn.children[i];
- if (child.checked !== undefined) {
- child.checked = cfg_sources.indexOf(child.source) !== -1;
- }
- }
- }
- }
-
- function sourceDefaultEnable(source) {
- return true;
- }
-
- onCfg_sourcesChanged: {
- sourcesChanged();
- }
-
- property int cfg_updateInterval
-
- signal sourceAdded(string source)
-
- function addSource(source, friendlyName) {
- var found = false;
- for (var i = 0; i < sourcesModel.count; ++i) {
- var obj = sourcesModel.get(i);
- if (obj.source === source) {
- found = true;
- break;
- }
- }
- if (found) {
- return;
- }
-
- sourcesModel.append(
- {"source": encodeURIComponent(source),
- "friendlyName": friendlyName});
- }
-
- PlasmaCore.DataSource {
- id: smSource
-
- engine: "systemmonitor"
-
- onSourceAdded: {
- iconsPage.sourceAdded(source);
- }
- onSourceRemoved: {
- for (var i = sourcesModel.count - 1; i >= 0; --i) {
- var obj = sourcesModel.get(i);
- if (obj.source === source) {
- sourcesModel.remove(i);
- }
- }
- }
- }
-
- Component.onCompleted: {
- for (var i in smSource.sources) {
- var source = smSource.sources[i];
- iconsPage.sourceAdded(source);
- }
- sourcesChanged();
- }
-
- ListModel {
- id: sourcesModel
- }
-
- Kirigami.FormLayout {
- id: formLayout
-
- anchors.left: parent.left
- anchors.right: parent.right
-
- QQC2.SpinBox {
- id: updateIntervalSpinBox
- Kirigami.FormData.label: i18n("Update interval:")
- from: 100
- stepSize: 100
- to: 1000000
- editable: true
- validator: DoubleValidator {
- bottom: spinbox.from
- top: spinbox.to
- }
- textFromValue: function(value) {
- var seconds = value / 1000
- return i18ncp("SpinBox text", "%1 second", "%1 seconds", seconds.toFixed(1))
- }
- valueFromText: function(text) {
- return parseFloat(text) * 1000
- }
- value: cfg_updateInterval
- onValueModified: cfg_updateInterval = value
- }
-
- Item {
- Kirigami.FormData.isSection: true
- }
-
-
- ColumnLayout {
- id: dataSourcesColumn
- Kirigami.FormData.label: i18n("Show:")
- Kirigami.FormData.buddyFor: children[1] // 0 is the Repeater
-
- Repeater {
- id: repeater
- model: sourcesModel
- QQC2.CheckBox {
- id: checkBox
- text: model.friendlyName
- property string source: model.source
- onCheckedChanged: {
- if (checked) {
- if (cfg_sources.indexOf(model.source) == -1) {
- cfg_sources.push(model.source);
- }
- } else {
- var idx = cfg_sources.indexOf(model.source);
- if (cfg_sources.length !== 1) { // This condition prohibits turning off the last item from the list.
- if (idx !== -1) {
- cfg_sources.splice(idx, 1);
- }
- }
- }
- cfg_sourcesChanged();
- }
- }
- }
- }
- }
-}
diff --git a/applets/systemmonitor/common/contents/ui/DoublePlotter.qml b/applets/systemmonitor/common/contents/ui/DoublePlotter.qml
deleted file mode 100644
--- a/applets/systemmonitor/common/contents/ui/DoublePlotter.qml
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright 2015 Marco Martin
- *
- *
- * 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.0
-import QtQuick.Layouts 1.1
-import org.kde.plasma.core 2.0 as PlasmaCore
-import org.kde.plasma.components 2.0 as PlasmaComponents
-import org.kde.kquickcontrolsaddons 2.0 as KQuickAddons
-
-KQuickAddons.Plotter {
- id: plotter
- property string sensorName: model.friendlyName1
-
- Layout.fillWidth: true
- Layout.fillHeight: true
- horizontalGridLineCount: 0
-
- function cycle(color, degrees) {
- var min = Math.min(color.r, Math.min(color.g, color.b));
- var max = Math.max(color.r, Math.max(color.g, color.b));
- var c = max - min;
- var h;
-
- if (c === 0) {
- h = 0
- } else if (max === color.r) {
- h = ((color.g - color.b) / c) % 6;
- } else if (max === color.g) {
- h = ((color.b - color.r) / c) + 2;
- } else if (max === color.b) {
- h = ((color.r - color.g) / c) + 4;
- }
- var hue = (1/6) * h + (degrees/360);
- var saturation = c / (1 - Math.abs(2 * ((max+min)/2) - 1));
- var lightness = (max + min)/2;
-
- return Qt.hsla(hue, saturation, lightness, 1.0);
- }
-
- property string downloadColor: theme.highlightColor
- property string uploadColor: cycle(theme.highlightColor, -90)
-
- dataSets: [
- KQuickAddons.PlotData {
- color: downloadColor
- },
- KQuickAddons.PlotData {
- color: uploadColor
- }
- ]
-
- PlasmaComponents.Label {
- id: nameLabel
- anchors {
- left: parent.left
- top: parent.top
- }
- }
-
- PlasmaComponents.Label {
- id: speedLabel
- wrapMode: Text.WordWrap
- visible: plasmoid.formFactor !== PlasmaCore.Types.Vertical
- anchors {
- right: parent.right
- }
- }
-
- Connections {
- target: model.dataSource
- onNewData: {
- if (sourceName.indexOf(decodeURIComponent(model.source1)) !== 0 && sourceName.indexOf(decodeURIComponent(model.source2)) !== 0) {
- return;
- }
-
- var data1 = model.dataSource.data[decodeURIComponent(model.source2)];
- var data2 = model.dataSource.data[decodeURIComponent(model.source1)];
-
- if (data1 === undefined || data1.value === undefined ||
- data2 === undefined || data2.value === undefined) {
- return;
- }
-
- plotter.addSample([data1.value, data2.value]);
-
- if (plasmoid.formFactor !== PlasmaCore.Types.Vertical) {
- nameLabel.text = plotter.sensorName
- speedLabel.text = i18n("⬇ %2 | ⬆ %4",
- downloadColor,
- formatData(data1),
- uploadColor,
- formatData(data2))
- } else {
- nameLabel.text = plotter.sensorName+ "\n" + formatData(data1) + "\n" + formatData(data2)
- speedLabel.text = ""
- }
- }
- }
-}
diff --git a/applets/systemmonitor/common/contents/ui/SinglePlotter.qml b/applets/systemmonitor/common/contents/ui/SinglePlotter.qml
deleted file mode 100644
--- a/applets/systemmonitor/common/contents/ui/SinglePlotter.qml
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright 2015 Marco Martin
- *
- *
- * 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.0
-import QtQuick.Layouts 1.1
-import org.kde.plasma.core 2.0 as PlasmaCore
-import org.kde.plasma.components 2.0 as PlasmaComponents
-import org.kde.kquickcontrolsaddons 2.0 as KQuickAddons
-
-
-KQuickAddons.Plotter {
- id: plotter
- property string sensorName: model.friendlyName1
-
- Layout.fillWidth: true
- Layout.fillHeight: true
- //FIXME: doesn't seem to properly fill otherwise
- Layout.preferredHeight: parent.height
- horizontalGridLineCount: 0
-
- dataSets: [
- KQuickAddons.PlotData {
- color: theme.highlightColor
- }
- ]
-
- PlasmaComponents.Label {
- id: nameLabel
- anchors {
- left: parent.left
- top: parent.top
- }
- }
-
- PlasmaComponents.Label {
- id: speedLabel
- wrapMode: Text.WordWrap
- visible: plasmoid.formFactor !== PlasmaCore.Types.Vertical
- anchors {
- right: parent.right
- }
- }
-
- Connections {
- target: model.dataSource
- onNewData: {
- if (sourceName.indexOf(decodeURIComponent(model.source1)) !== 0) {
- return;
- }
-
- var data1 = model.dataSource.data[decodeURIComponent(model.source1)];
-
- if (data1 === undefined || data1.value === undefined) {
- return;
- }
-
- plotter.addSample([data1.value]);
-
- if (plasmoid.formFactor !== PlasmaCore.Types.Vertical) {
- nameLabel.text = plotter.sensorName
- speedLabel.text = formatData(data1)
- } else {
- nameLabel.text = plotter.sensorName+ "\n" + formatData(data1)
- speedLabel.text = ""
- }
- }
- }
-}
-
diff --git a/applets/systemmonitor/coreusage/metadata.desktop b/applets/systemmonitor/coreusage/metadata.desktop
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/coreusage/metadata.desktop
@@ -0,0 +1,34 @@
+[Desktop Entry]
+Name=Individual Core Usage
+Name[de]=Einzelne Prozessorkernbelastung
+Comment=System monitor Widget that shows usage of individual CPU cores
+Type=Service
+Icon=ksysguardd
+X-KDE-ServiceTypes=Plasma/Applet
+
+X-Plasma-API=declarativeappletscript
+X-Plasma-MainScript=ui/main.qml
+X-Plasma-Provides=org.kde.plasma.systemmonitor
+X-Plasma-RootPath=org.kde.plasma.systemmonitor
+
+X-KDE-PluginInfo-Author=Kai Uwe Broulik
+X-KDE-PluginInfo-Email=kde@privat.broulik.de
+X-KDE-PluginInfo-Name=org.kde.plasma.systemmonitor.cpucore
+X-KDE-PluginInfo-Version=1.0
+X-KDE-PluginInfo-Website=kde.org
+X-KDE-PluginInfo-Depends=
+X-KDE-PluginInfo-License=GPL-2.0+
+X-KDE-PluginInfo-EnabledByDefault=true
+X-KDE-PluginInfo-Category=System Information
+
+[Config]
+chartFace=org.kde.ksysguard.barchart
+sensorIds=cpu/cpu*/TotalLoad
+totalSensor=cpu/system/TotalLoad
+textOnlySensorIds=cpu/system/loadavg1,cpu/system/loadavg5
+
+[FaceConfig]
+rangeAuto=false
+rangeFrom=0
+rangeTo=100
+
diff --git a/applets/systemmonitor/cpu/Messages.sh b/applets/systemmonitor/cpu/Messages.sh
deleted file mode 100644
--- a/applets/systemmonitor/cpu/Messages.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#! /usr/bin/env bash
-$XGETTEXT `find . -name \*.js -o -name \*.qml -o -name \*.cpp` `find ../common -name \*.qml` -o $podir/plasma_applet_org.kde.plasma.systemmonitor.cpu.pot
diff --git a/applets/systemmonitor/cpu/contents/config/config.qml b/applets/systemmonitor/cpu/contents/config/config.qml
deleted file mode 100644
--- a/applets/systemmonitor/cpu/contents/config/config.qml
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2013 Bhushan Shah
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, 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 General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
- */
-
-import QtQuick 2.0
-
-import org.kde.plasma.configuration 2.0
-
-ConfigModel {
- ConfigCategory {
- name: i18n("CPUs")
- icon: "cpu"
- source: "cpuConfig.qml"
- }
-}
diff --git a/applets/systemmonitor/cpu/contents/ui/cpu.qml b/applets/systemmonitor/cpu/contents/ui/cpu.qml
deleted file mode 100644
--- a/applets/systemmonitor/cpu/contents/ui/cpu.qml
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2015 Marco Martin
- *
- *
- * 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.0
-import QtQuick.Layouts 1.1
-import org.kde.plasma.plasmoid 2.0
-import org.kde.plasma.core 2.0 as PlasmaCore
-import org.kde.plasma.components 2.0 as PlasmaComponents
-import org.kde.kquickcontrolsaddons 2.0 as KQuickAddons
-
-Applet {
- id: root
-
- onSourceAdded: {
- var match = source.match(/^cpu\/(\w+)\/TotalLoad/);
- if (match) {
- root.addSource(source, match[1]);
- }
- }
-
- function sourceDefaultEnable(source) {
- return source.match(/^cpu(\/|%2F)system(\/|%2F)TotalLoad/);
- }
-
- delegate: SinglePlotter {
- autoRange: false
- rangeMin: 0
- rangeMax: 100
- function formatData(data) {
- //i18nc("CPU usage: %1 is the value, %2 the unit datatype", "%1 %2")
- //return i18n("%1 %2", Math.round(data.value), data.units);
- return i18nc("CPU usage: %1 is the value, %2 the unit datatype", "%1 %2", Math.round(data.value), data.units);
- }
- }
-}
diff --git a/applets/systemmonitor/cpu/metadata.desktop b/applets/systemmonitor/cpu/metadata.desktop
--- a/applets/systemmonitor/cpu/metadata.desktop
+++ b/applets/systemmonitor/cpu/metadata.desktop
@@ -1,110 +1,33 @@
[Desktop Entry]
-Name=CPU Load Monitor
-Name[ar]=مرقاب حِمل المعالج
-Name[ca]=Monitor de càrrega de la CPU
-Name[ca@valencia]=Monitor de càrrega de la CPU
-Name[cs]=Monitor zatížení CPU
-Name[da]=Overvågning af CPU-belastning
-Name[de]=Monitor für Prozessor-Last
-Name[el]=Επόπτης φόρτου ΚΜΕ
-Name[en_GB]=CPU Load Monitor
-Name[es]=Monitor de carga de la CPU
-Name[et]=Protsessori koormuse jälgija
-Name[eu]=PUZ zamaren begiralea
-Name[fi]=Suoritinkäyttö
-Name[fr]=Surveillance du processeur
-Name[gl]=Vixilante da carga da CPU
-Name[he]=מנטר מעבד
-Name[hu]=Processzorfigyelő
-Name[ia]=Monitor de carga de CPU
-Name[id]=Pemantau Muatan CPU
-Name[is]=Eftirlit með notkun örgjörva
-Name[it]=Monitor del carico del processore
-Name[ja]=CPU 負荷モニタ
-Name[ko]=CPU 사용량 모니터
-Name[lt]=Procesoriaus apkrovos prižiūryklė
-Name[lv]=CPU slodzes monitors
-Name[ml]=സിപിയു നിരീക്ഷണോപാധി
-Name[nl]=Monitor voor CPU-gebruik
-Name[nn]=Prosessorlast-overvaking
-Name[pa]=CPU ਲੋਡ ਲਈ ਨਿਗਰਾਨ
-Name[pl]=Monitor obciążenia procesora
-Name[pt]=Monitor de Carga do CPU
-Name[pt_BR]=Monitor de carga da CPU
-Name[ru]=Монитор нагрузки процессора
-Name[sk]=Monitor zaťaženia CPU
-Name[sl]=Nadzornik obremenitve procesorja
-Name[sr]=надзор оптерећења процесора
-Name[sr@ijekavian]=надзор оптерећења процесора
-Name[sr@ijekavianlatin]=nadzor opterećenja procesora
-Name[sr@latin]=nadzor opterećenja procesora
-Name[sv]=Övervakning av processorlast
-Name[tg]=Назорати боршавии CPU
-Name[tr]=İşlemci Yükü İzleyici
-Name[uk]=Використання процесорів
-Name[x-test]=xxCPU Load Monitorxx
-Name[zh_CN]=CPU 负载监视器
-Name[zh_TW]=CPU 負載監視器
-Comment=Monitor the load of the CPUs
-Comment[ar]=راقِب حِمل المعالجات لديك
-Comment[ast]=Supervisa la carga de les CPUs
-Comment[ca]=Controla la càrrega de les CPU
-Comment[ca@valencia]=Controla la càrrega de les CPU
-Comment[cs]=Monitorovat zatížení procesor(ů)
-Comment[da]=Overvåg belastningen af CPU'erne
-Comment[de]=Überwacht die Auslastung der Prozessoren
-Comment[el]=Παρακολούθηση του φόρτου των ΚΜΕ
-Comment[en_GB]=Monitor the load of the CPUs
-Comment[es]=Monitoriza la carga de las CPU
-Comment[et]=Protsessorite koormuse jälgimine
-Comment[eu]=Gainbegiratu PUZen zama
-Comment[fi]=Seuraa suoritinten kuormaa
-Comment[fr]=Surveille la charge des processeurs
-Comment[gl]=Vixiar a carga das CPU.
-Comment[he]=צג שימוש במעבד
-Comment[hu]=A processzorterhelés monitorozása
-Comment[id]=Pemantau muatan CPU
-Comment[is]=Fylgjast með álagi á örgjörva
-Comment[it]=Indica il carico dei processori
-Comment[ja]=CPU の負荷を監視します
-Comment[ko]=CPU 사용량 모니터
-Comment[lt]=Stebėti procesorių apkrovą
-Comment[ml]=സിപിയുകളുടെ പ്രവര്ത്തനഭാരം നിരീക്ഷിക്കുക
-Comment[nl]=Het gebruik van de CPU's monitoren
-Comment[nn]=Overvaking av prosessorbruk
-Comment[pa]=CPU ਦੇ ਲੋਡ ਦੀ ਨਿਗਰਾਨੀ
-Comment[pl]=Monitoruje obciążenie procesora
-Comment[pt]=Vigia a carga dos CPU's
-Comment[pt_BR]=Monitora a carga das CPUs
-Comment[ru]=Мониторинг степени загрузки процессоров
-Comment[sk]=Kontrola zaťaženia CPU
-Comment[sl]=Nadzor nad obremenitvijo procesorjev
-Comment[sr]=Надгледајте оптерећење процесора
-Comment[sr@ijekavian]=Надгледајте оптерећење процесора
-Comment[sr@ijekavianlatin]=Nadgledajte opterećenje procesora
-Comment[sr@latin]=Nadgledajte opterećenje procesora
-Comment[sv]=Övervaka processorernas last
-Comment[tr]=İşlemcilerin yüklerini izleyin
-Comment[uk]=Монітор навантаження на процесори
-Comment[x-test]=xxMonitor the load of the CPUsxx
-Comment[zh_CN]=监视 CPU 负载
-Comment[zh_TW]=監視 CPU 的負載
-
+Name=Total CPU Use
+Name[de]=Gesamte Prozessorauslastung
+Comment=System monitor Widget that shows the total CPU usage
Type=Service
Icon=cpu
-
X-KDE-ServiceTypes=Plasma/Applet
X-Plasma-API=declarativeappletscript
-X-Plasma-MainScript=ui/cpu.qml
-X-Plasma-StandAloneApp=true
+X-Plasma-MainScript=ui/main.qml
+X-Plasma-Provides=org.kde.plasma.systemmonitor
+X-Plasma-RootPath=org.kde.plasma.systemmonitor
-X-KDE-PluginInfo-Author=Marco Martin
-X-KDE-PluginInfo-Email=mart@kde.org
+X-KDE-PluginInfo-Author=Kai Uwe Broulik
+X-KDE-PluginInfo-Email=kde@privat.broulik.de
X-KDE-PluginInfo-Name=org.kde.plasma.systemmonitor.cpu
X-KDE-PluginInfo-Version=1.0
-X-KDE-PluginInfo-Website=https://kde.org/plasma-desktop
-X-KDE-PluginInfo-Category=System Information
+X-KDE-PluginInfo-Website=kde.org
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL-2.0+
-X-KDE-FormFactors=tablet,mediacenter,desktop
+X-KDE-PluginInfo-EnabledByDefault=true
+X-KDE-PluginInfo-Category=System Information
+
+[Config]
+chartFace=org.kde.ksysguard.piechart
+sensorIds=cpu/system/TotalLoad
+totalSensor=cpu/system/TotalLoad
+textOnlySensorIds=cpu/system/processors,cpu/system/cores
+
+[FaceConfig]
+rangeAuto=false
+rangeFrom=0
+rangeTo=100
diff --git a/applets/systemmonitor/diskactivity/Messages.sh b/applets/systemmonitor/diskactivity/Messages.sh
deleted file mode 100644
--- a/applets/systemmonitor/diskactivity/Messages.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#! /usr/bin/env bash
-$XGETTEXT `find . -name \*.js -o -name \*.qml -o -name \*.cpp` `find ../common -name \*.qml` -o $podir/plasma_applet_org.kde.plasma.systemmonitor.diskactivity.pot
diff --git a/applets/systemmonitor/diskactivity/contents/config/config.qml b/applets/systemmonitor/diskactivity/contents/config/config.qml
deleted file mode 100644
--- a/applets/systemmonitor/diskactivity/contents/config/config.qml
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2013 Bhushan Shah
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, 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 General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
- */
-
-import QtQuick 2.0
-
-import org.kde.plasma.configuration 2.0
-
-ConfigModel {
- ConfigCategory {
- name: i18n("Disk activity")
- icon: "drive-harddisk"
- source: "diskactivityConfig.qml"
- }
-}
diff --git a/applets/systemmonitor/diskactivity/contents/ui/diskactivityConfig.qml b/applets/systemmonitor/diskactivity/contents/ui/diskactivityConfig.qml
deleted file mode 100644
--- a/applets/systemmonitor/diskactivity/contents/ui/diskactivityConfig.qml
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2015 Marco Martin
- *
- *
- * 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.0
-import QtQuick.Layouts 1.1
-import org.kde.plasma.plasmoid 2.0
-import org.kde.plasma.core 2.0 as PlasmaCore
-import org.kde.plasma.components 2.0 as PlasmaComponents
-import org.kde.kquickcontrolsaddons 2.0 as KQuickAddons
-
-ConfigGeneral {
- id: root
-
- onSourceAdded: {
- var match = source.match(/^disk\/([^\/]+)\/Rate\/wblk/);
- if (match) {
- root.addSource(source, match[1]);
- }
- }
-}
diff --git a/applets/systemmonitor/diskactivity/metadata.desktop b/applets/systemmonitor/diskactivity/metadata.desktop
--- a/applets/systemmonitor/diskactivity/metadata.desktop
+++ b/applets/systemmonitor/diskactivity/metadata.desktop
@@ -1,127 +1,31 @@
[Desktop Entry]
-Name=Hard Disk I/O Monitor
-Name[ar]=مراقب د/خ القرص الصلب
-Name[bs]=Hard Disk I/O Monitor
-Name[ca]=Monitor d'E/S de disc dur
-Name[ca@valencia]=Monitor d'E/E de disc dur
-Name[cs]=Monitor I/O pevného disku
-Name[da]=Overvågning af harddisk-I/O
-Name[de]=Überwachungsmonitor für Festplattenein- und ausgabe
-Name[el]=Επόπτης χρήσης του σκληρού δίσκου
-Name[en_GB]=Hard Disk I/O Monitor
-Name[es]=Monitor de E/S del disco duro
-Name[et]=Kõvaketta sisendi/väljundi jälgija
-Name[eu]=Disko zurrun S/I begiralea
-Name[fi]=Kiintolevyjen käyttöilmaisin
-Name[fr]=Surveillance des disques durs (E/S)
-Name[ga]=Monatóir I/A Diosca Crua
-Name[gl]=Vixilante da E/S do disco duro
-Name[he]=מנטר שימוש בכונן הקשיח
-Name[hu]=Merevlemez I/O monitor
-Name[ia]=Monitor de I/E del disco dur
-Name[id]=Pemantau I/O Hard Disk
-Name[is]=Eftirlit með I/O notkun harðdiska
-Name[it]=Uso del disco fisso
-Name[ja]=ハードディスク I/O モニタ
-Name[kk]=Қатқыл дискінің Е/Ш бақылауы
-Name[km]=ត្រួតពិនិត្យ I/O ថាសរឹង
-Name[ko]=하드디스크 I/O 모니터
-Name[lt]=Standžiojo disko I/O prižiūryklė
-Name[lv]=Cietā diska noslogojuma novērotājs
-Name[ml]=ഹാര്ഡ് ഡിസ്ക് ഐ/ഒ നിരീക്ഷണോപാധി
-Name[mr]=हार्ड डिस्क I/O नियंत्रक
-Name[nb]=En overvåker for disk-I/U
-Name[nds]=Fastplaat-I/O-Beluern
-Name[nl]=Volgt de activiteit van de harde schijf
-Name[nn]=Overvaking av diskaktivitet
-Name[pa]=ਹਾਰਡ ਡਿਸਕ I/O ਮਾਨੀਟਰ
-Name[pl]=Monitor WE/WY dysku twardego
-Name[pt]=Monitor de E/S do Disco
-Name[pt_BR]=Monitor de E/S do disco rígido
-Name[ro]=Monitor pentru utilizarea discului dur
-Name[ru]=Монитор активности жёстких дисков
-Name[sk]=Monitor I/O pevného disku
-Name[sl]=Nadzornik V/I trdega diska
-Name[sr]=Надгледање У/И‑ја хард‑диска
-Name[sr@ijekavian]=Надгледање У/И‑ја хард‑диска
-Name[sr@ijekavianlatin]=Nadgledanje U/I‑ja hard‑diska
-Name[sr@latin]=Nadgledanje U/I‑ja hard‑diska
-Name[sv]=Övervakning av in- och utmatning för hårddisk
-Name[tg]=Назорати диски компютерӣ I/O
-Name[tr]=Sabit Disk G/Ç İzleyici
-Name[uk]=Монітор роботи жорсткого диска
-Name[vi]=Trình quản lý I/O đĩa cứng
-Name[x-test]=xxHard Disk I/O Monitorxx
-Name[zh_CN]=硬盘 I/O 监视器
-Name[zh_TW]=硬碟使用量 I/O 監視器
+Name=Hard Disk Activity
Comment=An applet that monitors hard disk throughput and input/output
-Comment[ar]=بُريْمج يراقب استخدام إنتاجيّة القرص الصلب ودَخْله/خَرْجه
-Comment[bs]=Aplet koji prati hard disk protok ulaz / izlaz
-Comment[ca]=Una miniaplicació que controla la velocitat de transferència, així com l'entrada/sortida de les dades al disc dur
-Comment[ca@valencia]=Una miniaplicació que controla la velocitat de transferència, així com l'entrada/eixida de les dades en el disc dur
-Comment[cs]=Aplet, jenž monitoruje propustnost disku a vstup/výstup
-Comment[da]=En applet som overvåger gennemgang og input/output for harddisken
-Comment[de]=Ein Miniprogramm, das den Festplattendurchsatz und die Festplattenein- und -ausgabe überwacht
-Comment[el]=Μικροεφαρμογή που εποπτεύει τη ρυθμοαπόδοση και την είσοδο/έξοδο του σκληρού δίσκου
-Comment[en_GB]=An applet that monitors hard disk throughput and input/output
-Comment[es]=Una miniaplicación que monitoriza el rendimiento y la entrada/salida del disco duro
-Comment[et]=Kõvaketta läbilaset ja sisendit/väljundit jälgiv aplett
-Comment[eu]=Disko zurrunaren transferentzia tasa eraginkorra («throughput») eta sarrera/irteera gainbegiratzen dituen aplikaziotxo bat
-Comment[fi]=Tarkkailee levyjen suoritustehoa ja siirtomäärää
-Comment[fr]=Une applet surveillant l'activité des disques durs et de leurs entrées / sorties
-Comment[gl]=Un trebello que vixía o rendemento e a entrada e saída
-Comment[he]=ישומון למעקב אחר מהירות הכתיבה והקריאה בכונן
-Comment[hu]=Egy kisalkalmazás, amely figyeli a merevlemez átvitelét és a bemenetet/kimenetet
-Comment[ia]=Un applet que que monitora le prestation (throughput) e ingresso/egresso de disco dur
-Comment[id]=Sebuah applet yang memantau lalu-lalang dan input/output hard disk
-Comment[is]=Smáforrit sem fylgist með afköstum harðra diska og ílagi/frálagi
-Comment[it]=Un'applet che controlla le prestazioni e l'uso del disco fisso
-Comment[ja]=ハードディスクのスループットと入力/出力を監視するアプレット
-Comment[kk]=Дискінің белсендігі және енгізу/шығаруды бақылау апплеті
-Comment[km]=អាប់ភ្លេតដែលត្រួតពិនិត្យថាសរឹង និងឧបករណ៍ចេញ/ចូល
-Comment[ko]=하드디스크 대역폭 및 I/O 상태를 보여 주는 애플릿
-Comment[lt]=Programėlė, kuri stebi disko apkrovą ir įvedimą/išvedimą
-Comment[ml]=ഹാര്ഡ് ഡിസ്ക് പ്രവര്ത്തനം നിരീക്ഷിക്കാനുള്ള അപ്ലെറ്റ്
-Comment[mr]=हार्ड डिस्क इनपुट व आउटपुट दर्शविणारे एप्लेट
-Comment[nb]=Et miniprogram som overvåker dataflyt til og fra harddisk
-Comment[nds]=En Lüttprogramm, dat den Fastplaat-Dörsatz un de In- un Utgaven beluert
-Comment[nl]=Een applet die de activiteit van de harde schijf volgt
-Comment[nn]=Skjermelement som overvaker dataflyt til og frå harddisk
-Comment[pa]=ਹਾਰਡ ਡਿਸਕ ਥਰੂਪੁੱਟ ਅਤੇ ਇੰਪੁੱਟ/ਆਉਟਪੁੱਟ ਦੀ ਨਿਗਰਾਨੀ ਲਈ ਐਪਲਿਟ
-Comment[pl]=Monitoruje przepustowość WE/WY dysku twardego
-Comment[pt]=Uma 'applet' que vigia o rendimento e o fluxo de entrada-saída do disco
-Comment[pt_BR]=Monitora a taxa de transferência e entrada/saída do disco rígido
-Comment[ro]=Miniaplicație ce monitorizează traficul de intrare și cel de ieșire pentru discul dur
-Comment[ru]=Мониторинг пропускной способности и процессов ввода/вывода жестких дисков
-Comment[sk]=Applet, ktorý monitoruje priepustnosť pevného disku a vstup/výstup
-Comment[sl]=Programček, ki nadzoruje prepustnost in vhod/izhod trdega diska
-Comment[sr]=Аплет за надгледање пропусности и улаза/излаза хард‑диска
-Comment[sr@ijekavian]=Аплет за надгледање пропусности и улаза/излаза хард‑диска
-Comment[sr@ijekavianlatin]=Aplet za nadgledanje propusnosti i ulaza/izlaza hard‑diska
-Comment[sr@latin]=Aplet za nadgledanje propusnosti i ulaza/izlaza hard‑diska
-Comment[sv]=Ett miniprogram som övervakar hårddiskprestanda samt in- och utmatning
-Comment[tr]=Sabit diski girdi/çıktı olarak izleyen bir programcık
-Comment[uk]=Аплет, який стежить за даними, які записуються на жорсткий диск та читаються з жорсткого диска
-Comment[vi]=Một ứng dụng nhỏ quản lý dữ liệu vào/ra trên đĩa cứng
-Comment[x-test]=xxAn applet that monitors hard disk throughput and input/outputxx
-Comment[zh_CN]=监视硬盘吞吐量和输入输出的小程序
-Comment[zh_TW]=監視硬碟效能與 I/O 的小程式
-
Type=Service
Icon=drive-harddisk
-
X-KDE-ServiceTypes=Plasma/Applet
X-Plasma-API=declarativeappletscript
-X-Plasma-MainScript=ui/diskactivity.qml
+X-Plasma-MainScript=ui/main.qml
+X-Plasma-Provides=org.kde.plasma.systemmonitor
+X-Plasma-RootPath=org.kde.plasma.systemmonitor
X-Plasma-StandAloneApp=true
X-KDE-PluginInfo-Author=Marco Martin
X-KDE-PluginInfo-Email=mart@kde.org
X-KDE-PluginInfo-Name=org.kde.plasma.systemmonitor.diskactivity
X-KDE-PluginInfo-Version=1.0
-X-KDE-PluginInfo-Website=https://kde.org/plasma-desktop
-X-KDE-PluginInfo-Category=System Information
+X-KDE-PluginInfo-Website=kde.org
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL-2.0+
+X-KDE-PluginInfo-EnabledByDefault=true
+X-KDE-PluginInfo-Category=System Information
X-KDE-FormFactors=tablet,mediacenter,desktop
+
+[Config]
+chartFace=org.kde.ksysguard.linechart
+sensorIds=disk/all/write,disk/all/read
+
+[FaceConfig]
+rangeAuto=true
+lineChartStacked=true
diff --git a/applets/systemmonitor/diskusage/Messages.sh b/applets/systemmonitor/diskusage/Messages.sh
deleted file mode 100644
--- a/applets/systemmonitor/diskusage/Messages.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#! /usr/bin/env bash
-$XGETTEXT `find . -name \*.js -o -name \*.qml -o -name \*.cpp` `find ../common -name \*.qml` -o $podir/plasma_applet_org.kde.plasma.systemmonitor.diskusage.pot
diff --git a/applets/systemmonitor/diskusage/contents/config/config.qml b/applets/systemmonitor/diskusage/contents/config/config.qml
deleted file mode 100644
--- a/applets/systemmonitor/diskusage/contents/config/config.qml
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2013 Bhushan Shah
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, 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 General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
- */
-
-import QtQuick 2.0
-
-import org.kde.plasma.configuration 2.0
-
-ConfigModel {
- ConfigCategory {
- name: i18n("Disk usage")
- icon: "drive-harddisk"
- source: "diskusageConfig.qml"
- }
-}
diff --git a/applets/systemmonitor/diskusage/contents/ui/diskusage.qml b/applets/systemmonitor/diskusage/contents/ui/diskusage.qml
deleted file mode 100644
--- a/applets/systemmonitor/diskusage/contents/ui/diskusage.qml
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2015 Marco Martin
- *
- *
- * 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.0
-import QtQuick.Layouts 1.1
-import org.kde.plasma.plasmoid 2.0
-import org.kde.plasma.core 2.0 as PlasmaCore
-import org.kde.plasma.components 2.0 as PlasmaComponents
-import org.kde.kquickcontrolsaddons 2.0 as KQuickAddons
-import org.kde.kcoreaddons 1.0 as KCoreAddons
-
-Applet {
- id: root
-
- onSourceAdded: {
- var match = source.match(/^partitions(.+)\/filllevel/);
- if (match) {
- var freeSource = "partitions" + match[1] + "/freespace";
- root.addSource(source, match[1], freeSource, match[1]);
- }
- }
-
- delegate: Item {
- Layout.fillWidth: true
- Layout.fillHeight: true
- PlasmaComponents.Label {
- id: label
- text: model.friendlyName1
- anchors {
- left: parent.left
- bottom: progressBar.top
- }
- }
- PlasmaComponents.Label {
- id: freeSpace
- anchors {
- right: parent.right
- bottom: progressBar.top
- }
- }
- PlasmaComponents.ProgressBar {
- id: progressBar
- minimumValue: 0
- maximumValue: 100
- anchors {
- left: parent.left
- right: parent.right
- bottom: parent.bottom
- }
- }
- Connections {
- target: model.dataSource
- onNewData: {
- if (sourceName.indexOf(decodeURIComponent(model.source1)) !== 0) {
- return;
- }
-
- var data1 = model.dataSource.data[decodeURIComponent(model.source1)];
- var data2 = model.dataSource.data[decodeURIComponent(model.source2)];
-
- if (data1 !== undefined && data1.value !== undefined) {
- progressBar.value = data1.value;
- }
-
- if (data2 !== undefined && data2.value !== undefined) {
- freeSpace.text = KCoreAddons.Format.formatByteSize(data2.value * 1024);
- }
- }
- }
- }
-}
diff --git a/applets/systemmonitor/diskusage/contents/ui/diskusageConfig.qml b/applets/systemmonitor/diskusage/contents/ui/diskusageConfig.qml
deleted file mode 100644
--- a/applets/systemmonitor/diskusage/contents/ui/diskusageConfig.qml
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2015 Marco Martin
- *
- *
- * 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.0
-import QtQuick.Layouts 1.1
-import org.kde.plasma.plasmoid 2.0
-import org.kde.plasma.core 2.0 as PlasmaCore
-import org.kde.plasma.components 2.0 as PlasmaComponents
-import org.kde.kquickcontrolsaddons 2.0 as KQuickAddons
-
-ConfigGeneral {
- id: root
-
- onSourceAdded: {
- var match = source.match(/^partitions(.+)\/filllevel/);
- if (match) {
- root.addSource(source, match[1]);
- }
- }
-}
diff --git a/applets/systemmonitor/diskusage/metadata.desktop b/applets/systemmonitor/diskusage/metadata.desktop
--- a/applets/systemmonitor/diskusage/metadata.desktop
+++ b/applets/systemmonitor/diskusage/metadata.desktop
@@ -1,125 +1,32 @@
[Desktop Entry]
-Name=Hard Disk Space Usage
-Name[ar]=استخدام مساحة القرص الصلب
-Name[bs]=Iskorisenost Hard diska
-Name[ca]=Ús d'espai de disc dur
-Name[ca@valencia]=Ús d'espai de disc dur
-Name[cs]=Využití místa na pevném disku
-Name[da]=Brug af harddiskplads
-Name[de]=Festplattenbelegung
-Name[el]=Χρήση χώρου σκληρού δίσκου
-Name[en_GB]=Hard Disk Space Usage
-Name[es]=Espacio usado en el disco duro
-Name[et]=Kõvaketta ruumikasutus
-Name[eu]=Disko zurruneko espazioaren erabilera
-Name[fi]=Kiintolevyjen tilankäyttö
-Name[fr]=Utilisation de l'espace des disques dur
-Name[gl]=Uso do espazo do disco duro
-Name[he]=שימוש בדיסק
-Name[hu]=Lemezterület használat
-Name[ia]=Usage de spatio del disco dur
-Name[id]=Penggunaan Ruang Hard Disk
-Name[is]=Staða harðra diska
-Name[it]=Spazio del disco fisso
-Name[ja]=ハードディスク使用量
-Name[kk]=Қатқыл дискідегі пайдаланған орын
-Name[km]=ការប្រើប្រាស់ទំហំថាសរឹង
-Name[ko]=하드디스크 공간 사용량
-Name[lt]=Standžiojo disko vietos panaudojimas
-Name[lv]=Cietā diska telpas lietojums
-Name[ml]=ഹാര്ഡ് ഡിസ്ക് ഉപയോഗം
-Name[mr]=हार्ड डिस्क वापर
-Name[nb]=Plassbruk for harddisk
-Name[nds]=Fastplaat-Bruuk
-Name[nl]=Ruimtegebruik van de harde schijf
-Name[nn]=Plassbruk for harddisk
-Name[pa]=ਹਾਰਡ ਡਿਸਕ ਥਾਂ ਵਰਤੋਂ
-Name[pl]=Wykorzystanie dysku twardego
-Name[pt]=Utilização do Disco Rígido
-Name[pt_BR]=Uso do espaço do disco rígido
-Name[ro]=Utilizarea spațiului pe discul dur
-Name[ru]=Использование места на диске
-Name[sk]=Využitie miesta na pevnom disku
-Name[sl]=Uporaba prostora na trdem disku
-Name[sr]=заузеће хард диска
-Name[sr@ijekavian]=заузеће хард диска
-Name[sr@ijekavianlatin]=zauzeće hard diska
-Name[sr@latin]=zauzeće hard diska
-Name[sv]=Utrymmesanvändning för hårddisk
-Name[tr]=Sabit Disk Alanı Kullanımı
-Name[uk]=Використання місця на диску
-Name[vi]=Sử dụng không gian đĩa
-Name[x-test]=xxHard Disk Space Usagexx
-Name[zh_CN]=硬盘空间使用情况
-Name[zh_TW]=硬碟空間使用量
-Comment=An applet that monitors hard disk space usage and percentage
-Comment[ar]=بُريْمج يراقب استخدام مساحة القرص الصلب ونسبته المئوية
-Comment[bs]=Aplet koji prati korištenje prostora na hard disku i postotak
-Comment[ca]=Una miniaplicació que controla l'ús d'espai i el tant per cent al disc dur
-Comment[ca@valencia]=Una miniaplicació que controla l'ús d'espai i el tant per cent en el disc dur
-Comment[cs]=Aplet, jenž monitoruje zaplnění místa na disku
-Comment[da]=En applet som overvåger brug af harddiskplads og procent ledig plads
-Comment[de]=Ein Miniprogramm, das die Festplattenbelegung absolut und in Prozent überwacht
-Comment[el]=Μικροεφαρμογή που εποπτεύει την ποσοτική και ποσοστιαία χρήση χώρου του σκληρού δίσκου
-Comment[en_GB]=An applet that monitors hard disk space usage and percentage
-Comment[es]=Una miniaplicación que monitoriza el uso y porcentaje del espacio en disco duro
-Comment[et]=Kõvaketta ruumikasutust ja protsenti jälgiv aplett
-Comment[eu]=Disko zurruneko espazioaren erabilera eta ehunekoa gainbegiratzen dituen aplikaziotxo bat
-Comment[fi]=Näyttää levyjen tilankäytön ja sen prosenttiosuuden
-Comment[fr]=Une applet surveillant l'utilisation de l'espace des disques durs et donnant des pourcentages
-Comment[gl]=Un trebello que vixía o espazo usado do disco duro e a porcentaxe
-Comment[he]=ישומון להצגת סך השימוש בכוננים השונים
-Comment[hu]=Egy kisalkalmazás, amely figyeli a merevlemez használatot és százalékot
-Comment[ia]=Un applet que monitora usage e percentage de spatio de disco dur
-Comment[id]=Sebuah applet yang memantau persentase dan penggunaan ruang hard disk
-Comment[is]=Smáforrit sem fylgist með notkun harðra diska og prósentuhlutfalli á lausu plássi
-Comment[it]=Un'applet che controlla l'uso dello spazio su disco fisso
-Comment[ja]=ハードディスクの使用量とパーセンテージを監視するアプレット
-Comment[kk]=Қатқыл дискідегі пайдаланған орын және пайызын бақылау аплеті
-Comment[km]=អាប់ភ្លេតដែលត្រួតពិនិត្យការប្រើប្រាស់ និងភាគរយទំហំថាសរឹង
-Comment[ko]=하드디스크 공간 사용량 및 비율을 보여 주는 애플릿
-Comment[lt]=Programėlė, kuri stebi disko vietos panaudojimą ir procentinę dalį
-Comment[ml]=ഹാര്ഡ് ഡിസ്ക് സ്ഥലോപയോഗം നിരീക്ഷിക്കാനുള്ള അപ്ലെറ്റ്
-Comment[mr]=हार्ड डिस्क वापर व टक्केवारी दर्शविणारे एप्लेट
-Comment[nb]=Et miniprogram som overvåker bruk av plass på harddisk, og prosentvis
-Comment[nds]=En Lüttprogramm, dat den Fastplaat-Bruuk afsluuts un in Perzent beluert
-Comment[nl]=Een applet die het ruimtegebruik van de harde schijf volgt
-Comment[nn]=Skjemelement som overvaker bruk av diskplass på harddisk, og viser som prosent
-Comment[pa]=ਐਪਲਿਟ, ਜੋ ਕਿ ਹਾਰਡ ਡਿਸਕ ਵਲੋਂ ਵਰਤੀ ਥਾਂ ਅਤੇ ਫੀਸਦੀ ਦੀ ਨਿਗਰਾਨੀ ਕਰਦਾ ਹੈ
-Comment[pl]=Monitoruje wykorzystaną przestrzeń i procent wykorzystania dysku twardego
-Comment[pt]=Uma 'applet' que vigia a utilização e percentagem do disco
-Comment[pt_BR]=Monitora o uso do espaço do disco rígido e a porcentagem
-Comment[ro]=Miniaplicație ce monitorizează gradul de utilizare a discului dur
-Comment[ru]=Мониторинг используемого дискового пространства
-Comment[sk]=Applet, ktorý monitoruje použitie miesta na pevnom disku a percentá
-Comment[sl]=Programček, ki nadzoruje uporabo prostora na trdem disku
-Comment[sr]=Аплет за надгледање заузећа хард диска
-Comment[sr@ijekavian]=Аплет за надгледање заузећа хард диска
-Comment[sr@ijekavianlatin]=Aplet za nadgledanje zauzeća hard diska
-Comment[sr@latin]=Aplet za nadgledanje zauzeća hard diska
-Comment[sv]=Ett miniprogram som övervakar hårddiskutrymme och procent
-Comment[tr]=Sabit disk kullanımını izleyen ve yüzde olarak gösteren bir programcık
-Comment[uk]=Аплет, який стежить за використанням місця на диску
-Comment[vi]=Một ứng dụng nhỏ quản lý phần trăm sử dụng không gian đĩa
-Comment[x-test]=xxAn applet that monitors hard disk space usage and percentagexx
-Comment[zh_CN]=监视硬盘空间使用率的小程序
-Comment[zh_TW]=監視硬碟空間使用量百分比的小程式
-
+Name=Disk Usage
+Comment=System monitor Widget that shows the usage of the root partition
Type=Service
-Icon=drive-harddisk
-
+Icon=cpu
X-KDE-ServiceTypes=Plasma/Applet
X-Plasma-API=declarativeappletscript
-X-Plasma-MainScript=ui/diskusage.qml
-X-Plasma-StandAloneApp=true
+X-Plasma-MainScript=ui/main.qml
+X-Plasma-Provides=org.kde.plasma.systemmonitor
+X-Plasma-RootPath=org.kde.plasma.systemmonitor
X-KDE-PluginInfo-Author=Marco Martin
X-KDE-PluginInfo-Email=mart@kde.org
X-KDE-PluginInfo-Name=org.kde.plasma.systemmonitor.diskusage
X-KDE-PluginInfo-Version=1.0
-X-KDE-PluginInfo-Website=https://kde.org/plasma-desktop
-X-KDE-PluginInfo-Category=System Information
+X-KDE-PluginInfo-Website=kde.org
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL-2.0+
-X-KDE-FormFactors=tablet,mediacenter,desktop
+X-KDE-PluginInfo-EnabledByDefault=true
+X-KDE-PluginInfo-Category=System Information
+
+[Config]
+chartFace=org.kde.ksysguard.piechart
+sensorIds=partitions/all/usedspace
+totalSensor=partitions/all/filllevel
+textOnlySensorIds=partitions/all/total
+
+[FaceConfig]
+rangeAuto=true
+rangeFrom=0
+rangeTo=100
diff --git a/applets/systemmonitor/memory/Messages.sh b/applets/systemmonitor/memory/Messages.sh
deleted file mode 100644
--- a/applets/systemmonitor/memory/Messages.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#! /usr/bin/env bash
-$XGETTEXT `find . -name \*.js -o -name \*.qml -o -name \*.cpp` `find ../common -name \*.qml` -o $podir/plasma_applet_org.kde.plasma.systemmonitor.memory.pot
diff --git a/applets/systemmonitor/memory/contents/config/config.qml b/applets/systemmonitor/memory/contents/config/config.qml
deleted file mode 100644
--- a/applets/systemmonitor/memory/contents/config/config.qml
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2013 Bhushan Shah
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, 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 General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
- */
-
-import QtQuick 2.0
-
-import org.kde.plasma.configuration 2.0
-
-ConfigModel {
- ConfigCategory {
- name: i18n("Memory")
- icon: "media-flash"
- source: "memoryConfig.qml"
- }
-}
diff --git a/applets/systemmonitor/memory/contents/ui/memoryConfig.qml b/applets/systemmonitor/memory/contents/ui/memoryConfig.qml
deleted file mode 100644
--- a/applets/systemmonitor/memory/contents/ui/memoryConfig.qml
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2015 Marco Martin
- *
- *
- * 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.0
-import QtQuick.Layouts 1.1
-import org.kde.plasma.plasmoid 2.0
-import org.kde.plasma.core 2.0 as PlasmaCore
-import org.kde.plasma.components 2.0 as PlasmaComponents
-import org.kde.kquickcontrolsaddons 2.0 as KQuickAddons
-
-ConfigGeneral {
- id: root
-
- onSourceAdded: {
- if (source === "mem/physical/application") {
- root.addSource(source, i18n("Physical memory"));
- } else if (source === "mem/swap/used") {
- root.addSource(source, i18n("Swap"));
- }
- }
-}
diff --git a/applets/systemmonitor/memory/metadata.desktop b/applets/systemmonitor/memory/metadata.desktop
--- a/applets/systemmonitor/memory/metadata.desktop
+++ b/applets/systemmonitor/memory/metadata.desktop
@@ -1,151 +1,33 @@
[Desktop Entry]
-Name=Memory Status
-Name[ar]=حالة الذاكرة
-Name[ast]=Estáu de la memoria
-Name[bg]=Състояние на паметта
-Name[bs]=Stanje memorije
-Name[ca]=Estat de la memòria
-Name[ca@valencia]=Estat de la memòria
-Name[cs]=Stav paměti
-Name[da]=Hukommelsesstatus
-Name[de]=Speicherstatus
-Name[el]=Κατάσταση μνήμης
-Name[en_GB]=Memory Status
-Name[eo]=Memora stato
-Name[es]=Estado de la memoria
-Name[et]=Mälu olek
-Name[eu]=Memoria egoera
-Name[fi]=Muistin käyttö
-Name[fr]=État de la mémoire
-Name[ga]=Stádas Cuimhne
-Name[gl]=Estado da memoria
-Name[gu]=મેમરી પરિસ્થિતિ
-Name[he]=מצב הזיכרון
-Name[hi]=मेमोरी स्थिति
-Name[hr]=Stanje memorije
-Name[hu]=Memóriaállapot
-Name[ia]=Stato de memoria
-Name[id]=Status Memori
-Name[is]=Staða minnis
-Name[it]=Stato della memoria
-Name[ja]=メモリの状態
-Name[kk]=Жад күй-жайы
-Name[km]=ស្ថានភាពសតិ
-Name[kn]=ಸ್ಮೃತಿ (ಮೆಮೊರಿ) ಸ್ಥಿತಿ
-Name[ko]=메모리 상태
-Name[lt]=Atminties būsena
-Name[lv]=Atmiņas statuss
-Name[mr]=स्मृति स्थिति
-Name[nb]=Minnestatus
-Name[nds]=Spieker-Status
-Name[nl]=Geheugen-status
-Name[nn]=Minnestatus
-Name[pa]=ਮੈਮੋਰੀ ਹਾਲਤ
-Name[pl]=Wykorzystanie pamięci
-Name[pt]=Estado da Memória
-Name[pt_BR]=Status da memória
-Name[ro]=Stare memorie
-Name[ru]=Использование памяти
-Name[si]=මතක තත්ත්වය
-Name[sk]=Stav pamäte
-Name[sl]=Stanje pomnilnika
-Name[sr]=стање меморије
-Name[sr@ijekavian]=стање меморије
-Name[sr@ijekavianlatin]=stanje memorije
-Name[sr@latin]=stanje memorije
-Name[sv]=Minnesstatus
-Name[th]=สถานะหน่วยความจำ
-Name[tr]=Bellek Durumu
-Name[ug]=ئەسلەك ھالىتى
-Name[uk]=Стан пам’яті
-Name[wa]=Estat del memwere
-Name[x-test]=xxMemory Statusxx
-Name[zh_CN]=内存状态
-Name[zh_TW]=記憶體狀態
-Comment=A RAM usage monitor
-Comment[ar]=مرقاب لاستخدام الذاكرة العشوائية
-Comment[bg]=Изпозлване на оперативната памет (RAM)
-Comment[bs]=Nadgledanje upotrebe RAM‑a
-Comment[ca]=Un controlador d'ús de la RAM
-Comment[ca@valencia]=Un controlador d'ús de la RAM
-Comment[cs]=Monitor využití RAM
-Comment[csb]=Mònitór brëkòwaniô pamiãcë RAM
-Comment[da]=Overvågning af ram-forbrug
-Comment[de]=Ein Überwachungsmonitor für den Arbeitsspeicher
-Comment[el]=Ένας επόπτης χρήσης μνήμης RAM
-Comment[en_GB]=A RAM usage monitor
-Comment[eo]=RAM uzada rigardilo
-Comment[es]=Monitor de uso de la RAM
-Comment[et]=RAM-i kasutuse jälgija
-Comment[eu]=RAM erabileraren begirale bat
-Comment[fi]=Näyttää muistin käytön
-Comment[fr]=Surveillance de l'usage de la mémoire vive
-Comment[fy]=In RAM brûkme monitor
-Comment[ga]=Monatóir úsáid RAM
-Comment[gl]=Un vixilante do utilización da memoria RAM
-Comment[gu]=રેમ વપરાશ દેખરેખ
-Comment[he]=משמש לניטור השימוש בזיכרון ה־RAM
-Comment[hi]=रेम उपयोग मॉनीटर
-Comment[hr]=Nadzor korištenja RAM memorije
-Comment[hu]=Memóriahasználat-figyelő
-Comment[ia]=Un monitor del usage de RAM
-Comment[id]=Sebuah pemantau penggunaan RAM
-Comment[is]=Eftirlit með notkun vinnsluminnis
-Comment[it]=Indica l'uso della RAM
-Comment[ja]=RAM 使用率を監視します
-Comment[kk]=Жадыны пайдалануын бақылау
-Comment[km]=កម្មវិធីត្រួតពិនិត្យការប្រើសតិ
-Comment[kn]=RAM ಬಳಕೆಯ ಮೇಲ್ವಿಚಾರಕ
-Comment[ko]=RAM 사용량 모니터
-Comment[lt]=RAM naudojimo prižiūryklė
-Comment[lv]=Atmiņas izmantotāja novērotājs
-Comment[mai]=रैम उपयोग मानीटर
-Comment[mk]=Монитор на користењето на меморијата
-Comment[ml]=ഒരു റാം ഉപയോഗ നിരീക്ഷണോപാധി
-Comment[mr]=RAM वापरणी नियंत्रक
-Comment[nb]=En overvåker for RAM-bruk
-Comment[nds]=En Kieker för den RAM-Bruuk
-Comment[nl]=Volgt het RAM-gebruik
-Comment[nn]=Overvaking av minnebruk
-Comment[pa]=ਇੱਕ RAM ਵਰਤੋਂ ਮਾਨੀਟਰ
-Comment[pl]=Monitoruje wykorzystanie pamięci RAM
-Comment[pt]=Um monitor da utilização da RAM
-Comment[pt_BR]=Um monitor de utilização da RAM
-Comment[ro]=Monitor pentru utilizarea memoriei
-Comment[ru]=Монитор использования оперативной памяти
-Comment[si]=RAM භාවිතය නිරික්ෂකය
-Comment[sk]=Monitor využitia RAM
-Comment[sl]=Nadzornik porabe hitrega pomnilnika
-Comment[sr]=Надгледање употребе РАМ‑а
-Comment[sr@ijekavian]=Надгледање употребе РАМ‑а
-Comment[sr@ijekavianlatin]=Nadgledanje upotrebe RAM‑a
-Comment[sr@latin]=Nadgledanje upotrebe RAM‑a
-Comment[sv]=Övervakning av minnesanvändning
-Comment[tg]=Назорати истифодабарии RAM
-Comment[th]=ตัวติดตามการใช้งานหน่วยความจำ
-Comment[tr]=Bir bellek kullanımı izleyici
-Comment[ug]=RAM ئىشلىتىشنى كۆزەتكۈچ
-Comment[uk]=Монітор використання пам’яті
-Comment[wa]=On corwaitoe di l' eployaedje del RAM
-Comment[x-test]=xxA RAM usage monitorxx
-Comment[zh_CN]=RAM 利用率监视器
-Comment[zh_TW]=記憶體使用量監視器
-
+Name=Memory Usage
+Name[de]=Speicherverwendung
+Comment=System monitor Widget that shows physical memory usage
Type=Service
-Icon=media-flash
-
+Icon=ksysguardd
X-KDE-ServiceTypes=Plasma/Applet
X-Plasma-API=declarativeappletscript
-X-Plasma-MainScript=ui/memory.qml
-X-Plasma-StandAloneApp=true
+X-Plasma-MainScript=ui/main.qml
+X-Plasma-Provides=org.kde.plasma.systemmonitor
+X-Plasma-RootPath=org.kde.plasma.systemmonitor
-X-KDE-PluginInfo-Author=Marco Martin
-X-KDE-PluginInfo-Email=mart@kde.org
+X-KDE-PluginInfo-Author=Kai Uwe Broulik
+X-KDE-PluginInfo-Email=kde@privat.broulik.de
X-KDE-PluginInfo-Name=org.kde.plasma.systemmonitor.memory
X-KDE-PluginInfo-Version=1.0
-X-KDE-PluginInfo-Website=https://kde.org/plasma-desktop
-X-KDE-PluginInfo-Category=System Information
+X-KDE-PluginInfo-Website=kde.org
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL-2.0+
-X-KDE-FormFactors=tablet,mediacenter,desktop
+X-KDE-PluginInfo-EnabledByDefault=true
+X-KDE-PluginInfo-Category=System Information
+
+[Config]
+chartFace=org.kde.ksysguard.piechart
+sensorIds=mem/physical/allocated
+totalSensor=mem/physical/allocatedlevel
+textOnlySensorIds=mem/physical/total
+
+[FaceConfig]
+rangeAuto=true
+rangeFrom=0
+rangeTo=100
diff --git a/applets/systemmonitor/net/Messages.sh b/applets/systemmonitor/net/Messages.sh
deleted file mode 100644
--- a/applets/systemmonitor/net/Messages.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#! /usr/bin/env bash
-$XGETTEXT `find . -name \*.js -o -name \*.qml -o -name \*.cpp` `find ../common -name \*.qml` -o $podir/plasma_applet_org.kde.plasma.systemmonitor.net.pot
diff --git a/applets/systemmonitor/net/contents/config/config.qml b/applets/systemmonitor/net/contents/config/config.qml
deleted file mode 100644
--- a/applets/systemmonitor/net/contents/config/config.qml
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013 Bhushan Shah
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, 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 General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
- */
-
-import QtQuick 2.0
-
-import org.kde.plasma.configuration 2.0
-
-ConfigModel {
- ConfigCategory {
- name: i18n("Interfaces")
- icon: "network-workgroup"
- source: "netConfig.qml"
- }
- ConfigCategory {
- name: i18n("Units")
- icon: "kruler"
- source: "displayConfig.qml"
- }
-}
diff --git a/applets/systemmonitor/net/contents/ui/displayConfig.qml b/applets/systemmonitor/net/contents/ui/displayConfig.qml
deleted file mode 100644
--- a/applets/systemmonitor/net/contents/ui/displayConfig.qml
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2019 George Vogiatzis
- *
- *
- * 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.0
-import QtQuick.Layouts 1.1
-import org.kde.plasma.plasmoid 2.0
-import QtQuick.Controls 2.5 as QQC2
-import org.kde.kirigami 2.5 as Kirigami
-
-Kirigami.FormLayout {
- property int cfg_displayUnit: plasmoid.configuration.displayUnit
-
- QQC2.ButtonGroup {
- id: displayUnitGroup
- }
-
- QQC2.RadioButton {
- id: byteDisplayUnit
- QQC2.ButtonGroup.group: displayUnitGroup
-
- Kirigami.FormData.label: i18nc("@label", "Display unit:")
-
- text: i18nc("@option:radio", "Byte")
- checked: cfg_displayUnit == 0
- onClicked: if (checked) {cfg_displayUnit = 0;}
- }
-
- QQC2.RadioButton {
- id: bitDisplayUnit
- QQC2.ButtonGroup.group: displayUnitGroup
-
- text: i18nc("@option:radio", "bit")
-
- checked: cfg_displayUnit == 1
- onClicked: if (checked) {cfg_displayUnit = 1;}
- }
-}
diff --git a/applets/systemmonitor/net/contents/ui/net.qml b/applets/systemmonitor/net/contents/ui/net.qml
deleted file mode 100644
--- a/applets/systemmonitor/net/contents/ui/net.qml
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2015 Marco Martin
- *
- *
- * 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.0
-import QtQuick.Layouts 1.1
-import org.kde.plasma.plasmoid 2.0
-import org.kde.plasma.core 2.0 as PlasmaCore
-import org.kde.plasma.components 2.0 as PlasmaComponents
-import org.kde.kquickcontrolsaddons 2.0 as KQuickAddons
-import org.kde.kcoreaddons 1.0 as KCoreAddons
-
-Applet {
- id: root
-
- onSourceAdded: {
- if (source.indexOf("network/interfaces/lo/") !== -1) {
- return;
- }
- var match = source.match(/^network\/interfaces\/(\w+)\/transmitter\/data$/);
- if (match) {
- var rxSource = "network/interfaces/" + match[1] + "/receiver/data";
- root.addSource(source, match[1], rxSource, match[1]);
- }
- }
-
- delegate: DoublePlotter {
- function formatData(data) {
- if (plasmoid.configuration.displayUnit === 0) {
- var value = data.value * 1024
- return i18nc("%1 is the displayed data transfer speed in bytes per second", "%1/s", KCoreAddons.Format.formatByteSize(value));
- } else {
- var value = data.value * 1024 * 8
- if (value > (1024 * 1024)) {
- return i18nc("%1 is the displayed data transfer speed in megabits per second", "%1 Mbps", (value / (1024 * 1024)).toFixed(1));
- }
- if (value > 1024) {
- return i18nc("%1 is the displayed data transfer speed in kilobits per second", "%1 Kbps", (value / 1024));
- }
- return i18nc("%1 is the displayed data transfer speed in bits per second", "%1 bps", value);
- }
- }
- }
-}
diff --git a/applets/systemmonitor/net/contents/ui/netConfig.qml b/applets/systemmonitor/net/contents/ui/netConfig.qml
deleted file mode 100644
--- a/applets/systemmonitor/net/contents/ui/netConfig.qml
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2015 Marco Martin
- *
- *
- * 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.0
-import QtQuick.Layouts 1.1
-import org.kde.plasma.plasmoid 2.0
-import org.kde.plasma.core 2.0 as PlasmaCore
-import org.kde.plasma.components 2.0 as PlasmaComponents
-import org.kde.kquickcontrolsaddons 2.0 as KQuickAddons
-
-ConfigGeneral {
- id: root
-
- onSourceAdded: {
- if (source.indexOf("network/interfaces/lo/") !== -1) {
- return;
- }
- var match = source.match(/^network\/interfaces\/(\w+)\/transmitter\/data$/);
- if (match) {
- root.addSource(source, match[1]);
- }
- }
-}
diff --git a/applets/systemmonitor/net/metadata.desktop b/applets/systemmonitor/net/metadata.desktop
--- a/applets/systemmonitor/net/metadata.desktop
+++ b/applets/systemmonitor/net/metadata.desktop
@@ -1,157 +1,30 @@
[Desktop Entry]
-Name=Network Monitor
-Name[ar]=مرقاب الشبكة
-Name[bg]=Наблюдение на мрежата
-Name[bs]=Nadzor mreže
-Name[ca]=Monitor de la xarxa
-Name[ca@valencia]=Monitor de la xarxa
-Name[cs]=Monitor sítě
-Name[da]=Netværksovervågning
-Name[de]=Netzwerküberwachung
-Name[el]=Επόπτης δικτύου
-Name[en_GB]=Network Monitor
-Name[es]=Monitor de red
-Name[et]=Võrgujälgija
-Name[eu]=Sareko begiralea
-Name[fi]=Verkon käyttö
-Name[fr]=Surveillance du réseau
-Name[ga]=Monatóir an Líonra
-Name[gl]=Vixilante da rede
-Name[gu]=નેટવર્ક મોનિટર
-Name[he]=מוניטור רשת
-Name[hi]=नेटवर्क नरीक्षण
-Name[hr]=Nadzornik mreže
-Name[hu]=Hálózatfigyelő
-Name[ia]=Monitor de Rete
-Name[id]=Pemantau Jaringan
-Name[is]=Netkerfisvaktari
-Name[it]=Monitor di rete
-Name[ja]=ネットワークモニタ
-Name[kk]=Желіні бақылау
-Name[km]=ត្រួតពិនិត្យបណ្ដាញ
-Name[kn]=ಜಾಲಬಂಧ ಮೇಲ್ವಿಚಾರಕ
-Name[ko]=네트워크 모니터
-Name[lt]=Tinklo prižiūryklė
-Name[lv]=Tīkla monitors
-Name[ml]=നെറ്റ്വര്ക്ക് മോണിറ്റര്
-Name[mr]=संजाळ नियंत्रक
-Name[nb]=Nettverksovervåker
-Name[nds]=Nettwark-Kieker
-Name[nl]=Netwerkmonitor
-Name[nn]=Nettverksovervaking
-Name[pa]=ਨੈੱਟਵਰਕ ਨਿਗਰਾਨ
-Name[pl]=Monitor sieci
-Name[pt]=Monitor da Rede
-Name[pt_BR]=Monitor da rede
-Name[ro]=Monitor de rețea
-Name[ru]=Сетевой монитор
-Name[se]=Fierbmi
-Name[si]=ජාල මොනිටරය
-Name[sk]=Monitor siete
-Name[sl]=Nadzornik omrežja
-Name[sr]=надзор мреже
-Name[sr@ijekavian]=надзор мреже
-Name[sr@ijekavianlatin]=nadzor mreže
-Name[sr@latin]=nadzor mreže
-Name[sv]=Nätverksövervakning
-Name[tg]=Назорати шабака
-Name[th]=ติดตามการใช้งานเครือข่าย
-Name[tr]=Ağ İzleyici
-Name[ug]=تور كۆزەتكۈچ
-Name[uk]=Монітор мережі
-Name[wa]=Corwaitoe del rantoele
-Name[x-test]=xxNetwork Monitorxx
-Name[zh_CN]=网络监视器
-Name[zh_TW]=網路監控
-Comment=A network usage monitor
-Comment[ar]=مرقاب لاستخدام الشبكة
-Comment[be@latin]=Nazirańnik zaniataści sietki
-Comment[bg]=Наблюдение на изпозлването на мрежата
-Comment[bs]=Nadgledanje upotrebe mreže
-Comment[ca]=Un controlador d'ús de la xarxa
-Comment[ca@valencia]=Un controlador d'ús de la xarxa
-Comment[cs]=Monitor využití sítě
-Comment[csb]=Mònitór brëkòwaniô sécë
-Comment[da]=Overvågning af netværkstrafik
-Comment[de]=Ein Überwachungsmonitor für Netzwerke
-Comment[el]=Ένας επόπτης χρήσης του δικτύου
-Comment[en_GB]=A network usage monitor
-Comment[es]=Monitor de uso de la red
-Comment[et]=Võrgukasutuse jälgija
-Comment[eu]=Sare erabileraren begirale bat
-Comment[fi]=Näyttää verkon käytön
-Comment[fr]=Surveillance de l'usage réseau
-Comment[fy]=In netwurk brûkme monitor
-Comment[ga]=Monatóir úsáide an líonra
-Comment[gl]=Un vixilante do estado da rede
-Comment[gu]=નેટવર્ક સ્થિતિ દેખરેખ
-Comment[he]=משמש לניטור השימוש ברשת
-Comment[hi]=नेटवर्क उपयोग मॉनीटर
-Comment[hne]=नेटवर्क उपयोग देखइया
-Comment[hr]=Nadzor korištenja mreže
-Comment[hsb]=Monitor, kiž pokazuje wućeženosć syće
-Comment[hu]=Kijelzi a hálózat állapotát
-Comment[ia]=Un monitor de usage de rete
-Comment[id]=Sebuah pemantau penggunaan jaringan
-Comment[is]=Eftirlit með notkun netsins
-Comment[it]=Indica l'uso della rete
-Comment[ja]=ネットワークの活動を監視します
-Comment[kk]=Желі пайдалануын бақылау
-Comment[km]=កម្មវិធីត្រួតពិនិត្យការប្រើបណ្ដាញ
-Comment[kn]=ಜಾಲಬಂಧ ಬಳಕೆಯ ಮೇಲ್ವಿಚಾರಕ
-Comment[ko]=네트워크 사용량 모니터
-Comment[ku]=Temaşekerê rewşa torê
-Comment[lt]=Tinklo naudojimo prižiūryklė
-Comment[lv]=Tīkla noslogojuma novērotājs
-Comment[mk]=Монитор на користењето на мрежата
-Comment[ml]=ഒരു നെറ്റ്വര്ക്ക് ഉപയോഗ നിരീക്ഷണോപാധി
-Comment[mr]=संजाळ वापरणी नियंत्रक
-Comment[nb]=En overvåker for nettverksbruk
-Comment[nds]=En Kieker för den Nettwark-Bruuk
-Comment[nl]=Toont het netwerkgebruik
-Comment[nn]=Overvaking av nettverksbruk
-Comment[or]=ଗୋଟିଏ ନେଟୱର୍କ ବ୍ୟବହାର ବିଧି ନିରିକ୍ଷକ
-Comment[pa]=ਨੈੱਟਵਰਕ ਵਰਤੋਂ ਨਿਗਰਾਨ
-Comment[pl]=Monitoruje wykorzystanie sieci
-Comment[pt]=Um monitor da utilização da rede
-Comment[pt_BR]=Um monitor de utilização da rede
-Comment[ro]=Monitor de utilizare a rețelei
-Comment[ru]=Монитор сетевой активности
-Comment[si]=ජාල භාවිතය නිරික්ෂකය
-Comment[sk]=Monitor využitia siete
-Comment[sl]=Nadzornik uporabe omrežja
-Comment[sr]=Надгледање употребе мреже
-Comment[sr@ijekavian]=Надгледање употребе мреже
-Comment[sr@ijekavianlatin]=Nadgledanje upotrebe mreže
-Comment[sr@latin]=Nadgledanje upotrebe mreže
-Comment[sv]=Övervakning av nätverksanvändning
-Comment[ta]=பிணைய பயன்பாடு நோட்டம்
-Comment[tg]=Назорати истифодабарии шабака
-Comment[th]=ตัวติดตามดูการใช้งานเครือข่าย
-Comment[tr]=Bir ağ kullanımı izleyici
-Comment[ug]=تور ئىشلىتىشنى كۆزەتكۈچ
-Comment[uk]=Монітор використання мережі
-Comment[wa]=On corwaitoe di l' eployaedje del rantoele
-Comment[x-test]=xxA network usage monitorxx
-Comment[zh_CN]=网络利用率监视器
-Comment[zh_TW]=網路使用量監視器
+Name=Network speed
+Comment=System monitor Widget that shows the download and upload data rate
Type=Service
Icon=network-workgroup
-
X-KDE-ServiceTypes=Plasma/Applet
X-Plasma-API=declarativeappletscript
-X-Plasma-MainScript=ui/net.qml
-X-Plasma-StandAloneApp=true
-
-X-Plasma-ConfigPlugins=solid-actions,device_automounter_kcm
+X-Plasma-MainScript=ui/main.qml
+X-Plasma-Provides=org.kde.plasma.systemmonitor
+X-Plasma-RootPath=org.kde.plasma.systemmonitor
X-KDE-PluginInfo-Author=Marco Martin
X-KDE-PluginInfo-Email=mart@kde.org
X-KDE-PluginInfo-Name=org.kde.plasma.systemmonitor.net
X-KDE-PluginInfo-Version=1.0
-X-KDE-PluginInfo-Website=https://kde.org/plasma-desktop
-X-KDE-PluginInfo-Category=System Information
+X-KDE-PluginInfo-Website=kde.org
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL-2.0+
-X-KDE-FormFactors=tablet,mediacenter,desktop
+X-KDE-PluginInfo-EnabledByDefault=true
+X-KDE-PluginInfo-Category=System Information
+
+[Config]
+chartFace=org.kde.ksysguard.linechart
+sensorIds=network/all/receivedDataRate,network/all/sentDataRate
+totalSensor=
+textOnlySensorIds=
+
+[FaceConfig]
+lineChartSmooth=true
diff --git a/applets/systemmonitor/systemmonitor/CMakeLists.txt b/applets/systemmonitor/systemmonitor/CMakeLists.txt
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/CMakeLists.txt
@@ -0,0 +1,33 @@
+set(systemmonitor_SRCS
+ systemmonitor.cpp
+)
+
+add_library(plasma_applet_systemmonitor MODULE ${systemmonitor_SRCS})
+
+kcoreaddons_desktop_to_json(plasma_applet_systemmonitor package/metadata.desktop)
+
+target_link_libraries(plasma_applet_systemmonitor
+ Qt5::Gui
+ Qt5::Qml
+ Qt5::Quick
+ Qt5::DBus
+ KF5::Plasma
+ KF5::Package
+ KF5::I18n
+ KF5::ConfigCore
+ KF5::ConfigGui
+ KF5::Declarative
+ KF5::SysGuard
+ KF5::Sensors
+ KF5::NewStuff
+ )
+
+
+install(TARGETS plasma_applet_systemmonitor DESTINATION ${KDE_INSTALL_PLUGINDIR}/plasma/applets)
+
+plasma_install_package(package org.kde.plasma.systemmonitor)
+
+install(FILES systemmonitor-faces.knsrc systemmonitor-presets.knsrc DESTINATION ${KDE_INSTALL_KNSRCDIR})
+
+add_subdirectory(packagestructure)
+add_subdirectory(faces)
diff --git a/applets/systemmonitor/systemmonitor/Messages.sh b/applets/systemmonitor/systemmonitor/Messages.sh
new file mode 100755
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/Messages.sh
@@ -0,0 +1,4 @@
+#! /usr/bin/env bash
+$EXTRACTRC `find . -name \*.rc -o -name \*.ui -o -name \*.kcfg` >> rc.cpp
+$XGETTEXT `find . -name \*.js -o -name \*.qml -o -name \*.cpp` -o $podir/plasma_applet_org.kde.plasma.systemmonitor.pot
+rm -f rc.cpp
diff --git a/applets/systemmonitor/systemmonitor/faces/CMakeLists.txt b/applets/systemmonitor/systemmonitor/faces/CMakeLists.txt
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/faces/CMakeLists.txt
@@ -0,0 +1,10 @@
+
+function(install_sensorchart_face name)
+ kpackage_install_package(${name} org.kde.ksysguard.${name} sensorapplet ksysguard)
+endfunction()
+
+install_sensorchart_face(barchart)
+install_sensorchart_face(linechart)
+install_sensorchart_face(piechart)
+install_sensorchart_face(table)
+install_sensorchart_face(textonly)
diff --git a/applets/systemmonitor/systemmonitor/faces/barchart/contents/config/main.xml b/applets/systemmonitor/systemmonitor/faces/barchart/contents/config/main.xml
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/faces/barchart/contents/config/main.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+ true
+
+
+ false
+
+
+ 0
+
+
+ 100
+
+
+ true
+
+
+
+
diff --git a/applets/systemmonitor/systemmonitor/faces/barchart/contents/ui/BarChart.qml b/applets/systemmonitor/systemmonitor/faces/barchart/contents/ui/BarChart.qml
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/faces/barchart/contents/ui/BarChart.qml
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2019 Marco Martin
+ * Copyright 2019 David Edmundson
+ * Copyright 2019 Arjen Hiemstra
+ * Copyrigth 2019 Kai Uwe Broulik
+ *
+ * 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.quickcharts 1.0 as Charts
+
+Charts.BarChart {
+ id: root
+
+ readonly property int barCount: stacked ? 1 : instantiator.count
+
+ readonly property alias sensorsModel: sensorsModel
+
+ stacked: plasmoid.nativeInterface.faceConfiguration.barChartStacked
+
+ spacing: Math.round(width / 20)
+
+ yRange {
+ from: plasmoid.nativeInterface.faceConfiguration.rangeFrom
+ to: plasmoid.nativeInterface.faceConfiguration.rangeTo
+ automatic: plasmoid.nativeInterface.faceConfiguration.rangeAuto
+ }
+
+ Sensors.SensorDataModel {
+ id: sensorsModel
+ sensors: plasmoid.configuration.sensorIds
+ }
+
+ Instantiator {
+ id: instantiator
+ model: sensorsModel.sensors
+ delegate: Charts.ModelSource {
+ model: sensorsModel
+ roleName: "Value"
+ column: index
+ }
+ onObjectAdded: {
+ root.insertValueSource(index, object)
+ }
+ onObjectRemoved: {
+ root.removeValueSource(object)
+ }
+ }
+
+ colorSource: globalColorSource
+ nameSource: Charts.ModelSource {
+ model: sensorsModel
+ roleName: "ShortName"
+ indexColumns: true
+ }
+}
+
diff --git a/applets/systemmonitor/diskactivity/contents/ui/diskactivity.qml b/applets/systemmonitor/systemmonitor/faces/barchart/contents/ui/CompactRepresentation.qml
rename from applets/systemmonitor/diskactivity/contents/ui/diskactivity.qml
rename to applets/systemmonitor/systemmonitor/faces/barchart/contents/ui/CompactRepresentation.qml
--- a/applets/systemmonitor/diskactivity/contents/ui/diskactivity.qml
+++ b/applets/systemmonitor/systemmonitor/faces/barchart/contents/ui/CompactRepresentation.qml
@@ -1,10 +1,12 @@
/*
- * Copyright 2015 Marco Martin
- *
+ * Copyright 2019 Marco Martin
+ * Copyright 2019 David Edmundson
+ * Copyright 2019 Arjen Hiemstra
+ * Copyright 2019 Kai Uwe Broulik
*
* 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
+ * 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,
@@ -18,27 +20,29 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import QtQuick 2.0
+import QtQuick 2.9
+import QtQuick.Controls 2.2 as Controls
import QtQuick.Layouts 1.1
-import org.kde.plasma.plasmoid 2.0
-import org.kde.plasma.core 2.0 as PlasmaCore
-import org.kde.kquickcontrolsaddons 2.0 as KQuickAddons
-import org.kde.kcoreaddons 1.0 as KCoreAddons
-Applet {
- id: root
+import org.kde.kirigami 2.8 as Kirigami
- onSourceAdded: {
- var match = source.match(/^disk\/([^\/]+)\/Rate\/wblk/);
- if (match) {
- var rSource = "disk/" + match[1] + "/Rate/rblk"
- root.addSource(source, match[1], rSource, match[1]);
- }
- }
+import org.kde.ksysguard.sensors 1.0 as Sensors
+import org.kde.quickcharts 1.0 as Charts
+import org.kde.quickcharts.controls 1.0 as ChartControls
- delegate: DoublePlotter {
- function formatData(data) {
- return i18nc("%1 is value of data per seconds", "%1/s", KCoreAddons.Format.formatByteSize(data.value * 1024))
- }
+import org.kde.plasma.core 2.0 as PlasmaCore
+
+ColumnLayout {
+ BarChart {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ Layout.alignment: Qt.AlignCenter
+ }
+ Controls.Label {
+ id: label
+ visible: plasmoid.formFactor == PlasmaCore.Types.Planar
+ Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
+ text: plasmoid.configuration.title
}
}
+
diff --git a/applets/systemmonitor/systemmonitor/faces/barchart/contents/ui/Config.qml b/applets/systemmonitor/systemmonitor/faces/barchart/contents/ui/Config.qml
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/faces/barchart/contents/ui/Config.qml
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2019 Marco Martin
+ * Copyrigth 2019 Kai Uwe Broulik
+ *
+ * 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 Controls
+
+import org.kde.kirigami 2.8 as Kirigami
+
+import org.kde.ksysguard.sensors 1.0 as Sensors
+
+Kirigami.FormLayout {
+ id: root
+
+ property alias cfg_showLegend: showSensorsLegendCheckbox.checked
+ property alias cfg_barChartStacked: stackedCheckbox.checked
+ property alias cfg_rangeAuto: rangeAutoCheckbox.checked
+ property alias cfg_rangeFrom: rangeFromSpin.value
+ property alias cfg_rangeTo: rangeToSpin.value
+
+ Controls.CheckBox {
+ id: showSensorsLegendCheckbox
+ text: i18n("Show Sensors Legend")
+ }
+ Controls.CheckBox {
+ id: stackedCheckbox
+ text: i18n("Stacked Bars")
+ }
+ Controls.CheckBox {
+ id: rangeAutoCheckbox
+ text: i18n("Automatic Data Range")
+ }
+ Controls.SpinBox {
+ id: rangeFromSpin
+ Kirigami.FormData.label: i18n("From:")
+ enabled: !rangeAutoCheckbox.checked
+ }
+ Controls.SpinBox {
+ id: rangeToSpin
+ to: 99999
+ Kirigami.FormData.label: i18n("To:")
+ enabled: !rangeAutoCheckbox.checked
+ }
+}
+
diff --git a/applets/systemmonitor/systemmonitor/faces/barchart/contents/ui/FullRepresentation.qml b/applets/systemmonitor/systemmonitor/faces/barchart/contents/ui/FullRepresentation.qml
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/faces/barchart/contents/ui/FullRepresentation.qml
@@ -0,0 +1,71 @@
+/*
+ * 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.quickcharts 1.0 as Charts
+import org.kde.quickcharts.controls 1.0 as ChartControls
+
+ColumnLayout
+{
+ id: root
+
+ readonly property bool showLegend: plasmoid.nativeInterface.faceConfiguration.showLegend
+
+ // Arbitrary minimumWidth to make easier to align plasmoids in a predictable way
+ Layout.minimumWidth: Kirigami.Units.gridUnit * 8
+
+ Kirigami.Heading {
+ Layout.fillWidth: true
+ horizontalAlignment: Text.AlignHCenter
+ elide: Text.ElideRight
+ text: plasmoid.configuration.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)
+ }
+
+ Sensors.ExtendedLegend {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ visible: root.showLegend
+ chart: compactRepresentation
+ sourceModel: root.showLegend ? compactRepresentation.sensorsModel : null
+ colorSource: globalColorSource
+ textOnlySensorIds: root.showLegend ? plasmoid.configuration.textOnlySensorIds : []
+ }
+
+ Item {
+ Layout.fillHeight: true
+ }
+}
diff --git a/applets/systemmonitor/systemmonitor/faces/barchart/metadata.desktop b/applets/systemmonitor/systemmonitor/faces/barchart/metadata.desktop
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/faces/barchart/metadata.desktop
@@ -0,0 +1,18 @@
+[Desktop Entry]
+Name=Bar Chart
+Icon=office-chart-bar
+
+Type=Service
+X-KDE-ServiceTypes=Plasma/SensorApplet
+X-KDE-ParentApp=org.kde.plasmashell
+X-KDE-PluginInfo-Author=Kai Uwe Broulik
+X-KDE-PluginInfo-Email=kde@broulik.de
+X-KDE-PluginInfo-License=LGPLv2+
+X-KDE-PluginInfo-Name=org.kde.ksysguard.barchart
+X-KDE-PluginInfo-Version=1.0
+X-KDE-PluginInfo-Website=https://kde.org
+
+[Config]
+SupportsSensorsColors=true
+SupportsTotalSensor=false
+SupportsTextOnlySensors=true
diff --git a/applets/systemmonitor/systemmonitor/faces/linechart/contents/config/main.xml b/applets/systemmonitor/systemmonitor/faces/linechart/contents/config/main.xml
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/faces/linechart/contents/config/main.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+ true
+
+
+ 10
+
+
+ false
+
+
+ true
+
+
+ 0
+
+
+ 50
+
+
+ false
+
+
+ 0
+
+
+ 100
+
+
+ true
+
+
+
+
diff --git a/applets/systemmonitor/cpu/contents/ui/cpuConfig.qml b/applets/systemmonitor/systemmonitor/faces/linechart/contents/ui/CompactRepresentation.qml
rename from applets/systemmonitor/cpu/contents/ui/cpuConfig.qml
rename to applets/systemmonitor/systemmonitor/faces/linechart/contents/ui/CompactRepresentation.qml
--- a/applets/systemmonitor/cpu/contents/ui/cpuConfig.qml
+++ b/applets/systemmonitor/systemmonitor/faces/linechart/contents/ui/CompactRepresentation.qml
@@ -1,10 +1,12 @@
/*
- * Copyright 2015 Marco Martin
- *
+ * Copyright 2019 Marco Martin
+ * Copyright 2019 David Edmundson
+ * Copyright 2019 Arjen Hiemstra
+ * Copyright 2019 Kai Uwe Broulik
*
* 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
+ * 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,
@@ -18,24 +20,29 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import QtQuick 2.0
+import QtQuick 2.9
+import QtQuick.Controls 2.2 as Controls
import QtQuick.Layouts 1.1
-import org.kde.plasma.plasmoid 2.0
-import org.kde.plasma.core 2.0 as PlasmaCore
-import org.kde.plasma.components 2.0 as PlasmaComponents
-import org.kde.kquickcontrolsaddons 2.0 as KQuickAddons
-ConfigGeneral {
- id: root
+import org.kde.kirigami 2.8 as Kirigami
- onSourceAdded: {
- var match = source.match(/^cpu\/(\w+)\/TotalLoad/);
- if (match) {
- root.addSource(source, match[1]);
- }
- }
+import org.kde.ksysguard.sensors 1.0 as Sensors
+import org.kde.quickcharts 1.0 as Charts
+import org.kde.quickcharts.controls 1.0 as ChartControls
- function sourceDefaultEnable(source) {
- return source.match(/^cpu(\/|%2F)system(\/|%2F)TotalLoad/);
+import org.kde.plasma.core 2.0 as PlasmaCore
+
+ColumnLayout {
+ LineChart {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ Layout.alignment: Qt.AlignCenter
+ }
+ Controls.Label {
+ id: label
+ visible: plasmoid.formFactor == PlasmaCore.Types.Planar
+ Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
+ text: plasmoid.configuration.title
}
}
+
diff --git a/applets/systemmonitor/systemmonitor/faces/linechart/contents/ui/Config.qml b/applets/systemmonitor/systemmonitor/faces/linechart/contents/ui/Config.qml
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/faces/linechart/contents/ui/Config.qml
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2019 Marco Martin
+ *
+ * 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 Controls
+
+import org.kde.kirigami 2.8 as Kirigami
+
+import org.kde.ksysguard.sensors 1.0 as Sensors
+
+Kirigami.FormLayout {
+ id: root
+
+ property alias cfg_showLegend: showSensorsLegendCheckbox.checked
+ property alias cfg_lineChartStacked: stackedCheckbox.checked
+ property alias cfg_lineChartFillOpacity: fillOpacitySpin.value
+ property alias cfg_lineChartSmooth: smoothCheckbox.checked
+
+ property alias cfg_rangeAutoY: rangeAutoYCheckbox.checked
+ property alias cfg_rangeFromY: rangeFromYSpin.value
+ property alias cfg_rangeToY: rangeToYSpin.value
+ property alias cfg_rangeAutoX: rangeAutoXCheckbox.checked
+ property alias cfg_rangeFromX: rangeFromXSpin.value
+ property alias cfg_rangeToX: rangeToXSpin.value
+
+ Item {
+ Kirigami.FormData.label: i18n("Appearance")
+ Kirigami.FormData.isSection: true
+ }
+ Controls.CheckBox {
+ id: showSensorsLegendCheckbox
+ text: i18n("Show Sensors Legend")
+ }
+ Controls.CheckBox {
+ id: stackedCheckbox
+ text: i18n("Stacked Charts")
+ }
+ Controls.CheckBox {
+ id: smoothCheckbox
+ text: i18n("Smooth Lines")
+ }
+ Controls.SpinBox {
+ id: fillOpacitySpin
+ Kirigami.FormData.label: i18n("Fill Opacity:")
+ from: 0
+ to: 100
+ }
+ Item {
+ Kirigami.FormData.label: i18n("Data Ranges")
+ Kirigami.FormData.isSection: true
+ }
+ Controls.CheckBox {
+ id: rangeAutoYCheckbox
+ text: i18n("Automatic Y Data Range")
+ }
+ Controls.SpinBox {
+ id: rangeFromYSpin
+ Kirigami.FormData.label: i18n("From (Y):")
+ enabled: !rangeAutoYCheckbox.checked
+ }
+ Controls.SpinBox {
+ id: rangeToYSpin
+ to: 99999
+ Kirigami.FormData.label: i18n("To (Y):")
+ enabled: !rangeAutoYCheckbox.checked
+ }
+ Controls.CheckBox {
+ id: rangeAutoXCheckbox
+ text: i18n("Automatic X Data Range")
+ }
+ Controls.SpinBox {
+ id: rangeFromXSpin
+ Kirigami.FormData.label: i18n("From (X):")
+ enabled: !rangeAutoXCheckbox.checked
+ }
+ Controls.SpinBox {
+ id: rangeToXSpin
+ to: 99999
+ Kirigami.FormData.label: i18n("To (X):")
+ enabled: !rangeAutoXCheckbox.checked
+ }
+}
+
diff --git a/applets/systemmonitor/systemmonitor/faces/linechart/contents/ui/FullRepresentation.qml b/applets/systemmonitor/systemmonitor/faces/linechart/contents/ui/FullRepresentation.qml
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/faces/linechart/contents/ui/FullRepresentation.qml
@@ -0,0 +1,65 @@
+/*
+ * 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.quickcharts 1.0 as Charts
+
+ColumnLayout
+{
+ id: root
+
+ readonly property bool showLegend: plasmoid.nativeInterface.faceConfiguration.showLegend
+
+ // Arbitrary minimumWidth to make easier to align plasmoids in a predictable way
+ Layout.minimumWidth: Kirigami.Units.gridUnit * 8
+
+ Kirigami.Heading {
+ Layout.fillWidth: true
+ horizontalAlignment: Text.AlignHCenter
+ elide: Text.ElideRight
+ text: plasmoid.configuration.title
+ visible: text.length > 0
+ level: 2
+ }
+
+ LineChart {
+ id: compactRepresentation
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ Layout.minimumHeight: 3 * Kirigami.Units.gridUnit
+ Layout.preferredHeight: 5 * Kirigami.Units.gridUnit
+ }
+
+ Sensors.ExtendedLegend {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ visible: root.showLegend
+ chart: compactRepresentation
+ sourceModel: root.showLegend ? compactRepresentation.sensorsModel : null
+ colorSource: globalColorSource
+ textOnlySensorIds: root.showLegend ? plasmoid.configuration.textOnlySensorIds : []
+ }
+}
diff --git a/applets/systemmonitor/systemmonitor/faces/linechart/contents/ui/LineChart.qml b/applets/systemmonitor/systemmonitor/faces/linechart/contents/ui/LineChart.qml
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/faces/linechart/contents/ui/LineChart.qml
@@ -0,0 +1,88 @@
+/*
+ * 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.quickcharts 1.0 as Charts
+
+Charts.LineChart {
+ id: root
+
+ property var sensors: plasmoid.configuration.sensorIds
+
+ readonly property alias sensorsModel: sensorsModel
+
+ Layout.minimumWidth: Kirigami.Units.gridUnit * 8
+
+ direction: Charts.XYChart.ZeroAtEnd
+
+ fillOpacity: plasmoid.nativeInterface.faceConfiguration.lineChartFillOpacity / 100
+ stacked: plasmoid.nativeInterface.faceConfiguration.lineChartStacked
+ smooth: plasmoid.nativeInterface.faceConfiguration.lineChartSmooth
+
+ //TODO: Have a central heading here too?
+ //TODO: Have a plasmoid config value for line thickness?
+
+ xRange {
+ from: plasmoid.nativeInterface.faceConfiguration.rangeFromX
+ to: plasmoid.nativeInterface.faceConfiguration.rangeToX
+ automatic: plasmoid.nativeInterface.faceConfiguration.rangeAutoX
+ }
+ yRange {
+ from: plasmoid.nativeInterface.faceConfiguration.rangeFromY
+ to: plasmoid.nativeInterface.faceConfiguration.rangeToY
+ automatic: plasmoid.nativeInterface.faceConfiguration.rangeAutoY
+ }
+
+ Sensors.SensorDataModel {
+ id: sensorsModel
+ sensors: plasmoid.configuration.sensorIds
+ }
+
+ Instantiator {
+ model: sensorsModel.sensors
+ delegate: Charts.ModelHistorySource {
+ model: sensorsModel
+ column: index
+ row: 0
+ roleName: "Value"
+ maximumHistory: 50
+ }
+ onObjectAdded: {
+ root.insertValueSource(index, object)
+ }
+ onObjectRemoved: {
+ root.removeValueSource(object)
+ }
+ }
+
+ colorSource: globalColorSource
+ nameSource: Charts.ModelSource {
+ model: sensorsModel
+ roleName: "ShortName"
+ indexColumns: true
+ }
+}
+
diff --git a/applets/systemmonitor/systemmonitor/faces/linechart/metadata.desktop b/applets/systemmonitor/systemmonitor/faces/linechart/metadata.desktop
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/faces/linechart/metadata.desktop
@@ -0,0 +1,18 @@
+[Desktop Entry]
+Name=Line Chart
+Icon=office-chart-line
+
+Type=Service
+X-KDE-ServiceTypes=Plasma/SensorApplet
+X-KDE-ParentApp=org.kde.plasmashell
+X-KDE-PluginInfo-Author=Marco Martin
+X-KDE-PluginInfo-Email=mart@kde.org
+X-KDE-PluginInfo-License=LGPLv2+
+X-KDE-PluginInfo-Name=org.kde.ksysguard.linechart
+X-KDE-PluginInfo-Version=1.0
+X-KDE-PluginInfo-Website=https://kde.org
+
+[Config]
+SupportsSensorsColors=true
+SupportsTotalSensor=false
+SupportsTextOnlySensors=true
diff --git a/applets/systemmonitor/systemmonitor/faces/piechart/contents/config/main.xml b/applets/systemmonitor/systemmonitor/faces/piechart/contents/config/main.xml
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/faces/piechart/contents/config/main.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+ -180
+
+
+ 360
+
+
+ true
+
+
+ true
+
+
+ 0
+
+
+ 100
+
+
+ true
+
+
+
+
diff --git a/applets/systemmonitor/memory/contents/ui/memory.qml b/applets/systemmonitor/systemmonitor/faces/piechart/contents/ui/CompactRepresentation.qml
rename from applets/systemmonitor/memory/contents/ui/memory.qml
rename to applets/systemmonitor/systemmonitor/faces/piechart/contents/ui/CompactRepresentation.qml
--- a/applets/systemmonitor/memory/contents/ui/memory.qml
+++ b/applets/systemmonitor/systemmonitor/faces/piechart/contents/ui/CompactRepresentation.qml
@@ -1,10 +1,12 @@
/*
- * Copyright 2015 Marco Martin
- *
+ * Copyright 2019 Marco Martin
+ * Copyright 2019 David Edmundson
+ * Copyright 2019 Arjen Hiemstra
+ * Copyright 2019 Kai Uwe Broulik
*
* 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
+ * 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,
@@ -18,31 +20,29 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import QtQuick 2.0
+import QtQuick 2.9
+import QtQuick.Controls 2.2 as Controls
import QtQuick.Layouts 1.1
-import org.kde.plasma.plasmoid 2.0
-import org.kde.plasma.core 2.0 as PlasmaCore
-import org.kde.kquickcontrolsaddons 2.0 as KQuickAddons
-import org.kde.kcoreaddons 1.0 as KCoreAddons
-Applet {
- id: root
+import org.kde.kirigami 2.8 as Kirigami
- onSourceAdded: {
- if (source === "mem/physical/application") {
- root.addSource(source, i18n("Physical memory"));
- } else if (source === "mem/swap/used") {
- root.addSource(source, i18n("Swap"));
- }
- }
+import org.kde.ksysguard.sensors 1.0 as Sensors
+import org.kde.quickcharts 1.0 as Charts
+import org.kde.quickcharts.controls 1.0 as ChartControls
- delegate: SinglePlotter {
- autoRange: false
- rangeMin: 0
- rangeMax: 0
- function formatData(data) {
- rangeMax = data.max;
- return KCoreAddons.Format.formatByteSize(data.value * 1024)
- }
+import org.kde.plasma.core 2.0 as PlasmaCore
+
+ColumnLayout {
+ PieChart {
+ Layout.fillWidth: true
+ Layout.fillHeight: !label.visible
+ Layout.alignment: Qt.AlignCenter
+ }
+ Controls.Label {
+ id: label
+ visible: plasmoid.formFactor == PlasmaCore.Types.Planar
+ Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
+ text: plasmoid.configuration.title
}
}
+
diff --git a/applets/systemmonitor/systemmonitor/faces/piechart/contents/ui/Config.qml b/applets/systemmonitor/systemmonitor/faces/piechart/contents/ui/Config.qml
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/faces/piechart/contents/ui/Config.qml
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2019 Marco Martin
+ *
+ * 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 Controls
+
+import org.kde.kirigami 2.8 as Kirigami
+
+import org.kde.ksysguard.sensors 1.0 as Sensors
+
+Kirigami.FormLayout {
+ id: root
+
+ property alias cfg_showLegend: showSensorsLegendCheckbox.checked
+ property alias cfg_fromAngle: fromAngleSpin.value
+ property alias cfg_toAngle: toAngleSpin.value
+ property alias cfg_smoothEnds: smoothEndsCheckbox.checked
+ property alias cfg_rangeAuto: rangeAutoCheckbox.checked
+ property alias cfg_rangeFrom: rangeFromSpin.value
+ property alias cfg_rangeTo: rangeToSpin.value
+
+ Controls.CheckBox {
+ id: showSensorsLegendCheckbox
+ text: i18n("Show Sensors Legend")
+ }
+ Controls.SpinBox {
+ id: fromAngleSpin
+ Kirigami.FormData.label: i18n("Start from Angle")
+ from: -180
+ to: 180
+ editable: true
+ textFromValue: function(value, locale) {
+ return i18nc("angle degrees", "%1°", value + 180);
+ }
+ valueFromText: function(text, locale) {
+ return Number.fromLocaleString(locale, text.replace(i18nc("angle degrees", "°"), "")) - 180;
+ }
+ }
+ Controls.SpinBox {
+ id: toAngleSpin
+ Kirigami.FormData.label: i18n("Total Pie Angle")
+ from: 0
+ to: 360
+ editable: true
+ textFromValue: function(value, locale) {
+ return i18nc("angle", "%1°", value);
+ }
+ valueFromText: function(text, locale) {
+ return Number.fromLocaleString(locale, text.replace(i18nc("angle degrees", "°"), ""));
+ }
+ }
+ Controls.CheckBox {
+ id: smoothEndsCheckbox
+ text: i18n("Rounded Lines")
+ }
+
+ Controls.CheckBox {
+ id: rangeAutoCheckbox
+ text: i18n("Automatic Data Range")
+ }
+ Controls.SpinBox {
+ id: rangeFromSpin
+ editable: true
+ Kirigami.FormData.label: i18n("From:")
+ enabled: !rangeAutoCheckbox.checked
+ }
+ Controls.SpinBox {
+ id: rangeToSpin
+ to: 99999
+ editable: true
+ Kirigami.FormData.label: i18n("To:")
+ enabled: !rangeAutoCheckbox.checked
+ }
+}
+
diff --git a/applets/systemmonitor/systemmonitor/faces/piechart/contents/ui/FullRepresentation.qml b/applets/systemmonitor/systemmonitor/faces/piechart/contents/ui/FullRepresentation.qml
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/faces/piechart/contents/ui/FullRepresentation.qml
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2019 Marco Martin
+ * Copyright 2019 David Edmundson
+ * Copyright 2019 Arjen Hiemstra
+ * Copyright 2019 Kai Uwe Broulik
+ *
+ * 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.quickcharts 1.0 as Charts
+import org.kde.quickcharts.controls 1.0 as ChartsControls
+
+ColumnLayout
+{
+ id: root
+
+ readonly property bool showLegend: plasmoid.nativeInterface.faceConfiguration.showLegend
+
+ // Arbitrary minimumWidth to make easier to align plasmoids in a predictable way
+ Layout.minimumWidth: Kirigami.Units.gridUnit * 8
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 8
+
+ spacing: Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing
+ Kirigami.Heading {
+ Layout.fillWidth: true
+ horizontalAlignment: Text.AlignHCenter
+ elide: Text.ElideRight
+ text: plasmoid.configuration.title
+ visible: text.length > 0
+ level: 2
+ }
+
+ PieChart {
+ 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)
+ }
+
+ Sensors.ExtendedLegend {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ visible: root.showLegend
+ chart: compactRepresentation.chart
+ sourceModel: root.showLegend ? compactRepresentation.sensorsModel : null
+ colorSource: globalColorSource
+ textOnlySensorIds: root.showLegend ? plasmoid.configuration.textOnlySensorIds : []
+ }
+
+ Item {
+ Layout.fillHeight: true
+ }
+}
diff --git a/applets/systemmonitor/systemmonitor/faces/piechart/contents/ui/PieChart.qml b/applets/systemmonitor/systemmonitor/faces/piechart/contents/ui/PieChart.qml
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/faces/piechart/contents/ui/PieChart.qml
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2019 Marco Martin
+ * Copyright 2019 David Edmundson
+ * Copyright 2019 Arjen Hiemstra
+ * Copyright 2019 Kai Uwe Broulik
+ *
+ * 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.quickcharts 1.0 as Charts
+import org.kde.quickcharts.controls 1.0 as ChartControls
+
+import org.kde.plasma.core 2.0 as PlasmaCore
+
+ChartControls.PieChartControl {
+ id: chart
+
+ property alias headingSensor: sensor.sensorId
+ property alias sensors: sensorsModel.sensors
+ property alias sensorsModel: sensorsModel
+
+ Layout.minimumWidth: plasmoid.formFactor != PlasmaCore.Types.Vertical ? Kirigami.Units.gridUnit * 4 : Kirigami.Units.gridUnit
+ Layout.minimumHeight: plasmoid.formFactor == PlasmaCore.Types.Vertical ? width : Kirigami.Units.gridUnit
+
+ leftPadding: 0
+ rightPadding: 0
+ topPadding: 0
+ bottomPadding: 0
+
+ chart.smoothEnds: plasmoid.nativeInterface.faceConfiguration.smoothEnds
+ chart.fromAngle: plasmoid.nativeInterface.faceConfiguration.fromAngle
+ chart.toAngle: plasmoid.nativeInterface.faceConfiguration.toAngle
+
+ range {
+ from: plasmoid.nativeInterface.faceConfiguration.rangeFrom
+ to: plasmoid.nativeInterface.faceConfiguration.rangeTo
+ automatic: plasmoid.nativeInterface.faceConfiguration.rangeAuto
+ }
+
+ chart.backgroundColor: Qt.rgba(0.0, 0.0, 0.0, 0.2)
+
+ text: sensor.formattedValue
+ valueSources: Charts.ModelSource {
+ model: Sensors.SensorDataModel {
+ id: sensorsModel
+ sensors: plasmoid.configuration.sensorIds
+ }
+ roleName: "Value"
+ indexColumns: true
+ }
+ chart.nameSource: Charts.ModelSource {
+ roleName: "ShortName";
+ model: valueSources[0].model;
+ indexColumns: true
+ }
+ chart.colorSource: globalColorSource
+
+ Sensors.Sensor {
+ id: sensor
+ sensorId: plasmoid.configuration.totalSensor
+ }
+}
+
diff --git a/applets/systemmonitor/systemmonitor/faces/piechart/metadata.desktop b/applets/systemmonitor/systemmonitor/faces/piechart/metadata.desktop
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/faces/piechart/metadata.desktop
@@ -0,0 +1,18 @@
+[Desktop Entry]
+Name=Pie Chart
+Icon=office-chart-pie
+
+Type=Service
+X-KDE-ServiceTypes=Plasma/SensorApplet
+X-KDE-ParentApp=org.kde.plasmashell
+X-KDE-PluginInfo-Author=Marco Martin
+X-KDE-PluginInfo-Email=mart@kde.org
+X-KDE-PluginInfo-License=LGPLv2+
+X-KDE-PluginInfo-Name=org.kde.ksysguard.piechart
+X-KDE-PluginInfo-Version=1.0
+X-KDE-PluginInfo-Website=https://kde.org
+
+[Config]
+SupportsSensorsColors=true
+SupportsTotalSensor=true
+SupportsTextOnlySensors=true
diff --git a/applets/systemmonitor/systemmonitor/faces/table/contents/config/main.xml b/applets/systemmonitor/systemmonitor/faces/table/contents/config/main.xml
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/faces/table/contents/config/main.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+ false
+
+
+ 1
+
+
+ true
+
+
+
+
diff --git a/applets/systemmonitor/systemmonitor/faces/table/contents/ui/CompactRepresentation.qml b/applets/systemmonitor/systemmonitor/faces/table/contents/ui/CompactRepresentation.qml
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/faces/table/contents/ui/CompactRepresentation.qml
@@ -0,0 +1,54 @@
+/*
+ * 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 Sensors2
+import org.kde.quickcharts 1.0 as Charts
+import org.kde.plasma.core 2.0 as PlasmaCore
+
+Charts.LineChart {
+
+ Layout.minimumWidth: Kirigami.Units.gridUnit * 8
+ fillOpacity: 0
+
+ xRange { from: 0; to: 50; automatic: false }
+ yRange { from: 0; to: 100; automatic: false }
+
+ visible: plasmoid.configuration.totalSensor !== ""
+
+ colorSource: Charts.SingleValueSource { value: Kirigami.Theme.textColor}
+ lineWidth: 1
+ direction: Charts.XYChart.ZeroAtEnd
+
+ valueSources: [
+ Charts.ModelHistorySource {
+ model: Sensors2.SensorDataModel { sensors: [ plasmoid.configuration.totalSensor ] }
+ column: 0;
+ row: 0
+ roleName: "Value";
+ maximumHistory: 50
+ }
+ ]
+}
diff --git a/applets/systemmonitor/systemmonitor/faces/table/contents/ui/Config.qml b/applets/systemmonitor/systemmonitor/faces/table/contents/ui/Config.qml
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/faces/table/contents/ui/Config.qml
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2019 Marco Martin
+ *
+ * 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 Controls
+
+import org.kde.kirigami 2.8 as Kirigami
+
+import org.kde.ksysguard.sensors 1.0 as Sensors
+
+Kirigami.FormLayout {
+ id: root
+
+ property alias cfg_showTableHeaders: showTableHeadersCheckbox.checked
+ property alias cfg_sortColumn: sortColumnCombo.currentIndex
+ property alias cfg_sortDescending: sortDescendingCheckBox.checked
+
+ RowLayout {
+ Kirigami.FormData.label: i18n("Sort by:")
+
+ Controls.ComboBox {
+ id: sortColumnCombo
+ textRole: "display"
+ model: Sensors.HeadingHelperModel {
+ sourceModel: Sensors.SensorDataModel {
+ sensors: plasmoid.configuration.sensorIds
+ }
+ }
+ }
+
+ Controls.CheckBox {
+ id: sortDescendingCheckBox
+ // or do a ComboBox like in Dolphin with pretty names "highest first"<->"lowest first"?
+ text: i18nc("Sort descending", "Descending")
+ }
+ }
+
+ Controls.CheckBox {
+ id: showTableHeadersCheckbox
+ text: i18n("Show table headers")
+ }
+}
+
diff --git a/applets/systemmonitor/systemmonitor/faces/table/contents/ui/FullRepresentation.qml b/applets/systemmonitor/systemmonitor/faces/table/contents/ui/FullRepresentation.qml
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/faces/table/contents/ui/FullRepresentation.qml
@@ -0,0 +1,166 @@
+ /*
+ * 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 General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License or (at your option) version 3 or any later version
+ * accepted by the membership of KDE e.V. (or its successor approved
+ * by the membership of KDE e.V.), which shall act as a proxy
+ * defined in Section 14 of version 3 of the license.
+ *
+ * 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 General Public License
+ * along with this program. If not, see .
+ */
+
+import QtQuick 2.12
+import QtQuick.Controls 2.2
+import QtQuick.Layouts 1.2
+
+import QtQml.Models 2.12
+
+import org.kde.kirigami 2.2 as Kirigami
+
+import org.kde.ksysguard.sensors 1.0 as Sensors2
+
+import org.kde.plasma.core 2.0 as PlasmaCore
+import org.kde.quickcharts 1.0 as Charts
+
+ColumnLayout {
+ id: root
+
+ Layout.minimumWidth: Kirigami.Units.gridUnit * 8
+ Layout.minimumHeight: Kirigami.Units.gridUnit * 4
+
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 16
+ Layout.preferredHeight: Kirigami.Units.gridUnit * 18
+
+ opacity: y + height <= parent.height
+
+ RowLayout {
+ Layout.fillHeight: false
+ Kirigami.Heading {
+ id: heading
+ text: plasmoid.configuration.title
+ level: 2
+ elide: Text.ElideRight
+ Layout.fillHeight: true
+ }
+
+ Charts.LineChart {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ fillOpacity: 0
+
+ xRange { from: 0; to: 50; automatic: false }
+ yRange { from: 0; to: 100; automatic: false }
+
+ visible: plasmoid.configuration.totalSensor !== ""
+
+ smooth: true
+ colorSource: Charts.SingleValueSource { value: root.Kirigami.Theme.textColor}
+ lineWidth: 1
+ direction: Charts.XYChart.ZeroAtEnd
+
+ valueSources: [
+ Charts.ModelHistorySource {
+ model: Sensors2.SensorDataModel { sensors: [ plasmoid.configuration.totalSensor ] }
+ column: 0;
+ row: 0
+ roleName: "Value";
+ maximumHistory: 50
+ }
+ ]
+ }
+ }
+
+ RowLayout {
+ id: header
+ y: -height
+ Layout.fillWidth: true
+ visible: plasmoid.nativeInterface.faceConfiguration.showTableHeaders
+ Repeater {
+ model: Sensors2.HeadingHelperModel {
+ id: headingHelperModel
+
+ sourceModel: tableView.model
+ }
+ Kirigami.Heading {
+ id: heading
+ level: 4
+ Layout.fillWidth: true
+ //FIXME: why +2 is necessary?
+ Layout.preferredWidth: metrics.width+2
+ Layout.maximumWidth: x > 0 ? metrics.width+2 : -1
+ TextMetrics{
+ id: metrics
+ font: heading.font
+ text: heading.text
+ }
+ text: model.display
+ elide: Text.ElideRight
+ horizontalAlignment: index > 0 ? Text.AlignRight : Text.AlignLeft
+ }
+ }
+ }
+ TableView {
+ id: tableView
+
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+
+ model: topModel
+ interactive: false
+ columnSpacing: Kirigami.Units.smallSpacing
+ clip: true
+
+ property int dataColumnWidth: Kirigami.Units.gridUnit * 5
+
+ columnWidthProvider: function (column) {
+ return header.children[column].width;
+ }
+
+ delegate: Label {
+ // Not visible to not change contentHeight
+ opacity: y + height <= tableView.height
+ text: model.display != undefined ? model.display : ""
+ horizontalAlignment: model.alignment == (Text.AlignRight + Text.AlignVCenter) ? Text.AlignRight : Text.AlignLeft
+ elide: Text.ElideRight
+ verticalAlignment: Text.AlignVCenter
+ }
+
+ //See https://codereview.qt-project.org/c/qt/qtdeclarative/+/262876
+ onWidthChanged: Qt.callLater(function() {if (tableView.columns > 0) {
+ tableView.forceLayout()
+ }});
+
+ PlasmaCore.SortFilterModel {
+ id: topModel
+ filterKeyColumn: 0 // name
+ filterRegExp: ".+"
+
+ sortColumn: plasmoid.nativeInterface.faceConfiguration.sortColumn
+ sortRole: "Value"
+ sortOrder: plasmoid.nativeInterface.faceConfiguration.sortDescending ? Qt.DescendingOrder : Qt.AscendingOrder
+
+ sourceModel: Sensors2.SensorDataModel {
+ id: dataModel
+ sensors: plasmoid.configuration.sensorIds
+ onSensorsChanged: {
+ //note: this re sets the models in order to make the table work with any new role
+ tableView.model = null;
+ topModel.sourceModel = null;
+ topModel.sourceModel = dataModel;
+ tableView.model = topModel;
+ }
+ }
+ }
+ }
+}
diff --git a/applets/systemmonitor/systemmonitor/faces/table/metadata.desktop b/applets/systemmonitor/systemmonitor/faces/table/metadata.desktop
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/faces/table/metadata.desktop
@@ -0,0 +1,18 @@
+[Desktop Entry]
+Name=Table
+Icon=table
+
+Type=Service
+X-KDE-ServiceTypes=Plasma/SensorApplet
+X-KDE-ParentApp=org.kde.plasmashell
+X-KDE-PluginInfo-Author=Marco Martin
+X-KDE-PluginInfo-Email=mart@kde.org
+X-KDE-PluginInfo-License=LGPLv2+
+X-KDE-PluginInfo-Name=org.kde.ksysguard.table
+X-KDE-PluginInfo-Version=1.0
+X-KDE-PluginInfo-Website=https://kde.org
+
+[Config]
+SupportsSensorsColors=false
+SupportsTotalSensor=true
+SupportsTextOnlySensors=false
diff --git a/applets/systemmonitor/systemmonitor/faces/textonly/contents/ui/CompactRepresentation.qml b/applets/systemmonitor/systemmonitor/faces/textonly/contents/ui/CompactRepresentation.qml
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/faces/textonly/contents/ui/CompactRepresentation.qml
@@ -0,0 +1,60 @@
+/*
+ * 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.quickcharts 1.0 as Charts
+import org.kde.quickcharts.controls 1.0 as ChartsControls
+import org.kde.plasma.core 2.0 as PlasmaCore
+
+ColumnLayout
+{
+ id: root
+
+ Layout.minimumWidth: plasmoid.formFactor == PlasmaCore.Types.Vertical ? Kirigami.Units.gridUnit : Kirigami.Units.gridUnit * 2
+
+ Repeater {
+ model: plasmoid.configuration.sensorIds
+
+ ChartsControls.LegendDelegate {
+ Layout.fillWidth: true
+
+ name: sensor.shortName
+ value: sensor.formattedValue
+ colorVisible: false
+ colorWidth: 0
+
+ layoutWidth: root.width
+ valueWidth: Kirigami.Units.gridUnit * 2
+
+ Sensors.Sensor {
+ id: sensor
+ sensorId: modelData
+ }
+ }
+ }
+
+ Item { Layout.fillWidth: true; Layout.fillHeight: true }
+}
diff --git a/applets/systemmonitor/systemmonitor/faces/textonly/contents/ui/FullRepresentation.qml b/applets/systemmonitor/systemmonitor/faces/textonly/contents/ui/FullRepresentation.qml
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/faces/textonly/contents/ui/FullRepresentation.qml
@@ -0,0 +1,74 @@
+/*
+ * 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.quickcharts 1.0 as Charts
+import org.kde.quickcharts.controls 1.0 as ChartsControls
+
+ColumnLayout
+{
+ id: root
+
+ // Arbitrary minimumWidth to make easier to align plasmoids in a predictable way
+ Layout.minimumWidth: Kirigami.Units.gridUnit * 8
+
+ Kirigami.Heading {
+ Layout.fillWidth: true
+ horizontalAlignment: Text.AlignHCenter
+ elide: Text.ElideRight
+ text: plasmoid.configuration.title
+ visible: text.length > 0
+ level: 2
+ }
+
+ Item { Layout.fillWidth: true; Layout.fillHeight: true }
+
+ Repeater {
+ model: plasmoid.configuration.sensorIds.concat(plasmoid.configuration.textOnlySensorIds)
+
+ ChartsControls.LegendDelegate {
+ readonly property bool isTextOnly: index >= plasmoid.configuration.sensorIds.length
+
+ Layout.fillWidth: true
+ Layout.minimumHeight: isTextOnly ? 0 : implicitHeight
+
+ name: sensor.shortName
+ value: sensor.formattedValue
+ colorVisible: !isTextOnly
+ color: !isTextOnly ? globalColorSource.array[index] : "transparent"
+
+ layoutWidth: root.width
+ valueWidth: Kirigami.Units.gridUnit * 2
+
+ Sensors.Sensor {
+ id: sensor
+ sensorId: modelData
+ }
+ }
+ }
+
+ Item { Layout.fillWidth: true; Layout.fillHeight: true }
+}
diff --git a/applets/systemmonitor/systemmonitor/faces/textonly/metadata.desktop b/applets/systemmonitor/systemmonitor/faces/textonly/metadata.desktop
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/faces/textonly/metadata.desktop
@@ -0,0 +1,18 @@
+[Desktop Entry]
+Name=Text Only
+Icon=view-list-text
+
+Type=Service
+X-KDE-ServiceTypes=Plasma/SensorApplet
+X-KDE-ParentApp=org.kde.plasmashell
+X-KDE-PluginInfo-Author=Marco Martin
+X-KDE-PluginInfo-Email=mart@kde.org
+X-KDE-PluginInfo-License=LGPLv2+
+X-KDE-PluginInfo-Name=org.kde.ksysguard.textonly
+X-KDE-PluginInfo-Version=1.0
+X-KDE-PluginInfo-Website=https://kde.org
+
+[Config]
+SupportsSensorsColors=true
+SupportsTotalSensor=false
+SupportsTextOnlySensors=true
diff --git a/applets/systemmonitor/systemmonitor/package/contents/config/config.qml b/applets/systemmonitor/systemmonitor/package/contents/config/config.qml
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/package/contents/config/config.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+import org.kde.plasma.configuration 2.0
+
+ConfigModel {
+ ConfigCategory {
+ name: i18n("Appearance")
+ icon: "preferences-desktop-color"
+ source: "config/ConfigAppearance.qml"
+ }
+ ConfigCategory {
+ name: i18n("%1 Details", plasmoid.nativeInterface.faceName)
+ icon: plasmoid.nativeInterface.faceIcon
+ visible: plasmoid.nativeInterface.configPath.length > 0
+ source: "config/FaceDetails.qml"
+ }
+ ConfigCategory {
+ name: i18n("Sensors Details")
+ icon: "ksysguardd"
+ source: "config/ConfigSensors.qml"
+ }
+}
+
diff --git a/applets/systemmonitor/systemmonitor/package/contents/config/main.xml b/applets/systemmonitor/systemmonitor/package/contents/config/main.xml
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/package/contents/config/main.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+ org.kde.ksysguard.piechart
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/applets/systemmonitor/systemmonitor/package/contents/ui/CompactRepresentation.qml b/applets/systemmonitor/systemmonitor/package/contents/ui/CompactRepresentation.qml
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/package/contents/ui/CompactRepresentation.qml
@@ -0,0 +1,56 @@
+/*
+ * 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.plasma.core 2.0 as PlasmaCore
+import org.kde.quickcharts 1.0 as Charts
+import org.kde.kirigami 2.8 as Kirigami
+
+Item {
+ Layout.fillWidth: chartFace.item ? chartFace.item.Layout.fillWidth : false
+ Layout.fillHeight: chartFace.item ? chartFace.item.Layout.fillHeight : false
+
+ Layout.minimumWidth: chartFace.item ? chartFace.item.Layout.minimumWidth : 0
+ Layout.minimumHeight: chartFace.item ? chartFace.item.Layout.minimumHeight : 0
+
+ Layout.preferredWidth: chartFace.item ? chartFace.item.Layout.preferredWidth : 0
+ Layout.preferredHeight: chartFace.item ? chartFace.item.Layout.preferredHeight : 0
+
+ Layout.maximumWidth: chartFace.item ? chartFace.item.Layout.maximumWidth : 0
+ Layout.maximumHeight: chartFace.item ? chartFace.item.Layout.maximumHeight : 0
+
+ Kirigami.Theme.textColor: PlasmaCore.ColorScope.textColor
+
+ Charts.ArraySource {
+ id: globalColorSource
+ array: plasmoid.configuration.sensorColors
+ }
+ Loader {
+ id: chartFace
+ anchors.fill: parent
+ source: plasmoid.nativeInterface.compactRepresentationPath
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: plasmoid.expanded = !plasmoid.expanded
+ }
+}
diff --git a/applets/systemmonitor/systemmonitor/package/contents/ui/FullRepresentation.qml b/applets/systemmonitor/systemmonitor/package/contents/ui/FullRepresentation.qml
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/package/contents/ui/FullRepresentation.qml
@@ -0,0 +1,69 @@
+/*
+ * 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 QtQuick.Controls 2.2
+import QtQuick.Window 2.12
+import QtGraphicalEffects 1.0
+
+import org.kde.kirigami 2.8 as Kirigami
+
+import org.kde.plasma.core 2.0 as PlasmaCore
+import org.kde.plasma.plasmoid 2.0
+
+import org.kde.ksysguard.sensors 1.0 as Sensors
+import org.kde.quickcharts 1.0 as Charts
+
+Item {
+ id: root
+
+ Layout.minimumWidth: chartFace.item ? chartFace.item.Layout.minimumWidth : 0
+ Layout.minimumHeight: chartFace.item ? chartFace.item.Layout.minimumHeight : 0
+ Layout.preferredWidth: chartFace.item
+ ? (chartFace.item.Layout.preferredWidth > 0 ? chartFace.item.Layout.preferredWidth : chartFace.item.implicitWidth)
+ : 0
+ Layout.preferredHeight: chartFace.item
+ ? (chartFace.item.Layout.preferredHeight > 0 ? chartFace.item.Layout.preferredHeight: chartFace.item.implicitHeight)
+ : 0
+ Layout.maximumWidth: chartFace.item ? chartFace.item.Layout.maximumWidth : 0
+ Layout.maximumHeight: chartFace.item ? chartFace.item.Layout.maximumHeight : 0
+
+ Kirigami.Theme.textColor: PlasmaCore.ColorScope.textColor
+
+ //FIXME: things in faces refer to this id in the global context, should probably be fixed or just moved in each face
+ Charts.ArraySource {
+ id: globalColorSource
+ array: plasmoid.configuration.sensorColors
+ }
+
+ // NOTE: having the loader as root item seems to crash
+ Loader {
+ id: chartFace
+ anchors {
+ fill: parent
+ margins: Kirigami.Units.smallSpacing * (plasmoid.configuration.backgroundEnabled ? 1 : 2)
+ }
+
+ visible: status == Loader.Ready
+ source: plasmoid.nativeInterface.fullRepresentationPath
+ }
+}
diff --git a/applets/systemmonitor/systemmonitor/package/contents/ui/config/ConfigAppearance.qml b/applets/systemmonitor/systemmonitor/package/contents/ui/config/ConfigAppearance.qml
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/package/contents/ui/config/ConfigAppearance.qml
@@ -0,0 +1,157 @@
+/*
+ * 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.2
+import QtQuick.Controls 2.2 as Controls
+
+import org.kde.kirigami 2.5 as Kirigami
+import org.kde.kquickcontrols 2.0
+import org.kde.kconfig 1.0 // for KAuthorized
+import org.kde.plasma.core 2.0 as PlasmaCore
+
+import org.kde.ksysguard.sensors 1.0 as Sensors
+
+Kirigami.FormLayout {
+ id: root
+
+ signal configurationChanged
+
+ property alias cfg_title: titleField.text
+ property string cfg_chartFace
+
+ // config keys of the selected preset to be applied on save
+ property string pendingPreset
+
+ function saveConfig() {
+ var preset = pendingPreset;
+ pendingPreset = "";
+ if (preset != "") {
+ plasmoid.nativeInterface.currentPreset = preset;
+ }
+ }
+
+ RowLayout {
+ Kirigami.FormData.label: i18n("Preset:")
+ Controls.ComboBox {
+ id: presetCombo
+ model: plasmoid.nativeInterface.availablePresetsModel
+
+ Connections {
+ target: plasmoid.nativeInterface
+ onCurrentPresetChanged: {
+ for (var i = 0; i < presetCombo.count; ++i) {
+ if (presetCombo.model.pluginId(i) === plasmoid.nativeInterface.currentPreset) {
+ presetCombo.currentIndex = i;
+ return;
+ }
+ }
+ }
+ }
+ currentIndex: {
+ for (var i = 0; i < count; ++i) {
+ if (model.pluginId(i) === plasmoid.nativeInterface.currentPreset) {
+ return i;
+ }
+ }
+ return -1;
+ }
+ onActivated: {
+ var presetsModel = plasmoid.nativeInterface.availablePresetsModel;
+ var idx = presetsModel.index(index, 0);
+
+ cfg_title = presetsModel.data(idx, /* DisplayRole */) || "";
+
+ var pendingPresetConfig = presetsModel.data(idx, Qt.UserRole + 3); // FIXME proper enum
+ pendingPreset = presetsModel.pluginId(index);
+ if (pendingPresetConfig.chartFace) {
+ cfg_chartFace = pendingPresetConfig.chartFace;
+ }
+
+ root.configurationChanged();
+ }
+ }
+
+ Controls.Button {
+ icon.name: "get-hot-new-stuff"
+ onClicked: plasmoid.nativeInterface.getNewPresets(this)
+ visible: KAuthorized.authorize("ghns")
+ Accessible.name: i18n("Get new presets")
+
+ Controls.ToolTip {
+ text: parent.Accessible.name
+ }
+ }
+
+ Controls.Button {
+ id: saveButton
+ icon.name: "document-save"
+ text: i18n("Save")
+ enabled: plasmoid.nativeInterface.currentPreset.length == 0
+ onClicked: plasmoid.nativeInterface.savePreset();
+ }
+ Controls.Button {
+ icon.name: "delete"
+ enabled: {
+ var presetsModel = plasmoid.nativeInterface.availablePresetsModel;
+ var idx = presetsModel.index(presetCombo.currentIndex, 0);
+ presetCombo.currentIndex >= 0 && presetsModel.data(idx, Qt.UserRole + 4); // FIXME: proper role
+ }
+ onClicked: plasmoid.nativeInterface.uninstallPreset(presetCombo.model.pluginId(presetCombo.currentIndex));
+ }
+ }
+
+ Kirigami.Separator {
+ Kirigami.FormData.isSection: true
+ }
+
+ Controls.TextField {
+ id: titleField
+ Kirigami.FormData.label: i18n("Title:")
+ }
+
+ RowLayout {
+ Kirigami.FormData.label: i18n("Display Style:")
+ Controls.ComboBox {
+ id: faceCombo
+ model: plasmoid.nativeInterface.availableFacesModel
+ currentIndex: {
+ // TODO just make an indexOf invokable on the model?
+ for (var i = 0; i < count; ++i) {
+ if (model.pluginId(i) === cfg_chartFace) {
+ return i;
+ }
+ }
+ return -1;
+ }
+ onActivated: {
+ cfg_chartFace = model.pluginId(index);
+ }
+ }
+
+ Controls.Button {
+ icon.name: "get-hot-new-stuff"
+ text: i18n("Get New Display Styles")
+ visible: KAuthorized.authorize("ghns")
+ onClicked: plasmoid.nativeInterface.getNewFaces(this)
+ }
+ }
+}
diff --git a/applets/systemmonitor/systemmonitor/package/contents/ui/config/ConfigSensors.qml b/applets/systemmonitor/systemmonitor/package/contents/ui/config/ConfigSensors.qml
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/package/contents/ui/config/ConfigSensors.qml
@@ -0,0 +1,256 @@
+/*
+ * 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.2
+import QtQuick.Controls 2.2 as Controls
+import QtQml.Models 2.12
+
+import org.kde.kirigami 2.8 as Kirigami
+import org.kde.kquickcontrols 2.0
+
+import org.kde.kitemmodels 1.0 as KItemModels
+
+import org.kde.ksysguard.sensors 1.0 as Sensors
+
+import org.kde.plasma.core 2.1 as PlasmaCore
+
+ColumnLayout {
+ id: root
+
+ readonly property int implicitHeight: 1 //HACK FIXME to disable external scrollbar
+
+ property string cfg_totalSensor
+ property alias cfg_sensorIds: usedSensorsView.sensorIds
+ property alias cfg_sensorColors: usedSensorsView.sensorColors
+
+ property alias cfg_textOnlySensorIds: textOnlySensorsView.sensorIds
+
+ Sensors.Sensor {
+ id: totalSensor
+ sensorId: cfg_totalSensor
+ }
+
+ Component.onCompleted: {
+ cfg_sensorIds = plasmoid.configuration.sensorIds
+ cfg_sensorColors = plasmoid.configuration.sensorColors
+ usedSensorsView.load();
+
+ cfg_textOnlySensorIds = plasmoid.configuration.textOnlySensorIds
+ textOnlySensorsView.load();
+ }
+
+ Component {
+ id: delegateComponent
+ Kirigami.SwipeListItem {
+ id: listItem
+ width: usedSensorsView.width
+ actions: Kirigami.Action {
+ icon.name: "list-remove"
+ text: i18n("Remove")
+ onTriggered: {
+ usedSensorsModel.remove(index, 1);
+ usedSensorsModel.save();
+ }
+ }
+ contentItem: RowLayout {
+ Kirigami.ListItemDragHandle {
+ listItem: listItem
+ listView: usedSensorsView
+ onMoveRequested: {
+ usedSensorsModel.move(oldIndex, newIndex, 1)
+ usedSensorsModel.save();
+ }
+ }
+ ColorButton {
+ id: textColorButton
+ color: model.color
+ onColorChanged: {
+ usedSensorsModel.setProperty(index, "color", color.toString());
+ usedSensorsModel.save();
+ }
+ }
+ Controls.Label {
+ Layout.fillWidth: true
+ text: sensor.name
+ Sensors.Sensor {
+ id: sensor
+ sensorId: model.sensorId
+ }
+ }
+ }
+ }
+ }
+
+ RowLayout {
+ Layout.preferredHeight: sensorListHeader.implicitHeight
+ visible: plasmoid.nativeInterface.supportsTotalSensor
+ Controls.Label {
+ text: i18n("Total Sensor:")
+ }
+ Controls.Label {
+ Layout.fillWidth: true
+ text: cfg_totalSensor.length > 0 ? totalSensor.name : i18n("Drop Sensor Here")
+ elide: Text.ElideRight
+ DropArea {
+ anchors.fill: parent
+ onEntered: {
+ if (drag.formats.indexOf("application/x-ksysguard") == -1) {
+ drag.accepted = false;
+ return;
+ }
+ }
+ onDropped: {
+ cfg_totalSensor = drop.getDataAsString("application/x-ksysguard")
+ }
+ }
+ }
+ Controls.ToolButton {
+ icon.name: "list-remove"
+ opacity: cfg_totalSensor.length > 0
+ onClicked: cfg_totalSensor = "";
+ }
+ }
+
+ RowLayout {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ Layout.minimumHeight: 0
+ Layout.preferredHeight: 0
+
+ ColumnLayout {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ Layout.preferredHeight: 0
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 14
+
+ Kirigami.Heading {
+ Layout.preferredHeight: sensorListHeader.implicitHeight
+ level: 3
+ text: i18n("Chart Sensors")
+ }
+ UsedSensorsView {
+ id: usedSensorsView
+ showColor: plasmoid.nativeInterface.supportsSensorsColors
+ }
+ Kirigami.Heading {
+ Layout.preferredHeight: sensorListHeader.implicitHeight
+ text: i18n("Text Only Sensors")
+ level: 3
+ visible: textOnlySensorsView.visible
+ }
+ UsedSensorsView {
+ id: textOnlySensorsView
+ visible: plasmoid.nativeInterface.supportsTextOnlySensors
+ showColor: false
+ }
+ }
+
+ ColumnLayout {
+ RowLayout {
+ id: sensorListHeader
+ Layout.fillWidth: true
+ Controls.ToolButton {
+ icon.name: "go-previous"
+ enabled: sensorsDelegateModel.rootIndex.valid
+ onClicked: sensorsDelegateModel.rootIndex = sensorsDelegateModel.parentModelIndex()
+ }
+ Kirigami.Heading {
+ Layout.fillWidth: true
+ Layout.alignment: Qt.AlignVCenter
+ level: 3
+ text: i18n("All Sensors")
+ }
+ }
+ Kirigami.SearchField {
+ id: searchQuery
+ Layout.fillWidth: true
+ }
+ Controls.ScrollView {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 14
+
+ ListView {
+
+ PlasmaCore.SortFilterModel {
+ id: sensorsSearchableModel
+ filterCaseSensitivity: Qt.CaseInsensitive
+ filterString: searchQuery.text
+ sourceModel: PlasmaCore.SortFilterModel {
+ filterRole: "SensorId"
+ filterCallback: function(row, value) {
+ return (value && value.length)
+ }
+ sourceModel: KItemModels.KDescendantsProxyModel {
+ model: allSensorsTreeModel
+ }
+ }
+ }
+
+ Sensors.SensorTreeModel {
+ id: allSensorsTreeModel
+ }
+
+ model: DelegateModel {
+ id: sensorsDelegateModel
+
+ model: searchQuery.text.length == 0 ? allSensorsTreeModel : sensorsSearchableModel
+
+ delegate: Kirigami.BasicListItem {
+ id: sensorTreeDelegate
+ text: model.display
+ icon: (model.SensorId.length == 0) ? "folder" : ""
+
+ Drag.active: model.SensorId.length > 0 && sensorTreeDelegate.pressed
+ Drag.dragType: Drag.Automatic
+ Drag.supportedActions: Qt.CopyAction
+ Drag.hotSpot.x: sensorTreeDelegate.pressX
+ Drag.hotSpot.y: sensorTreeDelegate.pressY
+ Drag.mimeData: {
+ "application/x-ksysguard": model.SensorId
+ }
+ //FIXME: better handling of Drag
+ onPressed: {
+ onPressed: grabToImage(function(result) {
+ Drag.imageSource = result.url
+ })
+ }
+ onClicked: {
+ if (model.SensorId.length == 0) {
+ sensorsDelegateModel.rootIndex = sensorsDelegateModel.modelIndex(index);
+ }
+ }
+ onDoubleClicked: {
+ if (model.SensorId) {
+ usedSensorsView.appendSensor(model.SensorId);
+ usedSensorsView.positionViewAtIndex(usedSensorsView.count - 1, ListView.Contain);
+ }
+ }
+ }
+ }
+ }
+ Component.onCompleted: background.visible = true;
+ Controls.ScrollBar.horizontal.visible: false
+ }
+ }
+ }
+}
diff --git a/applets/systemmonitor/systemmonitor/package/contents/ui/config/FaceDetails.qml b/applets/systemmonitor/systemmonitor/package/contents/ui/config/FaceDetails.qml
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/package/contents/ui/config/FaceDetails.qml
@@ -0,0 +1,65 @@
+/*
+ * 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.2
+import QtQuick.Controls 2.2 as Controls
+
+import org.kde.kirigami 2.5 as Kirigami
+import org.kde.kquickcontrols 2.0
+
+
+Loader {
+ id: root
+
+ signal configurationChanged
+
+ function saveConfig() {
+ if (item.saveConfig) {
+ item.saveConfig()
+ }
+ for (var key in plasmoid.nativeInterface.faceConfiguration) {
+ if (item.hasOwnProperty("cfg_" + key)) {
+ plasmoid.nativeInterface.faceConfiguration[key] = item["cfg_"+key]
+ }
+ }
+ }
+
+ source: plasmoid.nativeInterface.configPath
+
+ onItemChanged: {
+ if (!item || !plasmoid.nativeInterface.faceConfiguration) {
+ return;
+ }
+
+ for (var key in plasmoid.nativeInterface.faceConfiguration) {
+ if (!item.hasOwnProperty("cfg_" + key)) {
+ continue;
+ }
+
+ item["cfg_" + key] = plasmoid.nativeInterface.faceConfiguration[key];
+ var changedSignal = item["cfg_" + key + "Changed"];
+ if (changedSignal) {
+ changedSignal.connect(root.configurationChanged);
+ }
+ }
+ }
+}
diff --git a/applets/systemmonitor/systemmonitor/package/contents/ui/config/SaveDialog.qml b/applets/systemmonitor/systemmonitor/package/contents/ui/config/SaveDialog.qml
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/package/contents/ui/config/SaveDialog.qml
@@ -0,0 +1,143 @@
+/*
+ * Copyright 2019 Marco Martin
+ *
+ * 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.3
+import QtQuick.Layouts 1.1
+import QtQuick.Controls 2.2
+import QtQuick.Dialogs 1.2
+import org.kde.kirigami 2.8 as Kirigami
+import org.kde.plasma.plasmoid 2.0
+
+Dialog {
+ id: dialog
+ property alias pluginName: pluginNameField.text
+ property alias comment: commentField.text
+ property alias author: authorField.text
+ property alias email: emailField.text
+ property alias license: licenseField.editText
+ property alias website: websiteField.text
+
+ property bool canEdit: false
+
+ width: 500
+ title: i18n("Save Preset %1", plasmoid.configuration.title)
+
+ onVisibleChanged: {
+ pluginNameField.focus = true
+ }
+
+ contentItem: Rectangle {
+ implicitWidth: layout.Layout.minimumWidth + units.smallSpacing*2
+ implicitHeight: layout.Layout.minimumHeight + units.smallSpacing*2
+
+ Keys.onPressed: {
+ if (event.key == Qt.Key_Enter || event.key == Qt.Key_Return) {
+ dialog.accept();
+ } else if (event.key == Qt.Key_Escape) {
+ dialog.reject();
+ }
+ }
+
+ color: Kirigami.Theme.backgroundColor
+
+ ColumnLayout {
+ id: layout
+ anchors {
+ fill: parent
+ margins: units.smallSpacing
+ }
+ Kirigami.InlineMessage { //standard comp
+ id: errorMessage
+ type: Kirigami.MessageType.Error
+ text: ""
+ Layout.fillWidth: true
+ visible: text.length > 0
+ }
+ Kirigami.FormLayout {
+ Layout.fillWidth: true
+
+ TextField {
+ id: pluginNameField
+ Layout.fillWidth: true
+ Kirigami.FormData.label: i18n("Theme Plugin Name:")
+ onTextChanged: {
+ var presetsModel = plasmoid.nativeInterface.availablePresetsModel;
+ for (var i = 0; i < plasmoid.nativeInterface.availablePresetsModel.rowCount(); ++i) {
+ var idx = presetsModel.index(i, 0);
+ if (pluginNameField.text == presetsModel.data(idx, Qt.UserRole + 1)) { // FIXME proper enum
+ dialog.canEdit = false;
+ errorMessage.text = i18n("This theme plugin name already exists");
+ return;
+ }
+ }
+ errorMessage.text = "";
+ dialog.canEdit = true;
+ }
+ }
+ TextField {
+ id: commentField
+ Kirigami.FormData.label: i18n("Comment:")
+ Layout.fillWidth: true
+ }
+ TextField {
+ id: authorField
+ Kirigami.FormData.label: i18n("Author:")
+ Layout.fillWidth: true
+ }
+ TextField {
+ id: emailField
+ Kirigami.FormData.label: i18n("Email:")
+ Layout.fillWidth: true
+ }
+ ComboBox {
+ id: licenseField
+ Kirigami.FormData.label: i18n("License:")
+ Layout.fillWidth: true
+ editable: true
+ editText: "LGPL 2.1+"
+ model: ["LGPL 2.1+", "GPL 2+", "GPL 3+", "LGPL 3+", "BSD"]
+ }
+ TextField {
+ id: websiteField
+ Kirigami.FormData.label: i18n("Website:")
+ Layout.fillWidth: true
+ }
+ }
+ Item {
+ Layout.fillHeight: true
+ }
+ RowLayout {
+ Layout.alignment: Qt.AlignRight
+ Button {
+ text: i18n("OK")
+ onClicked: dialog.accept()
+ enabled: canEdit && authorField.text && emailField.text && websiteField.text
+ }
+ Button {
+ text: i18n("Cancel")
+ onClicked: dialog.reject()
+ }
+ }
+ }
+ }
+
+ onAccepted: {
+ plasmoid.nativeInterface.createNewPreset(pluginNameField.text, commentField.text, authorField.text, emailField.text, licenseField.editText, websiteField.text);
+ }
+}
diff --git a/applets/systemmonitor/systemmonitor/package/contents/ui/config/UsedSensorsView.qml b/applets/systemmonitor/systemmonitor/package/contents/ui/config/UsedSensorsView.qml
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/package/contents/ui/config/UsedSensorsView.qml
@@ -0,0 +1,182 @@
+/*
+ * 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.2
+import QtQuick.Controls 2.2 as Controls
+import QtQml.Models 2.12
+
+import org.kde.kirigami 2.5 as Kirigami
+import org.kde.kquickcontrols 2.0
+
+import org.kde.ksysguard.sensors 1.0 as Sensors
+
+DropArea {
+ id: root
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ Layout.preferredWidth: usedSensorsScroll.implicitWidth
+
+ property alias count: usedSensorsView.count
+ property alias delegateComponent: delegateComponent
+ property var sensorIds: []
+ property var sensorColors: []
+ property bool showColor: true
+
+ function appendSensor(sensorId) {
+ insertSensor(usedSensorsModel.count, sensorId);
+ }
+
+ function insertSensor(index, sensorId) {
+ var color = Kirigami.Theme.highlightColor;
+ color.hsvHue = Math.random();
+ usedSensorsModel.insert(index, {"sensorId": sensorId, "color": color.toString()})
+ usedSensorsModel.save()
+ }
+
+ function positionViewAtIndex(index, mode) {
+ usedSensorsView.positionViewAtIndex(index, mode);
+ }
+
+ function load() {
+ for (var i in sensorIds) {
+ usedSensorsModel.append({"sensorId": sensorIds[i], "color": (sensorColors[i] || "").toString()})
+ }
+ }
+ Component {
+ id: delegateComponent
+ Kirigami.SwipeListItem {
+ id: listItem
+ actions: Kirigami.Action {
+ icon.name: "list-remove"
+ text: i18n("Remove")
+ onTriggered: {
+ usedSensorsModel.remove(index, 1);
+ usedSensorsModel.save();
+ }
+ }
+ contentItem: RowLayout {
+ Kirigami.ListItemDragHandle {
+ listItem: listItem
+ listView: usedSensorsView
+ onMoveRequested: {
+ usedSensorsModel.move(oldIndex, newIndex, 1)
+ usedSensorsModel.save();
+ }
+ }
+ ColorButton {
+ id: textColorButton
+ color: model.color
+ visible: root.showColor
+ showAlphaChannel: true
+ onAccepted: {
+ usedSensorsModel.setProperty(index, "color", color.toString());
+ usedSensorsModel.save();
+ }
+ }
+ Controls.Label {
+ Layout.fillWidth: true
+ text: sensor.name
+ Sensors.Sensor {
+ id: sensor
+ sensorId: model.sensorId
+ }
+ }
+ }
+ }
+ }
+
+ onEntered: {
+ if (drag.formats.indexOf("application/x-ksysguard") == -1) {
+ drag.accepted = false;
+ return;
+ }
+ }
+ function dropIndex() {
+ if (!containsDrag) {
+ return -1;
+ } else if (usedSensorsView.count == 0) {
+ return 0;
+ }
+
+ var itemHeight = usedSensorsView.contentItem.children[0].height;
+ var contentY = usedSensorsView.contentY + drag.y;
+
+ return Math.max(0, Math.min(usedSensorsView.count, Math.round(contentY / itemHeight)));
+ }
+
+ onDropped: insertSensor(dropIndex(), drop.getDataAsString("application/x-ksysguard"))
+
+ Controls.Label {
+ anchors.centerIn: parent
+ z: 2
+ visible: usedSensorsView.count == 0
+ text: i18n("Drop Sensors Here")
+ }
+ Rectangle {
+ anchors {
+ left: parent.left
+ right: parent.right
+ }
+ height: Kirigami.Units.smallSpacing
+ color: Kirigami.Theme.highlightColor
+ visible: parent.containsDrag
+ y: {
+ if (usedSensorsView.count == 0) {
+ return 0;
+ }
+ var itemHeight = usedSensorsView.contentItem.children[0].height;
+ return itemHeight * parent.dropIndex() - usedSensorsView.contentY;
+ }
+ opacity: 0.6
+ z: 2
+ }
+ Controls.ScrollView {
+ id: usedSensorsScroll
+ anchors.fill: parent
+
+ ListView {
+ id: usedSensorsView
+
+ model: ListModel {
+ id: usedSensorsModel
+ function save() {
+ var ids = [];
+ var colors = [];
+ for (var i = 0; i < count; ++i) {
+ ids.push(get(i).sensorId);
+ colors.push(get(i).color);
+ }
+ root.sensorIds = ids;
+ root.sensorColors = colors;
+ }
+ }
+ //NOTE: this row is necessary to make the drag handle work
+ delegate: Kirigami.DelegateRecycler {
+ width: usedSensorsView.width
+ sourceComponent: delegateComponent
+ }
+ }
+ Component.onCompleted: background.visible = true;
+ Controls.ScrollBar.horizontal.visible: false
+ }
+}
+
diff --git a/applets/systemmonitor/systemmonitor/package/contents/ui/main.qml b/applets/systemmonitor/systemmonitor/package/contents/ui/main.qml
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/package/contents/ui/main.qml
@@ -0,0 +1,74 @@
+/*
+ * 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.0
+import QtQuick.Layouts 1.1
+import QtQuick.Window 2.12
+
+import org.kde.plasma.core 2.0 as PlasmaCore
+import org.kde.plasma.plasmoid 2.0
+
+import org.kde.quickcharts 1.0 as Charts
+
+Item {
+ Plasmoid.backgroundHints: PlasmaCore.Types.DefaultBackground | PlasmaCore.Types.ConfigurableBackground
+
+ Plasmoid.switchWidth: Plasmoid.fullRepresentationItem ? Plasmoid.fullRepresentationItem.Layout.minimumWidth : units.gridUnit * 8
+ Plasmoid.switchHeight: Plasmoid.fullRepresentationItem ? Plasmoid.fullRepresentationItem.Layout.minimumHeight : units.gridUnit * 12
+
+ Plasmoid.title: plasmoid.configuration.title || i18n("System Monitor")
+ Plasmoid.toolTipSubText: ""
+
+ Plasmoid.compactRepresentation: CompactRepresentation {
+ }
+ Plasmoid.fullRepresentation: FullRepresentation {
+ }
+
+ Plasmoid.configurationRequired: plasmoid.configuration.sensorIds.length == 0 && plasmoid.configuration.textOnlySensorIds.length == 0 && plasmoid.configuration.totalSensor.length == 0
+
+ //FIXME: things in faces refer to this id in the global context, should probably be fixed
+ Charts.ColorGradientSource {
+ id: colorSource
+ // originally ColorGenerator used Kirigami.Theme.highlightColor
+ baseColor: theme.highlightColor
+ itemCount: plasmoid.configuration.sensorIds.length
+
+ onItemCountChanged: generate()
+ Component.onCompleted: generate()
+
+ function generate() {
+ var colors = colorSource.colors;
+ var savedColors = plasmoid.configuration.sensorColors;
+ for (var i = 0; i < plasmoid.configuration.sensorIds.length; ++i) {
+ if (savedColors.length <= i) {
+ savedColors.push(colors[i]);
+ } else {
+ // Use the darker trick to make Qt validate the scring as a valid color;
+ var currentColor = Qt.darker(savedColors[i], 1);
+ if (!currentColor) {
+ savedColors[i] = (colors[i]);
+ }
+ }
+ }
+ plasmoid.configuration.sensorColors = savedColors;
+ }
+ }
+}
diff --git a/applets/systemmonitor/systemmonitor/package/metadata.desktop b/applets/systemmonitor/systemmonitor/package/metadata.desktop
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/package/metadata.desktop
@@ -0,0 +1,22 @@
+[Desktop Entry]
+Encoding=UTF-8
+Name=System monitor Sensor
+Comment=Displays a configurable chart of a system monitor sensor
+Icon=ksysguardd
+
+Type=Service
+X-KDE-ServiceTypes=Plasma/Applet
+
+X-Plasma-API=declarativeappletscript
+X-Plasma-MainScript=ui/main.qml
+X-KDE-Library=plasma_applet_systemmonitor
+
+X-KDE-PluginInfo-Author=Marco Martin
+X-KDE-PluginInfo-Email=mart@kde.org
+X-KDE-PluginInfo-License=GPL
+X-KDE-PluginInfo-Name=org.kde.plasma.systemmonitor
+X-KDE-PluginInfo-Version=1.0
+X-KDE-PluginInfo-Website=kde.org
+
+X-KDE-PluginInfo-Category=System Information
+X-Plasma-Provides=org.kde.plasma.systemmonitor
diff --git a/applets/systemmonitor/systemmonitor/packagestructure/CMakeLists.txt b/applets/systemmonitor/systemmonitor/packagestructure/CMakeLists.txt
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/packagestructure/CMakeLists.txt
@@ -0,0 +1,5 @@
+add_library(sensorapplet_packagestructure MODULE sensorappletpackage.cpp)
+
+target_link_libraries(sensorapplet_packagestructure PRIVATE KF5::Package KF5::I18n)
+
+install(TARGETS sensorapplet_packagestructure DESTINATION ${KDE_INSTALL_PLUGINDIR}/kpackage/packagestructure)
diff --git a/applets/systemmonitor/systemmonitor/packagestructure/config-package.h.cmake b/applets/systemmonitor/systemmonitor/packagestructure/config-package.h.cmake
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/packagestructure/config-package.h.cmake
@@ -0,0 +1 @@
+#define PLASMA_RELATIVE_DATA_INSTALL_DIR "@PLASMA_RELATIVE_DATA_INSTALL_DIR@"
diff --git a/applets/systemmonitor/systemmonitor/packagestructure/sensorapplet-packagestructure.json b/applets/systemmonitor/systemmonitor/packagestructure/sensorapplet-packagestructure.json
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/packagestructure/sensorapplet-packagestructure.json
@@ -0,0 +1,21 @@
+{
+ "KPlugin": {
+ "Authors": [
+ {
+ "Email": "mart@kde.org",
+ "Name": "Marco Martin"
+ },
+ {
+ "Email": "aseigo@kde.org",
+ "Name": "Aaron Seigo"
+ }
+ ],
+ "Id": "Plasma/SensorApplet",
+ "Name": "Face for the KSysguard Sensor Applet",
+ "ServiceTypes": [
+ "KPackage/PackageStructure"
+ ],
+ "Version": "1"
+ },
+ "X-KDE-ParentApp": "org.kde.plasmashell"
+}
diff --git a/applets/systemmonitor/systemmonitor/packagestructure/sensorappletpackage.cpp b/applets/systemmonitor/systemmonitor/packagestructure/sensorappletpackage.cpp
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/packagestructure/sensorappletpackage.cpp
@@ -0,0 +1,52 @@
+/******************************************************************************
+* Copyright 2007-2009 by Aaron Seigo *
+* Copyright 2019 by Marco Martin *
+* *
+* This library 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 of the License, or (at your option) any later version. *
+* *
+* This library 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 *
+* Library General Public License for more details. *
+* *
+* You should have received a copy of the GNU Library General Public License *
+* along with this library; see the file COPYING.LIB. If not, write to *
+* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+* Boston, MA 02110-1301, USA. *
+*******************************************************************************/
+
+#include
+#include
+#include
+
+class SensorAppletPackage : public KPackage::PackageStructure
+{
+ Q_OBJECT
+public:
+ SensorAppletPackage(QObject *parent = nullptr, const QVariantList &args = QVariantList()) : KPackage::PackageStructure(parent, args) {}
+
+ void initPackage(KPackage::Package *package) override
+ {
+ package->setDefaultPackageRoot(QStringLiteral("ksysguard/sensorapplet"));
+
+ package->addDirectoryDefinition("ui", QStringLiteral("ui"), i18n("User Interface"));
+
+ package->addFileDefinition("CompactRepresentation", QStringLiteral("ui/CompactRepresentation.qml"), i18n("The compact representation of the sensors plasmoid when collapsed, for instance in a panel."));
+ package->setRequired("CompactRepresentation", true);
+
+ package->addFileDefinition("FullRepresentation", QStringLiteral("ui/FullRepresentation.qml"), i18n("The representation of the plasmoid when it's fully expanded."));
+ package->setRequired("FullRepresentation", true);
+
+ package->addFileDefinition("ConfigUI", QStringLiteral("ui/Config.qml"), i18n("The optional configuration page for this face."));
+
+ package->addDirectoryDefinition("config", QStringLiteral("config"), i18n("Configuration support"));
+ package->addFileDefinition("mainconfigxml", QStringLiteral("config/main.xml"), i18n("KConfigXT xml file for face-specific configuration options."));
+ }
+};
+
+K_EXPORT_KPACKAGE_PACKAGE_WITH_JSON(SensorAppletPackage, "sensorapplet-packagestructure.json")
+
+#include "sensorappletpackage.moc"
diff --git a/applets/systemmonitor/systemmonitor/systemmonitor-faces.knsrc b/applets/systemmonitor/systemmonitor/systemmonitor-faces.knsrc
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/systemmonitor-faces.knsrc
@@ -0,0 +1,10 @@
+[KNewStuff3]
+Name=System monitor Sensor Display Styles
+
+Categories=Plasma Charts Face
+UploadCategories=Plasma Charts Face
+
+ProvidersUrl=https://autoconfig.kde.org/ocs/providers.xml
+StandardResource=tmp
+InstallationCommand=kpackagetool5 -t Plasma/SensorApplet -i %f
+UninstallCommand=kpackagetool5 -t Plasma/SensorApplet -r %f
diff --git a/applets/systemmonitor/systemmonitor/systemmonitor-presets.knsrc b/applets/systemmonitor/systemmonitor/systemmonitor-presets.knsrc
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/systemmonitor-presets.knsrc
@@ -0,0 +1,10 @@
+[KNewStuff3]
+Name=System monitor Sensor Presets
+
+Categories=Plasma Charts Preset
+UploadCategories=Plasma Charts Preset
+
+ProvidersUrl=https://autoconfig.kde.org/ocs/providers.xml
+StandardResource=tmp
+InstallationCommand=kpackagetool5 -t Plasma/Applet -i %f
+UninstallCommand=kpackagetool5 -t Plasma/Applet -r %f
diff --git a/applets/systemmonitor/systemmonitor/systemmonitor.h b/applets/systemmonitor/systemmonitor/systemmonitor.h
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/systemmonitor.h
@@ -0,0 +1,170 @@
+/***************************************************************************
+ * Copyright (C) 2019 Marco Martin *
+ *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, 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 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 . *
+ ***************************************************************************/
+
+#pragma once
+
+#include
+#include
+#include
+
+#include
+#include
+
+#include
+
+class ApplicationListModel;
+class QQuickItem;
+
+class KConfigLoader;
+
+namespace KDeclarative {
+ class ConfigPropertyMap;
+}
+
+class FacesModel : public QStandardItemModel
+{
+ Q_OBJECT
+public:
+ enum AdditionalRoles {
+ ModelDataRole = Qt::UserRole + 1,
+ PluginIdRole
+ };
+ Q_ENUM(AdditionalRoles)
+
+ FacesModel(QObject *parent = nullptr);
+ ~FacesModel() = default;
+
+ void load();
+
+ Q_INVOKABLE QString pluginId(int row);
+
+ QHash roleNames() const override;
+};
+
+class PresetsModel : public QStandardItemModel
+{
+ Q_OBJECT
+public:
+ enum AdditionalRoles {
+ ModelDataRole = Qt::UserRole + 1,
+ PluginIdRole,
+ ConfigRole,
+ WritableRole
+ };
+ Q_ENUM(AdditionalRoles)
+
+ PresetsModel(QObject *parent = nullptr);
+ ~PresetsModel() = default;
+
+ Q_INVOKABLE QString pluginId(int row) const; // really needed?
+
+ QHash roleNames() const override;
+};
+
+class SystemMonitor : public Plasma::Applet
+{
+ Q_OBJECT
+ Q_PROPERTY(QString face READ face NOTIFY faceChanged)
+ Q_PROPERTY(QString faceName READ faceName NOTIFY faceChanged)
+ Q_PROPERTY(QString currentPreset READ currentPreset WRITE setCurrentPreset NOTIFY currentPresetChanged)
+ Q_PROPERTY(QString faceIcon READ faceIcon NOTIFY faceChanged)
+ Q_PROPERTY(QString compactRepresentationPath READ compactRepresentationPath NOTIFY faceChanged)
+ Q_PROPERTY(QString fullRepresentationPath READ fullRepresentationPath NOTIFY faceChanged)
+ Q_PROPERTY(QString configPath READ configPath NOTIFY faceChanged)
+
+ Q_PROPERTY(bool supportsSensorsColors READ supportsSensorsColors NOTIFY faceChanged)
+ Q_PROPERTY(bool supportsTotalSensor READ supportsTotalSensor NOTIFY faceChanged)
+ Q_PROPERTY(bool supportsTextOnlySensors READ supportsTextOnlySensors NOTIFY faceChanged)
+
+ Q_PROPERTY(QAbstractItemModel *availableFacesModel READ availableFacesModel CONSTANT)
+ Q_PROPERTY(QAbstractItemModel *availablePresetsModel READ availablePresetsModel CONSTANT)
+
+ /**
+ * Configuration object: each config key will be a writable property of this object. property bindings work.
+ */
+ Q_PROPERTY(QObject *faceConfiguration READ faceConfiguration NOTIFY faceChanged)
+
+public:
+ SystemMonitor( QObject *parent, const QVariantList &args );
+ ~SystemMonitor() override;
+
+ void init() override;
+
+ // Getter, also for QML
+ QString face() const;
+ // Setter internal use only
+ void setFace(const QString &face);
+
+ QString faceName() const;
+ QString faceIcon() const;
+
+ QString currentPreset() const;
+ void setCurrentPreset(const QString &preset);
+
+ QString compactRepresentationPath() const;
+ QString fullRepresentationPath() const;
+ QString configPath() const;
+
+ bool supportsSensorsColors() const;
+ bool supportsTotalSensor() const;
+ bool supportsTextOnlySensors() const;
+
+ QAbstractItemModel *availableFacesModel();
+ QAbstractItemModel *availablePresetsModel();
+
+ QObject *faceConfiguration() const;
+
+ void reloadAvailablePresetsModel();
+
+ // TODO: should there be a dialog that lets the user insert the metadata?
+ void createNewPreset(const QString &pluginName, const QString &comment, const QString &author, const QString &email, const QString &license, const QString &website);
+
+ Q_INVOKABLE void savePreset();
+ Q_INVOKABLE void getNewPresets(QQuickItem *ctx);
+ Q_INVOKABLE void uninstallPreset(const QString &pluginId);
+
+ Q_INVOKABLE void getNewFaces(QQuickItem *ctx);
+
+public Q_SLOTS:
+ void configChanged() override;
+
+Q_SIGNALS:
+ void faceChanged();
+ void currentPresetChanged();
+
+private:
+ void resetToCustomPresetUserConfiguring();
+ void resetToCustomPreset();
+
+ void getNewStuff(QQuickItem *ctx, const QString &knsrc, const QString &title);
+
+ QString m_face;
+ QString m_currentPreset;
+ QString m_pendingStartupPreset;
+ KPackage::Package m_facePackage;
+ KDesktopFile *m_faceMetadata = nullptr;
+ FacesModel *m_availableFacesModel = nullptr;
+ PresetsModel *m_availablePresetsModel = nullptr;
+ KConfigLoader *m_faceConfigLoader = nullptr;
+ KDeclarative::ConfigPropertyMap *m_faceConfiguration = nullptr;
+
+ QPointer m_newStuffDialog;
+};
+
diff --git a/applets/systemmonitor/systemmonitor/systemmonitor.cpp b/applets/systemmonitor/systemmonitor/systemmonitor.cpp
new file mode 100644
--- /dev/null
+++ b/applets/systemmonitor/systemmonitor/systemmonitor.cpp
@@ -0,0 +1,583 @@
+/***************************************************************************
+ * Copyright (C) 2019 Marco Martin *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, 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 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 . *
+ ***************************************************************************/
+
+#include "systemmonitor.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+
+#include
+#include
+#include
+#include
+
+#include
+
+
+FacesModel::FacesModel(QObject *parent)
+ : QStandardItemModel(parent)
+{}
+
+void FacesModel::load()
+{
+ clear();
+
+ auto list = KPackage::PackageLoader::self()->listPackages(QStringLiteral("Plasma/SensorApplet"));
+ // NOTE: This will diable completely the internal in-memory cache
+ KPackage::Package p;
+ p.install(QString(), QString());
+
+ for (auto plugin : list) {
+ QStandardItem *item = new QStandardItem(plugin.name());
+ item->setData(plugin.name(), FacesModel::ModelDataRole);
+ item->setData(plugin.pluginId(), FacesModel::PluginIdRole);
+ appendRow(item);
+ }
+}
+
+QString FacesModel::pluginId(int row)
+{
+ return data(index(row, 0), PluginIdRole).toString();
+}
+
+QHash FacesModel::roleNames() const
+{
+ QHash roles = QAbstractItemModel::roleNames();
+
+ roles[ModelDataRole] = "modelData";
+ roles[PluginIdRole] = "pluginId";
+ return roles;
+}
+
+PresetsModel::PresetsModel(QObject *parent)
+ : QStandardItemModel(parent)
+{}
+
+QString PresetsModel::pluginId(int row) const
+{
+ return data(index(row, 0), PluginIdRole).toString();
+}
+
+QHash PresetsModel::roleNames() const
+{
+ QHash roles = QAbstractItemModel::roleNames();
+
+ roles[ModelDataRole] = "modelData";
+ roles[PluginIdRole] = "pluginId";
+ roles[ConfigRole] = "config";
+ roles[WritableRole] = "writable";
+ return roles;
+}
+
+SystemMonitor::SystemMonitor(QObject *parent, const QVariantList &args)
+ : Plasma::Applet(parent, args)
+{
+ setHasConfigurationInterface(true);
+
+ m_facePackage = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/SensorApplet"), QStringLiteral("org.kde.ksysguard.linechart"));
+
+ //Don't set the preset right now as we can't write on the config here because we don't have a Corona yet
+ if (args.count() > 2 && args.mid(3).length() > 0) {
+ const QString preset = args.mid(3).first().toString();
+ if (preset.length() > 0) {
+ m_pendingStartupPreset = preset;
+ }
+ }
+}
+
+SystemMonitor::~SystemMonitor()
+= default;
+
+void SystemMonitor::init()
+{
+ configChanged();
+
+ // NOTE: taking the pluginId this way, we take it from the child applet (cpu monitor, memory, whatever) rather than the parent fallback applet (systemmonitor)
+ const QString pluginId = KPluginMetaData(kPackage().path() + QStringLiteral("metadata.desktop")).pluginId();
+
+ if (!m_pendingStartupPreset.isNull()) {
+ setCurrentPreset(m_pendingStartupPreset);
+ } else {
+ //Take it from the config, which is *not* accessible from plasmoid.config as is not in config.xml
+ const QString preset = config().readEntry("CurrentPreset", pluginId);
+ setCurrentPreset(preset);
+ if (preset.isEmpty()) {
+ resetToCustomPreset();
+ emit currentPresetChanged();
+ }
+ }
+}
+
+void SystemMonitor::configChanged()
+{
+ setFace(configScheme()->property("chartFace").toString());
+}
+
+void SystemMonitor::setFace(const QString &face)
+{
+ if (face.length() == 0 || face == m_face || face.contains("..")) {
+ return;
+ }
+
+ // Valid face?
+ const QString oldPath = m_facePackage.path();
+ m_facePackage.setPath(face);
+ if (!m_facePackage.isValid()) {
+ m_facePackage.setPath(oldPath);
+ return;
+ }
+
+ m_face = face;
+
+ delete m_faceMetadata;
+ m_faceMetadata = new KDesktopFile(m_facePackage.path() + QStringLiteral("metadata.desktop"));
+
+ const QString xmlPath = m_facePackage.filePath("mainconfigxml");
+
+ if (!xmlPath.isEmpty()) {
+ QFile file(xmlPath);
+ KConfigGroup cg = config();
+ cg = KConfigGroup(&cg, face);
+ if (m_faceConfiguration) {
+ m_faceConfiguration->deleteLater();
+ }
+ if (m_faceConfigLoader) {
+ m_faceConfigLoader->deleteLater();
+ }
+ m_faceConfigLoader = new KConfigLoader(cg, &file, this);
+ m_faceConfiguration = new KDeclarative::ConfigPropertyMap(m_faceConfigLoader, this);
+ }
+
+ emit faceChanged();
+}
+
+QString SystemMonitor::face() const
+{
+ return m_face;
+}
+
+QString SystemMonitor::faceName() const
+{
+ if (!m_faceMetadata) {
+ return QString();
+ }
+ return m_faceMetadata->readName();
+}
+
+QString SystemMonitor::faceIcon() const
+{
+ if (!m_faceMetadata) {
+ return QString();
+ }
+ return m_faceMetadata->readIcon();
+}
+
+QString SystemMonitor::currentPreset() const
+{
+ return m_currentPreset;
+}
+
+void SystemMonitor::setCurrentPreset(const QString &preset)
+{
+ if (preset == m_currentPreset) {
+ return;
+ }
+
+ m_currentPreset = preset;
+ config().writeEntry("CurrentPreset", preset);
+
+ if (preset.isEmpty()) {
+ resetToCustomPreset();
+ emit currentPresetChanged();
+ return;
+ }
+
+ auto presetPackage = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/Applet"));
+
+ presetPackage.setPath(preset);
+
+ if (!presetPackage.isValid()) {
+ return;
+ }
+
+ if (presetPackage.metadata().value(QStringLiteral("X-Plasma-RootPath")) != QStringLiteral("org.kde.plasma.systemmonitor")) {
+ return;
+ }
+
+ disconnect(configScheme(), &KCoreConfigSkeleton::configChanged, this, &SystemMonitor::resetToCustomPresetUserConfiguring);
+ disconnect(m_faceConfigLoader, &KCoreConfigSkeleton::configChanged, this, &SystemMonitor::resetToCustomPresetUserConfiguring);
+
+ KDesktopFile df(presetPackage.path() + QStringLiteral("metadata.desktop"));
+ KConfigGroup configGroup(df.group("Config"));
+
+ // Load the title
+ KConfigSkeletonItem *item = configScheme()->findItemByName(QStringLiteral("title"));
+ if (item) {
+ item->setProperty(df.readName());
+ configScheme()->save();
+ //why read? read will update KConfigSkeletonItem::mLoadedValue,
+ //allowing a write operation to be performed next time
+ configScheme()->read();
+ }
+
+ //Remove the "custon" value from presets models
+ if (m_availablePresetsModel &&
+ m_availablePresetsModel->data(m_availablePresetsModel->index(0, 0), PresetsModel::PluginIdRole).toString().isEmpty()) {
+ m_availablePresetsModel->removeRow(0);
+ }
+
+ // Load the global config keys
+ for (const QString &key : configGroup.keyList()) {
+ KConfigSkeletonItem *item = configScheme()->findItemByName(key);
+
+ if (item) {
+ if (item->property().type() == QVariant::StringList) {
+ // Special case: sensor ids or textOnlySensorIds can have wildchars that need to be expanded
+ if (key == "sensorIds" || key == "textOnlySensorIds") {
+ const QStringList partialEntries = configGroup.readEntry(key, QStringList());
+ QStringList sensors;
+
+ for (const QString &id : partialEntries) {
+ KSysGuard::SensorQuery query{id};
+ query.execute();
+ query.waitForFinished();
+
+ sensors.append(query.sensorIds());
+ }
+ item->setProperty(QVariant::fromValue(sensors));
+ } else {
+ item->setProperty(QVariant::fromValue(configGroup.readEntry(key, QStringList())));
+ }
+ } else {
+ const QString &value = configGroup.readEntry(key);
+ if (key == QStringLiteral("chartFace") && value.length() > 0) {
+ setFace(value);
+ }
+ item->setProperty(value);
+ }
+ configScheme()->save();
+ //why read? read will update KConfigSkeletonItem::mLoadedValue,
+ //allowing a write operation to be performed next time
+ configScheme()->read();
+ }
+ }
+
+ if (m_faceConfigLoader) {
+ configGroup = KConfigGroup(df.group("FaceConfig"));
+ for (const QString &key : configGroup.keyList()) {
+ KConfigSkeletonItem *item = m_faceConfigLoader->findItemByName(key);
+ if (item) {
+ if (item->property().type() == QVariant::StringList) {
+ item->setProperty(configGroup.readEntry(key, QStringList()));
+ } else {
+ item->setProperty(configGroup.readEntry(key));
+ }
+ m_faceConfigLoader->save();
+ m_faceConfigLoader->read();
+ }
+ }
+ }
+
+ emit currentPresetChanged();
+
+ connect(configScheme(), &KCoreConfigSkeleton::configChanged, this, &SystemMonitor::resetToCustomPresetUserConfiguring);
+ connect(m_faceConfigLoader, &KCoreConfigSkeleton::configChanged, this, &SystemMonitor::resetToCustomPresetUserConfiguring);
+}
+
+void SystemMonitor::resetToCustomPresetUserConfiguring()
+{
+ // automatically switch to "custom" preset only when the user changes settings from the dialog, *not* nettings changed programmatically by the plasmoid itself
+ if (isUserConfiguring()) {
+ resetToCustomPreset();
+ }
+}
+
+void SystemMonitor::resetToCustomPreset()
+{
+ if (m_availablePresetsModel &&
+ !m_availablePresetsModel->data(m_availablePresetsModel->index(0, 0), PresetsModel::PluginIdRole).toString().isEmpty()) {
+ QStandardItem *item = new QStandardItem(i18n("Custom"));
+ item->setData(i18n("Custom"), PresetsModel::ModelDataRole);
+ m_availablePresetsModel->insertRow(0, item);
+ }
+
+ setCurrentPreset(QString());
+}
+
+QString SystemMonitor::compactRepresentationPath() const
+{
+ return m_facePackage.filePath("CompactRepresentation");
+}
+
+QString SystemMonitor::fullRepresentationPath() const
+{
+ return m_facePackage.filePath("FullRepresentation");
+}
+
+QString SystemMonitor::configPath() const
+{
+ return m_facePackage.filePath("ConfigUI");
+}
+
+bool SystemMonitor::supportsSensorsColors() const
+{
+ if (!m_faceMetadata) {
+ return false;
+ }
+
+ KConfigGroup cg(m_faceMetadata, QStringLiteral("Config"));
+ return cg.readEntry("SupportsSensorsColors", false);
+}
+
+bool SystemMonitor::supportsTotalSensor() const
+{
+ if (!m_faceMetadata) {
+ return false;
+ }
+
+ KConfigGroup cg(m_faceMetadata, QStringLiteral("Config"));
+ return cg.readEntry("SupportsTotalSensor", false);
+}
+
+bool SystemMonitor::supportsTextOnlySensors() const
+{
+ if (!m_faceMetadata) {
+ return false;
+ }
+
+ KConfigGroup cg(m_faceMetadata, QStringLiteral("Config"));
+ return cg.readEntry("SupportsTextOnlySensors", false);
+}
+
+QAbstractItemModel *SystemMonitor::availableFacesModel()
+{
+ if (m_availableFacesModel) {
+ return m_availableFacesModel;
+ }
+
+ m_availableFacesModel = new FacesModel(this);
+ m_availableFacesModel->load();
+ return m_availableFacesModel;
+}
+
+QAbstractItemModel *SystemMonitor::availablePresetsModel()
+{
+ if (m_availablePresetsModel) {
+ return m_availablePresetsModel;
+ }
+
+ m_availablePresetsModel = new PresetsModel(this);
+
+ // TODO move that into a PresetsModel::load()
+ reloadAvailablePresetsModel();
+
+ if (m_currentPreset.isEmpty()) {
+ resetToCustomPreset();
+ }
+
+ return m_availablePresetsModel;
+}
+
+void SystemMonitor::reloadAvailablePresetsModel()
+{
+ if (!m_availablePresetsModel) {
+ availablePresetsModel();
+ return;
+ }
+
+ m_availablePresetsModel->clear();
+ QList plugins = KPackage::PackageLoader::self()->findPackages(QStringLiteral("Plasma/Applet"), QString(), [](const KPluginMetaData &plugin) {
+ return plugin.value(QStringLiteral("X-Plasma-RootPath")) == QStringLiteral("org.kde.plasma.systemmonitor");
+ });
+
+ QSet usedNames;
+
+ // We iterate backwards because packages under ~/.local are listed first, while we want them last
+ auto it = plugins.rbegin();
+ for (; it != plugins.rend(); ++it) {
+ const auto &plugin = *it;
+ KPackage::Package p = KPackage::PackageLoader::self()->loadPackage("Plasma/Applet", plugin.pluginId());
+ KDesktopFile df(p.path() + QStringLiteral("metadata.desktop"));
+
+ QString baseName = df.readName();
+ QString name = baseName;
+ int id = 0;
+
+ while (usedNames.contains(name)) {
+ name = baseName % " (" % QString::number(++id) % ")";
+ }
+ usedNames << name;
+
+ QStandardItem *item = new QStandardItem(baseName);
+
+ // TODO config
+ QVariantMap config;
+
+ KConfigGroup configGroup(df.group("Config"));
+
+ const QStringList keys = configGroup.keyList();
+ for (const QString &key : keys) {
+ // all strings for now, type conversion happens in QML side when we have the config property map
+ config.insert(key, configGroup.readEntry(key));
+ }
+
+ item->setData(name, PresetsModel::ModelDataRole);
+ item->setData(plugin.pluginId(), PresetsModel::PluginIdRole);
+ item->setData(config, PresetsModel::ConfigRole);
+
+ item->setData(QFileInfo(p.path() + QStringLiteral("metadata.desktop")).isWritable(), PresetsModel::WritableRole);
+
+ m_availablePresetsModel->appendRow(item);
+ }
+}
+
+QObject *SystemMonitor::faceConfiguration() const
+{
+ return m_faceConfiguration;
+}
+
+void SystemMonitor::createNewPreset(const QString &pluginName, const QString &comment, const QString &author, const QString &email, const QString &license, const QString &website)
+{
+ QTemporaryDir dir;
+ if (!dir.isValid()) {
+ return;
+ }
+
+ KConfig c(dir.path() % QLatin1Literal("/metadata.desktop"));
+
+ KConfigGroup cg(&c, "Desktop Entry");
+ cg.writeEntry("Name", configScheme()->property("title"));
+ cg.writeEntry("Comment", comment);
+ cg.writeEntry("Icon", "ksysguardd");
+ cg.writeEntry("X-Plasma-API", "declarativeappletscript");
+ cg.writeEntry("X-Plasma-MainScript", "ui/main.qml");
+ cg.writeEntry("X-Plasma-Provides", "org.kde.plasma.systemmonitor");
+ cg.writeEntry("X-Plasma-RootPath", "org.kde.plasma.systemmonitor");
+ cg.writeEntry("X-KDE-PluginInfo-Name", pluginName);
+ cg.writeEntry("X-KDE-ServiceTypes", "Plasma/Applet");
+ cg.writeEntry("X-KDE-PluginInfo-Author", author);
+ cg.writeEntry("X-KDE-PluginInfo-Email", email);
+ cg.writeEntry("X-KDE-PluginInfo-Website", website);
+ cg.writeEntry("X-KDE-PluginInfo-Category", "System Information");
+ cg.writeEntry("X-KDE-PluginInfo-License", license);
+ cg.writeEntry("X-KDE-PluginInfo-EnabledByDefault", "true");
+ cg.writeEntry("X-KDE-PluginInfo-Version", "0.1");
+ cg.sync();
+
+ cg = KConfigGroup(&c, "Config");
+ for (KConfigSkeletonItem *item : configScheme()->items()) {
+ cg.writeEntry(item->key(), item->property());
+ }
+ cg.sync();
+
+ cg = KConfigGroup(&c, "FaceConfig");
+ for (KConfigSkeletonItem *item : m_faceConfigLoader->items()) {
+ cg.writeEntry(item->key(), item->property());
+ }
+ cg.sync();
+
+ auto presetPackage = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/Applet"));
+
+ auto *job = presetPackage.install(dir.path());
+
+ connect(job, &KJob::finished, this, [this, pluginName] () {
+ reloadAvailablePresetsModel();
+ setCurrentPreset(pluginName);
+ });
+}
+
+void SystemMonitor::savePreset()
+{
+ QString pluginName = QStringLiteral("org.kde.plasma.systemmonitor.preset");
+ int suffix = 0;
+
+ auto presetPackage = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/Applet"));
+
+ do {
+ presetPackage.setPath(QString());
+ presetPackage.setPath(pluginName + QString::number(++suffix));
+ } while (!presetPackage.filePath("metadata").isEmpty());
+
+ pluginName += QString::number(suffix);
+
+ createNewPreset(pluginName, QString(), QString(), QString(), QStringLiteral("LGPL 2.1+"), QString());
+}
+
+void SystemMonitor::getNewPresets(QQuickItem *ctx)
+{
+ return getNewStuff(ctx, QStringLiteral("systemmonitor-presets.knsrc"), i18n("Download New Presets"));
+}
+
+void SystemMonitor::uninstallPreset(const QString &pluginId)
+{
+ auto presetPackage = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/Applet"), pluginId);
+
+ if (presetPackage.metadata().value("X-Plasma-RootPath") != QStringLiteral("org.kde.plasma.systemmonitor")) {
+ return;
+ }
+
+ QDir root(presetPackage.path());
+ root.cdUp();
+ auto *job = presetPackage.uninstall(pluginId, root.path());
+
+ connect(job, &KJob::finished, this, [this] () {
+ reloadAvailablePresetsModel();
+ });
+}
+
+void SystemMonitor::getNewFaces(QQuickItem *ctx)
+{
+ getNewStuff(ctx, QStringLiteral("systemmonitor-faces.knsrc"), i18n("Download New Display Styles"));
+}
+
+void SystemMonitor::getNewStuff(QQuickItem *ctx, const QString &knsrc, const QString &title)
+{
+ if (m_newStuffDialog) {
+ return;
+ }
+
+ m_newStuffDialog = new KNS3::DownloadDialog(knsrc);
+ m_newStuffDialog->setWindowTitle(title);
+ m_newStuffDialog->setWindowModality(Qt::WindowModal);
+ m_newStuffDialog->winId(); // so it creates the windowHandle();
+ m_newStuffDialog->setAttribute(Qt::WA_DeleteOnClose);
+
+ connect(m_newStuffDialog.data(), &KNS3::DownloadDialog::accepted, this, [this] {
+ if (m_availableFacesModel) {
+ m_availableFacesModel->load();
+ }
+ reloadAvailablePresetsModel();
+ });
+
+ if (ctx && ctx->window()) {
+ m_newStuffDialog->windowHandle()->setTransientParent(ctx->window());
+ }
+
+ m_newStuffDialog->show();
+}
+
+K_EXPORT_PLASMA_APPLET_WITH_JSON(systemmonitor, SystemMonitor, "metadata.json")
+
+#include "systemmonitor.moc"