Display speeds in bits per second instead of KiB/s

Summary:
This is a patch to make the Network Monitor desktop plasmoid widget display the upload and download speeds in bits per second (Mbps, Kbps or bps as the case may be) rather than the fixed "KiB/s" unit.

It appears the input data is always in KiB units so the bps part may never be called but left it in there anyway.

Reviewers: davidedmundson

Reviewed By: davidedmundson

Subscribers: broulik, sebas, Zren, davidedmundson, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D4551
wilder-5.14
David Edmundson 9 years ago
parent 1c513a0dcd
commit 8da91cde83
  1. 22
      applets/systemmonitor/net/contents/ui/net.qml

@ -39,5 +39,23 @@ Applet {
}
}
delegate: DoublePlotter {}
}
function formatBitSpeed(value) {
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));
}
if (value > 0) {
return i18nc("%1 is the displayed data transfer speed in bits per second", "%1 bps", value);
}
return value;
}
delegate: DoublePlotter {
function formatLabel(data1, data2) {
return i18nc("%1 and %2 are values of the same datatype", "%1 | %2", formatBitSpeed(data1.value * 1024 * 8),
formatBitSpeed(data2.value * 1024 * 8));
}
}
}

Loading…
Cancel
Save