refactor: 删除interfaceStats死代码
删除未使用的 Q_PROPERTY interfaceStats、interfaceStats() 实现、 statsChanged 信号、QML 属性绑定。#14 随之解决(interfaceStats 整体删除,不再有不完整输出)。
This commit is contained in:
@@ -103,23 +103,6 @@ QStringList NetworkMonitorApplet::networkInterfaces() const
|
||||
return m_interfaceList;
|
||||
}
|
||||
|
||||
QStringList NetworkMonitorApplet::interfaceStats() const
|
||||
{
|
||||
QStringList stats;
|
||||
for (const QString &name : m_interfaceList) {
|
||||
if (m_interfaces.contains(name)) {
|
||||
const NetworkInterface &iface = m_interfaces[name];
|
||||
stats << QString("%1|%2|%3|%4|%5")
|
||||
.arg(iface.name)
|
||||
.arg(iface.rxBytes)
|
||||
.arg(iface.txBytes)
|
||||
.arg(iface.rxPackets)
|
||||
.arg(iface.txPackets);
|
||||
}
|
||||
}
|
||||
return stats;
|
||||
}
|
||||
|
||||
bool NetworkMonitorApplet::ready() const
|
||||
{
|
||||
return m_ready;
|
||||
@@ -360,7 +343,6 @@ void NetworkMonitorApplet::readNetworkStats()
|
||||
}
|
||||
|
||||
calculateSpeed();
|
||||
emit statsChanged();
|
||||
// 每次刷新都检测 IP,以应对 DHCP 续约等 IP 变更场景
|
||||
detectIpAddress();
|
||||
}
|
||||
|
||||
@@ -49,7 +49,6 @@ class NetworkMonitorApplet : public DApplet
|
||||
Q_PROPERTY(double totalDownload READ totalDownload NOTIFY totalChanged)
|
||||
Q_PROPERTY(double totalUpload READ totalUpload NOTIFY totalChanged)
|
||||
Q_PROPERTY(QStringList networkInterfaces READ networkInterfaces NOTIFY interfacesChanged)
|
||||
Q_PROPERTY(QStringList interfaceStats READ interfaceStats NOTIFY statsChanged)
|
||||
Q_PROPERTY(bool ready READ ready NOTIFY readyChanged)
|
||||
// 当前活动接口,用户在弹窗或设置窗口选择后持久化到 ~/.config/jnetapplet/settings.ini,
|
||||
// 下次启动自动恢复;若保存的接口已不存在则回退到自动选择
|
||||
@@ -81,7 +80,6 @@ public:
|
||||
double totalDownload() const;
|
||||
double totalUpload() const;
|
||||
QStringList networkInterfaces() const;
|
||||
QStringList interfaceStats() const;
|
||||
bool ready() const;
|
||||
QString activeInterface() const;
|
||||
QString ipAddress() const;
|
||||
@@ -104,7 +102,6 @@ signals:
|
||||
void speedChanged();
|
||||
void totalChanged();
|
||||
void interfacesChanged();
|
||||
void statsChanged();
|
||||
void readyChanged();
|
||||
void activeInterfaceChanged();
|
||||
void ipAddressChanged();
|
||||
|
||||
Reference in New Issue
Block a user