Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: orblazer/plasma-applet-resources-monitor
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.6.2
Choose a base ref
...
head repository: orblazer/plasma-applet-resources-monitor
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.6.3
Choose a head ref
  • 6 commits
  • 7 files changed
  • 1 contributor

Commits on Dec 31, 2021

  1. fix(graph): update graph on static interval

    This also improve stability of code
    orblazer committed Dec 31, 2021

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    9755b85 View commit details
  2. perf(graph): sync update with history

    This also use dots for null values
    orblazer committed Dec 31, 2021
    Copy the full SHA
    4e2fb96 View commit details

Commits on Jan 3, 2022

  1. Copy the full SHA
    45fedbd View commit details

Commits on Jan 4, 2022

  1. Copy the full SHA
    f0c548d View commit details
  2. Copy the full SHA
    cf47a7c View commit details

Commits on Jan 6, 2022

  1. v2.6.3

    orblazer committed Jan 6, 2022
    Copy the full SHA
    4cc431f View commit details
Showing with 104 additions and 88 deletions.
  1. +16 −0 CHANGELOG.md
  2. +1 −1 package.json
  3. +43 −43 package/contents/ui/components/NetworkGraph.qml
  4. +36 −40 package/contents/ui/components/SensorGraph.qml
  5. +1 −0 package/contents/ui/main.qml
  6. +1 −1 package/metadata.desktop
  7. +6 −3 scripts/test.sh
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
## [2.6.3](https://github.com/orblazer/plasma-applet-resources-monitor/compare/v2.6.2...v2.6.3) (2022-01-06)


### Bug Fixes

* **graph:** correct hide swap value when is 0 ([cf47a7c](https://github.com/orblazer/plasma-applet-resources-monitor/commit/cf47a7c7ec7aa8f9ae8c1450908f176a6189d8d1))
* **graph:** improve stability of label values ([f0c548d](https://github.com/orblazer/plasma-applet-resources-monitor/commit/f0c548d3a1b50e4b4d9d1ec0dba854115be45995)), closes [#25](https://github.com/orblazer/plasma-applet-resources-monitor/issues/25)
* **graph:** update graph on static interval ([9755b85](https://github.com/orblazer/plasma-applet-resources-monitor/commit/9755b85c71d1bc422b744e3537a9177f890fb29e))


### Performance Improvements

* **graph:** sync update with history ([4e2fb96](https://github.com/orblazer/plasma-applet-resources-monitor/commit/4e2fb969d1e060c8f1fdef5cb7e0b0263fd49710))



## [2.6.2](https://github.com/orblazer/plasma-applet-resources-monitor/compare/v2.6.1...v2.6.2) (2021-12-29)


2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "plasma-applet-resources-monitor",
"version": "2.6.2",
"version": "2.6.3",
"description": "Plasmoid for monitoring CPU, memory and network traffic. This is an fork from \"Resources Monitor\" by Kotelnik",
"homepage": "https://github.com/orblazer/plasma-applet-resources-monitor",
"funding": "https://www.paypal.me/orblazer",
86 changes: 43 additions & 43 deletions package/contents/ui/components/NetworkGraph.qml
Original file line number Diff line number Diff line change
@@ -16,9 +16,6 @@ Item {
signal dataTick()
signal showValueWhenMouseMove()

property var downloadSensors: []
property var uploadSensors: []

// Aliases
readonly property alias textContainer: textContainer
property alias label: textContainer.label
@@ -78,6 +75,7 @@ Item {
source: Charts.SingleValueSource {
id: downloadSpeed
}
interval: chart.interval
maximumHistory: chart.interval > 0 ? (chart.historyAmount * 1000) / chart.interval : 0
fillMode: Charts.HistoryProxySource.FillFromStart
}
@@ -105,8 +103,11 @@ Item {
source: Charts.SingleValueSource {
id: uploadSpeed
}
interval: chart.interval
maximumHistory: chart.interval > 0 ? (chart.historyAmount * 1000) / chart.interval : 0
fillMode: Charts.HistoryProxySource.FillFromStart

onDataChanged: _dataTick()
}
]
}
@@ -129,13 +130,6 @@ Item {
id: sensorsModel
updateRateLimit: chart.interval

property var downloadModel: ListModel {
id: downloadModel
}
property var uploadModel: ListModel {
id: uploadModel
}

function getData(column) {
if (!hasIndex(0, column)) {
return 0
@@ -148,59 +142,65 @@ Item {
}

function updateSensors() {
downloadSensors = []
uploadSensors = []
var sensors = []
for (var i = 0; i < networkInterfaces.model.count; i++) {
var name = networkInterfaces.model.get(i).name

if (ignoredNetworkInterfaces.indexOf(name) === -1) {
downloadSensors.push("network/" + name + "/download")
uploadSensors.push("network/" + name + "/upload")
sensors.push("network/" + name + "/download")
sensors.push("network/" + name + "/upload")
}
}

sensorsModel.sensors = downloadSensors.concat(uploadSensors)
sensorsModel.sensors = sensors
}
}

Timer {
id: timer
repeat: true
running: chart.visible
interval: chart.interval
onTriggered: _dataTick()
}
Component.onCompleted: _dataTick()

function _dataTick() {
var sensorsLength = sensorsModel.sensors.length

// Emit signal
chart.dataTick()

// Set default text when doesn't have sensors
if (sensorsLength === 0) {
if (canSeeValue(0)) {
firstLineLabel.text = '...'
firstLineLabel.visible = true
}
if (canSeeValue(1)) {
secondLineLabel.text = '...'
secondLineLabel.visible = secondLabelWhenZero
}
return
}

// Calculate total download
var value = 0
for (var i = 0; i < downloadSensors.length; i++) {
value += sensorsModel.getData(i)
var downloadValue = 0, uploadValue = 0
for (var i = 0; i < sensorsLength; i++) {
if (sensorsModel.sensors[i].indexOf('/download') !== -1) {
downloadValue += sensorsModel.getData(i)
} else {
uploadValue += sensorsModel.getData(i)
}
}
value *= dialect.KiBDiff // Fix dialect
downloadSpeed.value = value

// Update label
// Fix dialect
downloadValue *= dialect.KiBDiff
uploadValue *= dialect.KiBDiff

// Update values
downloadSpeed.value = downloadValue
uploadSpeed.value = uploadValue

// Update labels
if (canSeeValue(0)) {
firstLineLabel.text = formatLabel(value)
firstLineLabel.text = formatLabel(downloadValue)
firstLineLabel.visible = true
}

// Calculate total upload
value = 0
for (var i = 0; i < uploadSensors.length; i++) {
value += sensorsModel.getData(downloadSensors.length + i)
}
value *= dialect.KiBDiff // Fix dialect
uploadSpeed.value = value

// Update label
if (canSeeValue(1)) {
secondLineLabel.text = formatLabel(value)
secondLineLabel.visible = value !== 0 || secondLabelWhenZero
secondLineLabel.text = formatLabel(uploadValue)
secondLineLabel.visible = uploadValue !== 0 || secondLabelWhenZero
}
}

76 changes: 36 additions & 40 deletions package/contents/ui/components/SensorGraph.qml
Original file line number Diff line number Diff line change
@@ -9,43 +9,17 @@ import org.kde.quickcharts 1.0 as Charts
import "./" as RMComponents

RMComponents.BaseSensorGraph {
id: chart
id: chart

readonly property alias sensorsModel: sensorsModel

property bool customFormatter: false
property var lastRun: -1

Sensors.SensorDataModel {
id: sensorsModel
updateRateLimit: chart.interval

property var lastRun: -1

onDataChanged: {
if (!chart.visible) {
return
}

// Skip when value is not visible
if (canSeeValue(topLeft.column)) {
// Update albel
if (topLeft.column === 0) { // is first line
firstLineLabel.text = getData(topLeft.column)
firstLineLabel.visible = true
} else if (topLeft.column === 1) { // is second line
secondLineLabel.text = getData(topLeft.column)
secondLineLabel.visible = data(topLeft, Sensors.SensorDataModel.Value) !== 0 || secondLabelWhenZero
}
}

// Call data tick
var now = Date.now()
if (now - lastRun >= chart.interval) {
lastRun = now
chart.dataTick()
}
}

function getData(column = 0, role = Sensors.SensorDataModel.FormattedValue) {
if (!hasIndex(0, column)) {
return undefined
@@ -69,19 +43,41 @@ RMComponents.BaseSensorGraph {
roleName: "Value"
}

interval: {
if (chart.interval > 0) {
return chart.interval
}
interval: chart.interval
maximumHistory: interval > 0 ? (chart.historyAmount * 1000) / interval : 0
fillMode: Charts.HistoryProxySource.FillFromStart

if (sensorsModel.ready) {
return sensorsModel.headerData(index, Qt.Horizontal, Sensors.SensorDataModel.UpdateInterval)
onDataChanged: {
// Skip when value is not visible
if (canSeeValue(index)) {
var value = sensorsModel.getData(index)

// Update albel
if (index === 0) { // is first line
if (typeof value === 'undefined') {
firstLineLabel.text = '...'
} else {
firstLineLabel.text = value
}
} else if (index === 1) { // is second line
if (typeof value === 'undefined') {
secondLineLabel.text = '...'
secondLineLabel.visible = secondLabelWhenZero
} else {
secondLineLabel.text = value
secondLineLabel.visible = sensorsModel.getData(index, Sensors.SensorDataModel.Value) !== 0
|| secondLabelWhenZero
}
}
}

return 0
// Call data tick
var now = Date.now()
if (now - lastRun >= chart.interval) {
lastRun = now
chart.dataTick()
}
}
maximumHistory: interval > 0 ? (chart.historyAmount * 1000) / interval : 0
fillMode: Charts.HistoryProxySource.FillFromStart

property var connection: Connections {
target: chart
@@ -103,9 +99,8 @@ RMComponents.BaseSensorGraph {
var data = sensorsModel.getData(0)
if (typeof data !== "undefined") {
firstLineLabel.text = data
firstLineLabel.visible = true
} else {
firstLineLabel.visible = false
firstLineLabel.text = '...'
}

// Show second line
@@ -114,7 +109,8 @@ RMComponents.BaseSensorGraph {
secondLineLabel.text = data
secondLineLabel.visible = sensorsModel.getData(1, Sensors.SensorDataModel.Value) !== 0 || secondLabelWhenZero
} else {
secondLineLabel.visible = false
secondLineLabel.text = '...'
secondLineLabel.visible = secondLabelWhenZero
}

chart.showValueWhenMouseMove()
1 change: 1 addition & 0 deletions package/contents/ui/main.qml
Original file line number Diff line number Diff line change
@@ -151,6 +151,7 @@ Item {
RMComponents.SensorGraph {
id: ramGraph
colors: [ramColor, swapColor]
secondLabelWhenZero: false
// TODO: stack the graph values for eal fill percent ?

yRange {
2 changes: 1 addition & 1 deletion package/metadata.desktop
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ X-KDE-PluginInfo-Author=Kotelnik,orblazer
X-KDE-PluginInfo-Email=clearmartin@seznam.cz
X-KDE-PluginInfo-License=GPL-3.0-only
X-KDE-PluginInfo-Name=org.kde.resourcesMonitor-fork
X-KDE-PluginInfo-Version=2.6.2
X-KDE-PluginInfo-Version=2.6.3
X-KDE-PluginInfo-Website=https://github.com/orblazer/plasma-applet-resources-monitor
X-KDE-ServiceTypes=Plasma/Applet
X-Plasma-API=declarativeappletscript
9 changes: 6 additions & 3 deletions scripts/test.sh
Original file line number Diff line number Diff line change
@@ -2,8 +2,11 @@
PLASMOID_DIR='~/.local/share/plasma/plasmoids/'
PACKAGE_NAME=org.kde.resourcesMonitor-fork

# Enable QT debug
#export QT_LOGGING_RULES="*.debug=true; qt.*.debug=false"
# Enable debug for Fedora
if ! [ -z "$(cat /etc/*release | grep ^NAME | grep Fedora)" ]
then
export QT_LOGGING_RULES="*.debug=true; qt.*.debug=false"
fi

if [ -d "${PLASMOID_DIR}${PACKAGE_NAME}" ]
then
@@ -15,7 +18,7 @@ else
fi

echo 'Run applet...'
if ! [ -x "$(command -v plasmoidviewer)" ];
if ! [ -x "$(command -v plasmoidviewer)" ]
then
plasmawindowed $PACKAGE_NAME
else