-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor!: change way to config graph
BREAKING CHANGE: all config related to graph as been merged in "graphs" json
- Loading branch information
Showing
31 changed files
with
1,557 additions
and
1,568 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# CPU | ||
[{"_v":1,"type":"cpu","colors":["highlightColor","textColor","textColor"],"sensorsType":["usage","classic",true],"clockAgregator":"average","eCoresCount":0,"thresholds":[85,105]}] | ||
|
||
# Memory | ||
[{"_v":1,"type":"memory","colors":["highlightColor","negativeTextColor"],"sensorsType":["physical","swap"],"thresholds":[70,90]}] | ||
|
||
# GPU | ||
[{"_v":1,"type":"gpu","colors":["highlightColor","positiveTextColor","textColor"],"sensorsType":["memory",true],"thresholds":[70,90],"gpuIndex":"gpu1"}] | ||
|
||
# Network | ||
[{"_v":1,"type":"network","colors":["highlightColor","positiveTextColor"],"sensorsType":["kibibyte"],"uplimits":[100000,100000],"ignoredInterfaces":[]}] | ||
|
||
# Disks | ||
[{"_v":1,"type":"disks","colors":["highlightColor","positiveTextColor"],"uplimits":[200000,200000]}] | ||
|
||
# Full | ||
[{"_v":1,"type":"cpu","colors":["highlightColor","textColor","textColor"],"sensorsType":["usage","classic",true],"clockAgregator":"average","eCoresCount":0,"thresholds":[85,105]},{"_v":1,"type":"memory","colors":["highlightColor","negativeTextColor"],"sensorsType":["physical","swap"],"thresholds":[70,90]},{"_v":1,"type":"gpu","colors":["highlightColor","positiveTextColor","textColor"],"sensorsType":["memory",true],"thresholds":[70,90],"gpuIndex":"gpu1"},{"_v":1,"type":"network","colors":["highlightColor","positiveTextColor"],"sensorsType":["kibibyte"],"uplimits":[100000,100000],"ignoredInterfaces":[]},{"_v":1,"type":"disks","colors":["highlightColor","positiveTextColor"],"uplimits":[200000,200000]}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,55 @@ | ||
import QtQuick | ||
import org.kde.plasma.plasmoid | ||
import org.kde.kirigami as Kirigami | ||
import "./base" as RMBaseGraph | ||
import "../sensors" as RMSensors | ||
import "../functions.mjs" as Functions | ||
|
||
RMBaseGraph.SensorGraph { | ||
id: root | ||
objectName: "CpuGraph" | ||
|
||
// Config shrotcut | ||
property bool showClock: Plasmoid.configuration.cpuClockType !== "none" | ||
property bool clockIsEcores: Plasmoid.configuration.cpuClockType === "ecores" | ||
property color temperatureColor: Functions.resolveColor(Plasmoid.configuration.cpuTemperatureColor) | ||
// Settings | ||
property string clockAgregator: "average" // Values: average, minimum, maximum | ||
property int eCoresCount: 0 | ||
|
||
// Handle config update | ||
Connections { | ||
target: Plasmoid.configuration | ||
function onCpuUnitChanged() { | ||
_updateSensors(); | ||
} | ||
} | ||
// Config shortcut | ||
property bool showClock: sensorsType[1] !== "none" | ||
property bool clockIsEcores: sensorsType[1] === "ecores" | ||
|
||
// Graph options | ||
// NOTE: "sensorsModel.sensors" is set by "_updateSensors" | ||
chartColor: Functions.resolveColor(Plasmoid.configuration.cpuColor) | ||
|
||
chart.yRange { | ||
from: 0 | ||
to: 100 | ||
} | ||
|
||
// Labels options | ||
thresholds: [undefined, undefined, [Plasmoid.configuration.thresholdWarningCpuTemp, Plasmoid.configuration.thresholdCriticalCpuTemp]] | ||
|
||
thresholdIndex: 2 | ||
realThresholds: thresholds // No change needed, simply map it | ||
textContainer { | ||
labelColors: [root.chartColor, undefined, temperatureColor] | ||
valueColors: [undefined, undefined, temperatureColor] | ||
labelColors: [root.colors[0], undefined, root.colors[2]] | ||
valueColors: [undefined, undefined, root.colors[2]] | ||
|
||
labels: ["CPU", (showClock ? i18nc("Graph label", "Clock") : ""), (Plasmoid.configuration.showCpuTemperature ? i18nc("Graph label", "Temp.") : "")] | ||
labels: ["CPU", (root.showClock ? i18nc("Graph label", "Clock") : ""), (root.sensorsType[2] ? i18nc("Graph label", "Temp.") : "")] | ||
} | ||
|
||
// CPU frequency handle | ||
_formatValue: (index, data) => { | ||
if (index === 1) { | ||
return cpuFrequenry.getFormattedValue(clockIsEcores); | ||
return cpuFrequenry.getFormattedValue(root.clockIsEcores); | ||
} | ||
return _defaultFormatValue(index, data); | ||
} | ||
|
||
RMSensors.CpuFrequency { | ||
id: cpuFrequenry | ||
enabled: showClock | ||
agregator: Plasmoid.configuration.cpuClockAgregator | ||
eCoresCount: Plasmoid.configuration.cpuECoresCount | ||
enabled: root.showClock | ||
agregator: root.clockAgregator | ||
eCoresCount: root.eCoresCount | ||
|
||
onReady: _updateSensors() | ||
onReady: root._updateSensors() | ||
} | ||
|
||
function _updateSensors() { | ||
sensorsModel.sensors = ["cpu/all/" + Plasmoid.configuration.cpuUnit, "cpu/cpu0/frequency", "cpu/cpu0/temperature"]; | ||
sensorsModel.sensors = ["cpu/all/" + sensorsType[0], "cpu/cpu0/frequency", "cpu/cpu0/temperature"]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.