-
Notifications
You must be signed in to change notification settings - Fork 143
feat: add pluginsChanged signal to reload dock tray plugins dynamically #2976
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: yixinshark The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdds a new pluginsChanged signal to the dock DBus proxy and wires it into DCC so the dock tray plugins can be reloaded dynamically when the dock reports plugin changes. Also adjusts some existing DBus connections to forward signals instead of invoking slots directly. Sequence diagram for dynamic dock tray plugin reload via pluginsChangedsequenceDiagram
participant DockService
participant DockDBusProxy
participant DccDockExport
participant DockPluginModel
DockService->>DockDBusProxy: pluginsChanged()
activate DockDBusProxy
DockDBusProxy-->>DockDBusProxy: emit pluginsChanged()
DockDBusProxy-->>DccDockExport: pluginsChanged()
deactivate DockDBusProxy
activate DccDockExport
DccDockExport->>DccDockExport: loadPluginData()
DccDockExport->>DockPluginModel: setPluginVisible(...)
deactivate DccDockExport
Sequence diagram for forwarding dock pluginVisibleChanged via DockDBusProxysequenceDiagram
participant DockService
participant DockDBusProxy
participant DccDockExport
participant DockPluginModel
DockService->>DockDBusProxy: pluginVisibleChanged(pluginName, visible)
activate DockDBusProxy
DockDBusProxy-->>DockDBusProxy: emit pluginVisibleChanged(pluginName, visible)
DockDBusProxy-->>DccDockExport: pluginVisibleChanged(pluginName, visible)
deactivate DockDBusProxy
activate DccDockExport
DccDockExport->>DockPluginModel: setPluginVisible(pluginName, visible)
deactivate DccDockExport
Updated class diagram for DockDBusProxy and DccDockExport signalsclassDiagram
class DockDBusProxy {
+DockDBusProxy(parent)
+pluginVisibleChanged(pluginName, visible) const
+showRecentChanged(changed) const
+pluginsChanged() const
-m_daemonDockInter
}
class DccDockExport {
+DccDockExport(parent)
+initDisplayModeConnection()
+initData()
+loadPluginData()
-m_dockDbusProxy
-m_pluginModel
}
class DockPluginModel {
+setPluginVisible(pluginName, visible)
}
DockDBusProxy <.. DccDockExport : uses
DccDockExport --> DockPluginModel : updates
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey - I've left some high level feedback:
- Now that
pluginVisibleChanged,showRecentChanged, and the newpluginsChangedare being used as signals (both inQDBusConnection::connectwithSIGNAL()and via&DockDBusProxy::pluginsChanged), consider moving them from thepublic Q_SLOTSsection into asignalssection (or otherwise clarifying the comment) so their intent as signals is clear and consistent with their usage.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Now that `pluginVisibleChanged`, `showRecentChanged`, and the new `pluginsChanged` are being used as signals (both in `QDBusConnection::connect` with `SIGNAL()` and via `&DockDBusProxy::pluginsChanged`), consider moving them from the `public Q_SLOTS` section into a `signals` section (or otherwise clarifying the comment) so their intent as signals is clear and consistent with their usage.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
a194a21 to
bc5d854
Compare
deepin pr auto review这段代码的修改主要是为了在插件发生变化时能够及时刷新数据。整体逻辑是正确的,但我在语法、代码质量、性能和安全性方面有以下改进建议: 1. 代码语法与规范问题:Qt 信号槽连接方式不一致
问题:信号命名风格不统一
2. 代码质量问题:缺少注释
修改后: // 在 dockdbusproxy.h 中
/**
* @brief 插件列表发生变化时触发该信号
*/
void pluginsChanged() const;3. 代码性能潜在问题:频繁触发数据加载
4. 代码安全问题:DBus 连接错误处理缺失
修改后: // 在 dockdbusproxy.cpp 中
bool connected = QDBusConnection::sessionBus().connect(
DockService, DockPath, DockInterface, "pluginsChanged",
this, &DockDBusProxy::pluginsChanged
);
if (!connected) {
qWarning() << "Failed to connect to DBus signal: pluginsChanged";
}5. 其他建议问题:信号声明位置
修改后: // 在 dockdbusproxy.h 中
signals:
void pluginVisibleChanged(const QString &pluginName, bool visible);
void showRecentChanged(bool);
void pluginsChanged();总结修改后的代码dockdbusproxy.hsignals:
void pluginVisibleChanged(const QString &pluginName, bool visible);
void showRecentChanged(bool);
void pluginsChanged(); // 插件列表发生变化时触发dockdbusproxy.cppDockDBusProxy::DockDBusProxy(QObject *parent)
: QObject(parent)
{
// ... 其他代码 ...
bool connected = QDBusConnection::sessionBus().connect(
DockService, DockPath, DockInterface, "pluginsChanged",
this, &DockDBusProxy::pluginsChanged
);
if (!connected) {
qWarning() << "Failed to connect to DBus signal: pluginsChanged";
}
// ... 其他代码 ...
}dccdockexport.cppDccDockExport::DccDockExport(QObject *parent)
: QObject(parent)
{
// ... 其他代码 ...
connect(m_dockDbusProxy, &DockDBusProxy::pluginsChanged,
this, &DccDockExport::loadPluginData);
// ... 其他代码 ...
}这些修改可以提高代码的可读性、健壮性和安全性。 |
dock add pluginsChanged signal first, then add this function to dcc. Log: add pluginsChanged signal to reload dock tray plugins dynamically Pms: BUG-311317
bc5d854 to
aa0a77e
Compare
dock add pluginsChanged signal first, then add this function to dcc.
Log: add pluginsChanged signal to reload dock tray plugins dynamically
Pms: BUG-311317
Summary by Sourcery
Propagate new dock D-Bus signals and respond to plugin changes in the DCC dock export to keep tray plugins in sync dynamically.
New Features:
Bug Fixes: