Commit 2a3ab410 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

[Connectivity Report] Only emit signal when it has actually changed

Avoids pointless DBus traffic
parent 034e5fb0
Pipeline #103615 passed with stage
in 1 minute and 32 seconds
......@@ -43,10 +43,16 @@ bool ConnectivityReportPlugin::receivePacket(const NetworkPacket& np)
auto subscriptions = np.get<QVariantMap>(QStringLiteral("signalStrengths"), QVariantMap());
auto networkInfo = subscriptions.first().toMap();
const auto oldCellularNetworkType = m_cellularNetworkType;
const auto oldNetworkStrength = m_cellularNetworkStrength;
m_cellularNetworkType = networkInfo.value(QStringLiteral("networkType")).toString();
m_cellularNetworkStrength = networkInfo.value(QStringLiteral("signalStrength")).toInt();
Q_EMIT refreshed(m_cellularNetworkType, m_cellularNetworkStrength);
if (oldCellularNetworkType != m_cellularNetworkType ||
oldNetworkStrength != m_cellularNetworkStrength) {
Q_EMIT refreshed(m_cellularNetworkType, m_cellularNetworkStrength);
}
}
return true;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment