feat: About 窗口版本号改为项目统一版本,仓库地址增加一键复制按钮

This commit is contained in:
2026-07-19 19:13:13 +08:00
parent 6b2721c821
commit fcb43fe34f
4 changed files with 110 additions and 2 deletions
+9
View File
@@ -116,6 +116,15 @@ QString NetworkMonitorApplet::ipv6Address() const
return m_ipv6Address;
}
// 返回插件版本号,从 dde-shell 插件元数据(metadata.json)读取
// 版本唯一源为 CMakeLists.txt 的 project(VERSION),经 configure_file 写入 metadata.json,
// dde-shell 加载时存入 DPluginMetaData,此处通过继承自 DApplet 的 pluginMetaData() 读取
QString NetworkMonitorApplet::version() const
{
// metadata.json 结构:{ "Plugin": { "Version": "x.y.z", ... } }
return pluginMetaData().value("Plugin").toMap().value("Version").toString();
}
void NetworkMonitorApplet::refresh()
{
readNetworkStats();
+4
View File
@@ -42,6 +42,8 @@ class NetworkMonitorApplet : public DApplet
Q_PROPERTY(QString ipAddress READ ipAddress NOTIFY ipAddressChanged)
// 活动接口的 IPv6 全球地址(已过滤 link-local 和 loopback),供 QML 显示
Q_PROPERTY(QString ipv6Address READ ipv6Address NOTIFY ipv6AddressChanged)
// 插件版本号,从 dde-shell 元数据读取,版本唯一源为 CMakeLists.txt project(VERSION)
Q_PROPERTY(QString version READ version CONSTANT)
public:
explicit NetworkMonitorApplet(QObject *parent = nullptr);
@@ -60,6 +62,8 @@ public:
QString activeInterface() const;
QString ipAddress() const;
QString ipv6Address() const;
// 返回插件版本号,从 dde-shell 插件元数据(metadata.json)读取
QString version() const;
Q_INVOKABLE void refresh();
Q_INVOKABLE void setActiveInterface(const QString &interface);