|
| 1 | +--- a/SysLoad.cxx |
| 2 | ++++ b/SysLoad.cxx |
| 3 | +@@ -19,7 +19,9 @@ |
| 4 | + |
| 5 | + #include <KLocalizedString> |
| 6 | + |
| 7 | ++#ifndef __TERMUX__ |
| 8 | + #include <NetworkManagerQt/Manager> |
| 9 | ++#endif |
| 10 | + |
| 11 | + //-------------------------------------------------------------------------------- |
| 12 | + |
| 13 | +@@ -45,20 +47,29 @@ |
| 14 | + timeoutTimer.start(); |
| 15 | + connect(&timeoutTimer, &QTimer::timeout, this, &SysLoad::fetch); |
| 16 | + |
| 17 | ++#ifndef __TERMUX__ |
| 18 | + connect(NetworkManager::notifier(), &NetworkManager::Notifier::primaryConnectionChanged, |
| 19 | + [this]() { maxScale = NET_INIT_SCALE; maxBytes = 0; }); // reset since we're changing network (which might be slower) |
| 20 | ++#endif |
| 21 | + |
| 22 | + // gradually decrease max network throughput to really be able to see when network traffic occurs |
| 23 | ++#ifndef __TERMUX__ |
| 24 | + netLoadTimer.setInterval(NET_INTERVAL_S * 1000); |
| 25 | + netLoadTimer.start(); |
| 26 | + connect(&netLoadTimer, &QTimer::timeout, this, [this]() { maxBytes = 0; if ( maxScale > NET_INIT_SCALE ) maxScale /= 2; }); |
| 27 | ++#endif |
| 28 | + |
| 29 | + fetch(); |
| 30 | + |
| 31 | + const int cpuBars = cpuSummaryBar ? 1 : cpus.count(); |
| 32 | + const int cpuBarWidth = (cpuBars <= 4) ? BAR_WIDTH : SMALL_BAR_WIDTH; |
| 33 | ++#ifdef __TERMUX__ |
| 34 | ++ setFixedWidth((cpuBars * cpuBarWidth) + (2 * BAR_WIDTH) + |
| 35 | ++ contentsMargins().left() + contentsMargins().right()); |
| 36 | ++#else |
| 37 | + setFixedWidth((cpuBars * cpuBarWidth) + ((2 + 1) * BAR_WIDTH) + // 2 memory bars, 1 net - they shall be more prominent |
| 38 | + contentsMargins().left() + contentsMargins().right()); |
| 39 | ++#endif |
| 40 | + } |
| 41 | + |
| 42 | + //-------------------------------------------------------------------------------- |
| 43 | +@@ -143,6 +154,7 @@ |
| 44 | + f.close(); |
| 45 | + } |
| 46 | + |
| 47 | ++#ifndef __TERMUX__ |
| 48 | + f.setFileName("/proc/net/dev"); |
| 49 | + sumSent = sumReceived = 0; |
| 50 | + if ( f.open(QIODevice::ReadOnly) ) |
| 51 | +@@ -190,6 +202,7 @@ |
| 52 | + |
| 53 | + maxBytes = std::max(maxBytes, (sumReceived + sumSent)); |
| 54 | + maxScale = std::max(maxBytes, maxScale); |
| 55 | ++#endif |
| 56 | + |
| 57 | + update(); |
| 58 | + |
| 59 | +@@ -220,11 +233,13 @@ |
| 60 | + tip += i18n("Swap Free: %1 MB (%2 GB)" , swapFree / 1024, locale().toString(swapFree / 1024.0 / 1024.0, 'f', 2)); |
| 61 | + |
| 62 | + tip += "<hr>"; |
| 63 | ++#ifndef __TERMUX__ |
| 64 | + tip += i18n("Net send/receive: %1/%2 KB/sec", |
| 65 | + locale().toString((sumSent / 1024.0) / (INTERVAL_MS / 1000.0), 'f', 2), |
| 66 | + locale().toString((sumReceived / 1024.0) / (INTERVAL_MS / 1000.0), 'f', 2)); |
| 67 | + tip += "<br>"; |
| 68 | + tip += i18n("Net max (last %2 secs): %1 KB/sec", locale().toString((maxBytes / 1024.0) / (INTERVAL_MS / 1000.0), 'f', 2), NET_INTERVAL_S); |
| 69 | ++#endif |
| 70 | + |
| 71 | + if ( underMouse() ) |
| 72 | + QToolTip::showText(QCursor::pos(), QLatin1String("<html>") + tip + QLatin1String("</html>"), this, rect()); |
| 73 | +@@ -291,6 +306,7 @@ |
| 74 | + painter.fillRect(x, y - h, BAR_WIDTH, h, memSwapColor); |
| 75 | + |
| 76 | + |
| 77 | ++#ifndef __TERMUX__ |
| 78 | + // net |
| 79 | + x += BAR_WIDTH; |
| 80 | + y = contentsRect().y() + contentsRect().height(); |
| 81 | +@@ -299,6 +315,7 @@ |
| 82 | + y -= h; |
| 83 | + h = contentsRect().height() * (double(sumSent) / maxScale); |
| 84 | + painter.fillRect(x, y - h, BAR_WIDTH, h, netSentColor); |
| 85 | ++#endif |
| 86 | + } |
| 87 | + |
| 88 | + //-------------------------------------------------------------------------------- |
| 89 | + |
| 90 | +--- a/SysTray.cxx |
| 91 | ++++ b/SysTray.cxx |
| 92 | +@@ -9,10 +9,12 @@ |
| 93 | + #include <SysTray.hxx> |
| 94 | + #include <DBusTypes.hxx> |
| 95 | + #include <NotificationServer.hxx> |
| 96 | ++#ifndef __TERMUX__ |
| 97 | + #include <Network.hxx> |
| 98 | ++#include <Bluetooth.hxx> |
| 99 | ++#endif |
| 100 | + #include <DeviceNotifier.hxx> |
| 101 | + #include <Battery.hxx> |
| 102 | +-#include <Bluetooth.hxx> |
| 103 | + |
| 104 | + #ifdef WITH_PACKAGEKIT |
| 105 | + #include <PkUpdates.hxx> |
| 106 | +@@ -111,10 +113,14 @@ |
| 107 | + QVector<QWidget *> internalWidgets = |
| 108 | + { |
| 109 | + notificationServer = new NotificationServer(this), |
| 110 | ++#ifndef __TERMUX__ |
| 111 | + new Network(this), |
| 112 | ++#endif |
| 113 | + new DeviceNotifier(this), |
| 114 | + new Battery(this), |
| 115 | ++#ifndef __TERMUX__ |
| 116 | + new Bluetooth(this), |
| 117 | ++#endif |
| 118 | + #ifdef WITH_PACKAGEKIT |
| 119 | + new PkUpdates(this) |
| 120 | + #endif |
| 121 | + |
| 122 | +--- a/WeatherApplet.cxx |
| 123 | ++++ b/WeatherApplet.cxx |
| 124 | +@@ -24,7 +24,9 @@ |
| 125 | + #include <KConfig> |
| 126 | + #include <KConfigGroup> |
| 127 | + #include <KLocalizedString> |
| 128 | ++#ifndef __TERMUX__ |
| 129 | + #include <NetworkManagerQt/Manager> |
| 130 | ++#endif |
| 131 | + |
| 132 | + //-------------------------------------------------------------------------------- |
| 133 | + |
| 134 | +@@ -96,12 +98,14 @@ |
| 135 | + hbox->addStretch(); |
| 136 | + } |
| 137 | + |
| 138 | ++#ifndef __TERMUX__ |
| 139 | + connect(NetworkManager::notifier(), &NetworkManager::Notifier::connectivityChanged, this, |
| 140 | + [this](NetworkManager::Connectivity connectivity) |
| 141 | + { |
| 142 | + if ( connectivity == NetworkManager::Full ) |
| 143 | + fetchData(); |
| 144 | + }); |
| 145 | ++#endif |
| 146 | + } |
| 147 | + |
| 148 | + //-------------------------------------------------------------------------------- |
0 commit comments