Changeset View
Changeset View
Standalone View
Standalone View
applets/systemmonitor/common/contents/ui/DoublePlotter.qml
Show All 21 Lines | |||||
22 | import QtQuick.Layouts 1.1 | 22 | import QtQuick.Layouts 1.1 | ||
23 | import org.kde.plasma.core 2.0 as PlasmaCore | 23 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
24 | import org.kde.plasma.components 2.0 as PlasmaComponents | 24 | import org.kde.plasma.components 2.0 as PlasmaComponents | ||
25 | import org.kde.kquickcontrolsaddons 2.0 as KQuickAddons | 25 | import org.kde.kquickcontrolsaddons 2.0 as KQuickAddons | ||
26 | 26 | | |||
27 | KQuickAddons.Plotter { | 27 | KQuickAddons.Plotter { | ||
28 | id: plotter | 28 | id: plotter | ||
29 | property string sensorName: model.friendlyName1 | 29 | property string sensorName: model.friendlyName1 | ||
30 | property string downloadLabel: "⬇" | ||||
31 | property string uploadLabel: "⬆" | ||||
30 | 32 | | |||
31 | Layout.fillWidth: true | 33 | Layout.fillWidth: true | ||
32 | Layout.fillHeight: true | 34 | Layout.fillHeight: true | ||
33 | horizontalGridLineCount: 0 | 35 | horizontalGridLineCount: 0 | ||
34 | 36 | | |||
35 | function cycle(color, degrees) { | 37 | function cycle(color, degrees) { | ||
36 | var min = Math.min(color.r, Math.min(color.g, color.b)); | 38 | var min = Math.min(color.r, Math.min(color.g, color.b)); | ||
37 | var max = Math.max(color.r, Math.max(color.g, color.b)); | 39 | var max = Math.max(color.r, Math.max(color.g, color.b)); | ||
▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Line(s) | 98 | if (data1 === undefined || data1.value === undefined || | |||
97 | data2 === undefined || data2.value === undefined) { | 99 | data2 === undefined || data2.value === undefined) { | ||
98 | return; | 100 | return; | ||
99 | } | 101 | } | ||
100 | 102 | | |||
101 | plotter.addSample([data1.value, data2.value]); | 103 | plotter.addSample([data1.value, data2.value]); | ||
102 | 104 | | |||
103 | if (plasmoid.formFactor !== PlasmaCore.Types.Vertical) { | 105 | if (plasmoid.formFactor !== PlasmaCore.Types.Vertical) { | ||
104 | nameLabel.text = plotter.sensorName | 106 | nameLabel.text = plotter.sensorName | ||
105 | speedLabel.text = i18n("<font color='%1'>⬇</font> %2 | <font color='%3'>⬆</font> %4", | 107 | speedLabel.text = i18n("<font color='%1'>%2</font> %3 | <font color='%4'>%5</font> %6", | ||
106 | downloadColor, | 108 | downloadColor, | ||
109 | downloadLabel, | ||||
107 | formatData(data1), | 110 | formatData(data1), | ||
108 | uploadColor, | 111 | uploadColor, | ||
112 | uploadLabel, | ||||
109 | formatData(data2)) | 113 | formatData(data2)) | ||
110 | } else { | 114 | } else { | ||
111 | nameLabel.text = plotter.sensorName+ "\n" + formatData(data1) + "\n" + formatData(data2) | 115 | nameLabel.text = plotter.sensorName+ "\n" + formatData(data1) + "\n" + formatData(data2) | ||
112 | speedLabel.text = "" | 116 | speedLabel.text = "" | ||
113 | } | 117 | } | ||
114 | } | 118 | } | ||
115 | } | 119 | } | ||
116 | } | 120 | } |