Fix reading high traffic values
This commit is contained in:
parent
f3d78800a5
commit
ba3db70604
|
@ -19,6 +19,7 @@
|
|||
#include <QNetworkInterface>
|
||||
|
||||
#include <utility>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
using namespace ChronoUtilities;
|
||||
|
@ -794,9 +795,9 @@ void SyncthingConnection::readConnections()
|
|||
const QJsonObject replyObj(replyDoc.object());
|
||||
const QJsonObject totalObj(replyObj.value(QStringLiteral("total")).toObject());
|
||||
|
||||
// read traffic
|
||||
const int totalIncomingTraffic = totalObj.value(QStringLiteral("inBytesTotal")).toInt(0);
|
||||
const int totalOutgoingTraffic = totalObj.value(QStringLiteral("outBytesTotal")).toInt(0);
|
||||
// read traffic, the conversion to double is neccassary because toInt() doesn't work for high values
|
||||
const uint64 totalIncomingTraffic = static_cast<uint64>(totalObj.value(QStringLiteral("inBytesTotal")).toDouble(0.0));
|
||||
const uint64 totalOutgoingTraffic = static_cast<uint64>(totalObj.value(QStringLiteral("outBytesTotal")).toDouble(0.0));
|
||||
double transferTime;
|
||||
if(!m_lastConnectionsUpdate.isNull() && ((transferTime = (DateTime::gmtNow() - m_lastConnectionsUpdate).totalSeconds()) != 0.0)) {
|
||||
m_totalIncomingRate = (totalIncomingTraffic - m_totalIncomingTraffic) * 0.008 / transferTime,
|
||||
|
@ -829,8 +830,8 @@ void SyncthingConnection::readConnections()
|
|||
}
|
||||
}
|
||||
dev.paused = connectionObj.value(QStringLiteral("paused")).toBool(false);
|
||||
dev.totalIncomingTraffic = connectionObj.value(QStringLiteral("inBytesTotal")).toInt(0);
|
||||
dev.totalOutgoingTraffic = connectionObj.value(QStringLiteral("outBytesTotal")).toInt(0);
|
||||
dev.totalIncomingTraffic = static_cast<uint64>(connectionObj.value(QStringLiteral("inBytesTotal")).toDouble(0));
|
||||
dev.totalOutgoingTraffic = static_cast<uint64>(connectionObj.value(QStringLiteral("outBytesTotal")).toDouble(0));
|
||||
dev.connectionAddress = connectionObj.value(QStringLiteral("address")).toString();
|
||||
dev.connectionType = connectionObj.value(QStringLiteral("type")).toString();
|
||||
dev.clientVersion = connectionObj.value(QStringLiteral("clientVersion")).toString();
|
||||
|
@ -943,9 +944,9 @@ void SyncthingConnection::readDeviceStatistics()
|
|||
}
|
||||
++index;
|
||||
}
|
||||
// since there seems no event for this data, just request every minute, FIXME: make interval configurable
|
||||
// since there seems no event for this data, just request every minute
|
||||
if(m_keepPolling) {
|
||||
QTimer::singleShot(m_devStatsPollInterval, Qt::VeryCoarseTimer, this, SLOT(requestConnections()));
|
||||
QTimer::singleShot(m_devStatsPollInterval, Qt::VeryCoarseTimer, this, &SyncthingConnection::requestDeviceStatistics);
|
||||
}
|
||||
} else {
|
||||
emit error(tr("Unable to parse device statistics: ") + jsonError.errorString());
|
||||
|
|
|
@ -88,8 +88,8 @@ public:
|
|||
void setReconnectInterval(int reconnectInterval);
|
||||
const QString &configDir() const;
|
||||
const QString &myId() const;
|
||||
int totalIncomingTraffic() const;
|
||||
int totalOutgoingTraffic() const;
|
||||
uint64 totalIncomingTraffic() const;
|
||||
uint64 totalOutgoingTraffic() const;
|
||||
double totalIncomingRate() const;
|
||||
double totalOutgoingRate() const;
|
||||
const std::vector<SyncthingDir> &dirInfo() const;
|
||||
|
@ -131,7 +131,7 @@ Q_SIGNALS:
|
|||
void statusChanged(SyncthingStatus newStatus);
|
||||
void configDirChanged(const QString &newConfigDir);
|
||||
void myIdChanged(const QString &myNewId);
|
||||
void trafficChanged(int totalIncomingTraffic, int totalOutgoingTraffic);
|
||||
void trafficChanged(uint64 totalIncomingTraffic, uint64 totalOutgoingTraffic);
|
||||
void rescanTriggered(const QString &dirId);
|
||||
void pauseTriggered(const QString &devId);
|
||||
void resumeTriggered(const QString &devId);
|
||||
|
@ -192,8 +192,8 @@ private:
|
|||
QTimer m_reconnectTimer;
|
||||
QString m_configDir;
|
||||
QString m_myId;
|
||||
int m_totalIncomingTraffic;
|
||||
int m_totalOutgoingTraffic;
|
||||
uint64 m_totalIncomingTraffic;
|
||||
uint64 m_totalOutgoingTraffic;
|
||||
double m_totalIncomingRate;
|
||||
double m_totalOutgoingRate;
|
||||
QNetworkReply *m_configReply;
|
||||
|
@ -371,7 +371,7 @@ inline const QString &SyncthingConnection::myId() const
|
|||
/*!
|
||||
* \brief Returns the total incoming traffic in byte.
|
||||
*/
|
||||
inline int SyncthingConnection::totalIncomingTraffic() const
|
||||
inline uint64 SyncthingConnection::totalIncomingTraffic() const
|
||||
{
|
||||
return m_totalIncomingTraffic;
|
||||
}
|
||||
|
@ -379,7 +379,7 @@ inline int SyncthingConnection::totalIncomingTraffic() const
|
|||
/*!
|
||||
* \brief Returns the total outgoing traffic in byte.
|
||||
*/
|
||||
inline int SyncthingConnection::totalOutgoingTraffic() const
|
||||
inline uint64 SyncthingConnection::totalOutgoingTraffic() const
|
||||
{
|
||||
return m_totalOutgoingTraffic;
|
||||
}
|
||||
|
|
|
@ -33,8 +33,8 @@ struct LIB_SYNCTHING_CONNECTOR_EXPORT SyncthingDev
|
|||
int progressRate = 0;
|
||||
bool introducer = false;
|
||||
bool paused = false;
|
||||
int totalIncomingTraffic = 0;
|
||||
int totalOutgoingTraffic = 0;
|
||||
uint64 totalIncomingTraffic = 0;
|
||||
uint64 totalOutgoingTraffic = 0;
|
||||
QString connectionAddress;
|
||||
QString connectionType;
|
||||
QString clientVersion;
|
||||
|
|
|
@ -4,153 +4,153 @@
|
|||
<context>
|
||||
<name>Data::SyncthingConnection</name>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="92"/>
|
||||
<location filename="../syncthingconnection.cpp" line="93"/>
|
||||
<source>disconnected</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="94"/>
|
||||
<location filename="../syncthingconnection.cpp" line="95"/>
|
||||
<source>reconnecting</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="96"/>
|
||||
<location filename="../syncthingconnection.cpp" line="97"/>
|
||||
<source>connected</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="98"/>
|
||||
<location filename="../syncthingconnection.cpp" line="99"/>
|
||||
<source>connected, paused</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="100"/>
|
||||
<location filename="../syncthingconnection.cpp" line="101"/>
|
||||
<source>connected, synchronizing</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="102"/>
|
||||
<location filename="../syncthingconnection.cpp" line="103"/>
|
||||
<source>unknown</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="128"/>
|
||||
<location filename="../syncthingconnection.cpp" line="199"/>
|
||||
<location filename="../syncthingconnection.cpp" line="129"/>
|
||||
<location filename="../syncthingconnection.cpp" line="200"/>
|
||||
<source>Connection configuration is insufficient.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="527"/>
|
||||
<location filename="../syncthingconnection.cpp" line="528"/>
|
||||
<source>Unable to request QR-Code: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="556"/>
|
||||
<location filename="../syncthingconnection.cpp" line="557"/>
|
||||
<source>Unable to parse Syncthing log: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="560"/>
|
||||
<location filename="../syncthingconnection.cpp" line="561"/>
|
||||
<source>Unable to request system log: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="597"/>
|
||||
<location filename="../syncthingconnection.cpp" line="598"/>
|
||||
<source>Unable to locate certificate used by Syncthing GUI.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="603"/>
|
||||
<location filename="../syncthingconnection.cpp" line="604"/>
|
||||
<source>Unable to load certificate used by Syncthing GUI.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="663"/>
|
||||
<location filename="../syncthingconnection.cpp" line="664"/>
|
||||
<source>Unable to parse Syncthing config: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="669"/>
|
||||
<location filename="../syncthingconnection.cpp" line="670"/>
|
||||
<source>Unable to request Syncthing config: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="768"/>
|
||||
<location filename="../syncthingconnection.cpp" line="769"/>
|
||||
<source>Unable to parse Syncthing status: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="774"/>
|
||||
<location filename="../syncthingconnection.cpp" line="775"/>
|
||||
<source>Unable to request Syncthing status: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="849"/>
|
||||
<location filename="../syncthingconnection.cpp" line="850"/>
|
||||
<source>Unable to parse connections: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="855"/>
|
||||
<location filename="../syncthingconnection.cpp" line="856"/>
|
||||
<source>Unable to request connections: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="909"/>
|
||||
<location filename="../syncthingconnection.cpp" line="910"/>
|
||||
<source>Unable to parse directory statistics: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="915"/>
|
||||
<location filename="../syncthingconnection.cpp" line="916"/>
|
||||
<source>Unable to request directory statistics: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="951"/>
|
||||
<location filename="../syncthingconnection.cpp" line="952"/>
|
||||
<source>Unable to parse device statistics: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="957"/>
|
||||
<location filename="../syncthingconnection.cpp" line="958"/>
|
||||
<source>Unable to request device statistics: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="995"/>
|
||||
<location filename="../syncthingconnection.cpp" line="996"/>
|
||||
<source>Unable to parse errors: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="1006"/>
|
||||
<location filename="../syncthingconnection.cpp" line="1007"/>
|
||||
<source>Unable to request errors: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="1057"/>
|
||||
<location filename="../syncthingconnection.cpp" line="1058"/>
|
||||
<source>Unable to parse Syncthing events: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="1079"/>
|
||||
<location filename="../syncthingconnection.cpp" line="1080"/>
|
||||
<source>Unable to request Syncthing events: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="1333"/>
|
||||
<location filename="../syncthingconnection.cpp" line="1334"/>
|
||||
<source>Unable to request rescan: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="1353"/>
|
||||
<location filename="../syncthingconnection.cpp" line="1354"/>
|
||||
<source>Unable to request pause/resume: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="1369"/>
|
||||
<location filename="../syncthingconnection.cpp" line="1370"/>
|
||||
<source>Unable to request restart: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="1385"/>
|
||||
<location filename="../syncthingconnection.cpp" line="1386"/>
|
||||
<source>Unable to request shutdown: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
@ -4,153 +4,153 @@
|
|||
<context>
|
||||
<name>Data::SyncthingConnection</name>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="92"/>
|
||||
<location filename="../syncthingconnection.cpp" line="93"/>
|
||||
<source>disconnected</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="94"/>
|
||||
<location filename="../syncthingconnection.cpp" line="95"/>
|
||||
<source>reconnecting</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="96"/>
|
||||
<location filename="../syncthingconnection.cpp" line="97"/>
|
||||
<source>connected</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="98"/>
|
||||
<location filename="../syncthingconnection.cpp" line="99"/>
|
||||
<source>connected, paused</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="100"/>
|
||||
<location filename="../syncthingconnection.cpp" line="101"/>
|
||||
<source>connected, synchronizing</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="102"/>
|
||||
<location filename="../syncthingconnection.cpp" line="103"/>
|
||||
<source>unknown</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="128"/>
|
||||
<location filename="../syncthingconnection.cpp" line="199"/>
|
||||
<location filename="../syncthingconnection.cpp" line="129"/>
|
||||
<location filename="../syncthingconnection.cpp" line="200"/>
|
||||
<source>Connection configuration is insufficient.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="527"/>
|
||||
<location filename="../syncthingconnection.cpp" line="528"/>
|
||||
<source>Unable to request QR-Code: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="556"/>
|
||||
<location filename="../syncthingconnection.cpp" line="557"/>
|
||||
<source>Unable to parse Syncthing log: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="560"/>
|
||||
<location filename="../syncthingconnection.cpp" line="561"/>
|
||||
<source>Unable to request system log: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="597"/>
|
||||
<location filename="../syncthingconnection.cpp" line="598"/>
|
||||
<source>Unable to locate certificate used by Syncthing GUI.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="603"/>
|
||||
<location filename="../syncthingconnection.cpp" line="604"/>
|
||||
<source>Unable to load certificate used by Syncthing GUI.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="663"/>
|
||||
<location filename="../syncthingconnection.cpp" line="664"/>
|
||||
<source>Unable to parse Syncthing config: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="669"/>
|
||||
<location filename="../syncthingconnection.cpp" line="670"/>
|
||||
<source>Unable to request Syncthing config: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="768"/>
|
||||
<location filename="../syncthingconnection.cpp" line="769"/>
|
||||
<source>Unable to parse Syncthing status: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="774"/>
|
||||
<location filename="../syncthingconnection.cpp" line="775"/>
|
||||
<source>Unable to request Syncthing status: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="849"/>
|
||||
<location filename="../syncthingconnection.cpp" line="850"/>
|
||||
<source>Unable to parse connections: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="855"/>
|
||||
<location filename="../syncthingconnection.cpp" line="856"/>
|
||||
<source>Unable to request connections: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="909"/>
|
||||
<location filename="../syncthingconnection.cpp" line="910"/>
|
||||
<source>Unable to parse directory statistics: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="915"/>
|
||||
<location filename="../syncthingconnection.cpp" line="916"/>
|
||||
<source>Unable to request directory statistics: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="951"/>
|
||||
<location filename="../syncthingconnection.cpp" line="952"/>
|
||||
<source>Unable to parse device statistics: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="957"/>
|
||||
<location filename="../syncthingconnection.cpp" line="958"/>
|
||||
<source>Unable to request device statistics: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="995"/>
|
||||
<location filename="../syncthingconnection.cpp" line="996"/>
|
||||
<source>Unable to parse errors: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="1006"/>
|
||||
<location filename="../syncthingconnection.cpp" line="1007"/>
|
||||
<source>Unable to request errors: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="1057"/>
|
||||
<location filename="../syncthingconnection.cpp" line="1058"/>
|
||||
<source>Unable to parse Syncthing events: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="1079"/>
|
||||
<location filename="../syncthingconnection.cpp" line="1080"/>
|
||||
<source>Unable to request Syncthing events: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="1333"/>
|
||||
<location filename="../syncthingconnection.cpp" line="1334"/>
|
||||
<source>Unable to request rescan: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="1353"/>
|
||||
<location filename="../syncthingconnection.cpp" line="1354"/>
|
||||
<source>Unable to request pause/resume: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="1369"/>
|
||||
<location filename="../syncthingconnection.cpp" line="1370"/>
|
||||
<source>Unable to request restart: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../syncthingconnection.cpp" line="1385"/>
|
||||
<location filename="../syncthingconnection.cpp" line="1386"/>
|
||||
<source>Unable to request shutdown: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
@ -105,11 +105,11 @@ set(REQUIRED_ICONS
|
|||
)
|
||||
|
||||
# find c++utilities
|
||||
find_package(c++utilities 4.0.0 REQUIRED)
|
||||
find_package(c++utilities 4.2.0 REQUIRED)
|
||||
use_cpp_utilities()
|
||||
|
||||
# find qtutilities
|
||||
find_package(qtutilities 5.0.0 REQUIRED)
|
||||
find_package(qtutilities 5.1.0 REQUIRED)
|
||||
use_qt_utilities()
|
||||
|
||||
# find backend libraries
|
||||
|
|
|
@ -419,18 +419,18 @@ void TrayWidget::updateTraffic()
|
|||
static const QString unknownStr(tr("unknown"));
|
||||
if(m_connection.isConnected()) {
|
||||
if(m_connection.totalIncomingRate() != 0.0) {
|
||||
m_ui->inTrafficLabel->setText(m_connection.totalIncomingTraffic() >= 0
|
||||
m_ui->inTrafficLabel->setText(m_connection.totalIncomingTraffic() != 0
|
||||
? QStringLiteral("%1 (%2)").arg(QString::fromUtf8(bitrateToString(m_connection.totalIncomingRate(), true).data()), QString::fromUtf8(dataSizeToString(m_connection.totalIncomingTraffic()).data()))
|
||||
: QString::fromUtf8(bitrateToString(m_connection.totalIncomingRate(), true).data()));
|
||||
} else {
|
||||
m_ui->inTrafficLabel->setText(m_connection.totalIncomingTraffic() >= 0 ? QString::fromUtf8(dataSizeToString(m_connection.totalIncomingTraffic()).data()) : unknownStr);
|
||||
m_ui->inTrafficLabel->setText(m_connection.totalIncomingTraffic() != 0 ? QString::fromUtf8(dataSizeToString(m_connection.totalIncomingTraffic()).data()) : unknownStr);
|
||||
}
|
||||
if(m_connection.totalOutgoingRate() != 0.0) {
|
||||
m_ui->outTrafficLabel->setText(m_connection.totalIncomingTraffic() >= 0
|
||||
m_ui->outTrafficLabel->setText(m_connection.totalIncomingTraffic() != 0
|
||||
? QStringLiteral("%1 (%2)").arg(QString::fromUtf8(bitrateToString(m_connection.totalOutgoingRate(), true).data()), QString::fromUtf8(dataSizeToString(m_connection.totalOutgoingTraffic()).data()))
|
||||
: QString::fromUtf8(bitrateToString(m_connection.totalOutgoingRate(), true).data()));
|
||||
} else {
|
||||
m_ui->outTrafficLabel->setText(m_connection.totalOutgoingTraffic() >= 0 ? QString::fromUtf8(dataSizeToString(m_connection.totalOutgoingTraffic()).data()) : unknownStr);
|
||||
m_ui->outTrafficLabel->setText(m_connection.totalOutgoingTraffic() != 0 ? QString::fromUtf8(dataSizeToString(m_connection.totalOutgoingTraffic()).data()) : unknownStr);
|
||||
}
|
||||
} else {
|
||||
m_ui->inTrafficLabel->setText(unknownStr);
|
||||
|
|
Loading…
Reference in New Issue