Changeset View
Changeset View
Standalone View
Standalone View
applets/systemmonitor/net/contents/ui/net.qml
Context not available. | |||||
39 | } | 39 | } | ||
---|---|---|---|---|---|
40 | } | 40 | } | ||
41 | 41 | | |||
42 | function formatBitSpeed(value) { | | |||
43 | if (value > (1024 * 1024)) { | | |||
44 | return i18nc("%1 is the displayed data transfer speed in megabits per second", "%1 Mbps", (value / (1024 * 1024)).toFixed(1)); | | |||
45 | } | | |||
46 | if (value > 1024) { | | |||
47 | return i18nc("%1 is the displayed data transfer speed in kilobits per second", "%1 Kbps", (value / 1024)); | | |||
48 | } | | |||
49 | if (value > 0) { | | |||
50 | return i18nc("%1 is the displayed data transfer speed in bits per second", "%1 bps", value); | | |||
51 | } | | |||
52 | return value; | | |||
53 | } | | |||
54 | | ||||
55 | delegate: DoublePlotter { | 42 | delegate: DoublePlotter { | ||
56 | function formatLabel(data1, data2) { | 43 | function formatData(data) { | ||
57 | return i18nc("%1 and %2 are values of the same datatype", "%1 | %2", formatBitSpeed(data1.value * 1024 * 8), | 44 | var value = data.value * 1024 * 8 | ||
58 | formatBitSpeed(data2.value * 1024 * 8)); | 45 | if (value > (1024 * 1024)) { | ||
46 | return i18nc("%1 is the displayed data transfer speed in megabits per second", "%1 Mbps", (value / (1024 * 1024)).toFixed(1)); | ||||
47 | } | ||||
48 | if (value > 1024) { | ||||
49 | return i18nc("%1 is the displayed data transfer speed in kilobits per second", "%1 Kbps", (value / 1024)); | ||||
50 | } | ||||
51 | if (value > 0) { | ||||
52 | return i18nc("%1 is the displayed data transfer speed in bits per second", "%1 bps", value); | ||||
53 | } | ||||
54 | return value; | ||||
59 | } | 55 | } | ||
60 | } | 56 | } | ||
61 | } | 57 | } | ||
Context not available. |