Line 0
Link Here
|
|
|
1 |
--- plugin-sysstat/lxqtsysstat.cpp.orig 2017-01-01 22:27:14 UTC |
2 |
+++ plugin-sysstat/lxqtsysstat.cpp |
3 |
@@ -320,6 +320,7 @@ void LXQtSysStatContent::updateSettings( |
4 |
{ |
5 |
if (mDataType == "CPU") |
6 |
{ |
7 |
+#if defined(Q_OS_LINUX) |
8 |
if (mUseFrequency) |
9 |
{ |
10 |
qobject_cast<SysStat::CpuStat*>(mStat)->setMonitoring(SysStat::CpuStat::LoadAndFrequency); |
11 |
@@ -330,6 +331,10 @@ void LXQtSysStatContent::updateSettings( |
12 |
qobject_cast<SysStat::CpuStat*>(mStat)->setMonitoring(SysStat::CpuStat::LoadOnly); |
13 |
connect(qobject_cast<SysStat::CpuStat*>(mStat), SIGNAL(update(float, float, float, float)), this, SLOT(cpuUpdate(float, float, float, float))); |
14 |
} |
15 |
+#elif defined(Q_OS_FREEBSD) |
16 |
+ qobject_cast<SysStat::CpuStat*>(mStat)->setMonitoring(SysStat::CpuStat::LoadOnly); |
17 |
+ connect(qobject_cast<SysStat::CpuStat*>(mStat), SIGNAL(update(float, float, float, float, float)), this, SLOT(cpuUpdate(float, float, float, float, float))); |
18 |
+#endif |
19 |
} |
20 |
else if (mDataType == "Memory") |
21 |
{ |
22 |
@@ -386,6 +391,7 @@ void LXQtSysStatContent::clearLine() |
23 |
reinterpret_cast<QRgb*>(mHistoryImage.scanLine(i))[mHistoryOffset] = bg; |
24 |
} |
25 |
|
26 |
+#if defined(Q_OS_LINUX) |
27 |
void LXQtSysStatContent::cpuUpdate(float user, float nice, float system, float other, float frequencyRate, uint) |
28 |
{ |
29 |
int y_system = static_cast<int>(system * 100.0 * frequencyRate); |
30 |
@@ -478,6 +484,52 @@ void LXQtSysStatContent::cpuUpdate(float |
31 |
|
32 |
update(0, mTitleFontPixelHeight, width(), height() - mTitleFontPixelHeight); |
33 |
} |
34 |
+#elif defined(Q_OS_FREEBSD) |
35 |
+void LXQtSysStatContent::cpuUpdate(float user, float nice, float system, float idle, float other) |
36 |
+{ |
37 |
+ int y_system = static_cast<int>(round(system * 100.0)); |
38 |
+ int y_user = static_cast<int>(round(user * 100.0)); |
39 |
+ int y_nice = static_cast<int>(round(nice * 100.0)); |
40 |
+ int y_idle = static_cast<int>(round(idle * 100.0)); |
41 |
+ int y_other = static_cast<int>(round(other * 100.0)); |
42 |
+ |
43 |
+ toolTipInfo(tr("system: %1%<br>user: %2%<br>nice: %3%<br>other: %4%", "CPU tooltip information") |
44 |
+ .arg(y_system).arg(y_user).arg(y_nice).arg(y_other)); |
45 |
+ |
46 |
+ |
47 |
+ y_system = clamp(y_system, 0, 99); |
48 |
+ y_user = clamp(y_user + y_system, 0, 99); |
49 |
+ y_nice = clamp(y_nice+y_user, 0, 99); |
50 |
+ y_other = clamp(y_other+y_nice, 0, 99); |
51 |
+ |
52 |
+ clearLine(); |
53 |
+ QPainter painter(&mHistoryImage); |
54 |
+ if (y_system != 0) |
55 |
+ { |
56 |
+ painter.setPen(mColours.cpuSystemColour); |
57 |
+ painter.drawLine(mHistoryOffset, y_system, mHistoryOffset, 0); |
58 |
+ } |
59 |
+ if (y_user != y_system) |
60 |
+ { |
61 |
+ painter.setPen(mColours.cpuUserColour); |
62 |
+ painter.drawLine(mHistoryOffset, y_user, mHistoryOffset, y_system); |
63 |
+ } |
64 |
+ if (y_nice != y_user) |
65 |
+ { |
66 |
+ painter.setPen(mColours.cpuNiceColour); |
67 |
+ painter.drawLine(mHistoryOffset, y_nice, mHistoryOffset, y_user); |
68 |
+ } |
69 |
+ if (y_other != y_nice) |
70 |
+ { |
71 |
+ painter.setPen(mColours.cpuOtherColour); |
72 |
+ painter.drawLine(mHistoryOffset, y_other, mHistoryOffset, y_nice); |
73 |
+ } |
74 |
+ |
75 |
+ mHistoryOffset = (mHistoryOffset + 1) % width(); |
76 |
+ |
77 |
+ update(0, mTitleFontPixelHeight, width(), height() - mTitleFontPixelHeight); |
78 |
+} |
79 |
+#endif |
80 |
|
81 |
void LXQtSysStatContent::memoryUpdate(float apps, float buffers, float cached) |
82 |
{ |