Skip to content

Conversation

@wjyrich
Copy link
Contributor

@wjyrich wjyrich commented Jun 4, 2025

add dbus for control-center
add lock interface.

Log:

Summary by Sourcery

Add a lock feature for the dock to prevent height changes by introducing a new "locked" boolean property exposed over DBus, persisted in settings, and controllable via the UI

New Features:

  • Expose a read/write "Locked" property and "LockedChanged" signal in the Dock DBus interface
  • Add a "Lock the Dock" menu item in QML to toggle the locked state
  • Prevent resizing and dragging of the dock in QML when locked

Enhancements:

  • Persist the locked state in DockSettings and emit change signals
  • Propagate locked changes through DockPanel and DockDBusProxy to update UI and DBus clients

add dbus for control-center
add lock interface.

Log:
@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: wjyrich

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deepin-ci-robot
Copy link

deepin pr auto review

代码审查意见:

  1. 代码重复:在org.deepin.ds.dock.xmlorg.deepin.dde.daemon.Dock1.xml文件中,Locked属性的添加是重复的,建议检查是否有遗漏的修改。

  2. 信号和槽的命名一致性:在DockPanelDockSettings类中,lockedChanged信号和槽的命名不一致,建议统一命名,如lockedStateChanged

  3. 锁状态检查:在DockPanelonPositionChanged槽函数中,应该检查Panel.locked的状态,如果为true,则不执行拖动逻辑。

  4. 注释缺失:在DockDBusProxyDockPanel类中新增的locked属性和方法的实现缺少注释说明其用途和功能。

  5. 信号发射时机:在DockSettingssetLocked方法中,当m_locked的值发生变化时,应该发射lockedChanged信号,以确保所有监听该信号的客户端都能及时更新状态。

  6. 权限和可见性:在org.deepin.ds.dock.json文件中,Locked属性的permissionsvisibility应该与实际需求保持一致,确保只有授权用户可以修改该属性。

  7. 代码风格:在DockSettingsinit方法中,m_dockConfig->value(keyLocked).toBool()的调用应该使用m_dockConfig->value(keyLocked).toBool(),而不是m_dockConfig->value(keyLocked).toBool(),以保持代码风格的一致性。

  8. 资源管理:在DockSettingsinit方法中,m_dockConfig的初始化应该使用std::make_unique,以确保资源管理的正确性。

  9. 信号发射顺序:在DockSettingssetLocked方法中,应该先发射lockedChanged信号,然后再更新m_locked的值,以确保信号发射的顺序与逻辑一致。

  10. 文档更新:如果Locked属性和相关的信号/槽函数是新增功能,应该在相应的文档中更新说明,以便其他开发者了解和使用这些新功能。

@sourcery-ai
Copy link

sourcery-ai bot commented Jun 4, 2025

Reviewer's Guide

Introduces a new “Locked” property throughout the Dock: it’s exposed over DBus, persisted in settings, propagated to the panel and proxy, and wired into the QML UI to disable dragging/resizing and add a lock menu item.

File-Level Changes

Change Details Files
Exposed Locked over DBus
  • Added “Locked” Q_PROPERTY and LockedChanged signal in generated adaptors
  • Implemented locked()/setLocked() methods in Dock1Adaptor.cpp
  • Updated XML API files to declare the Locked property and signal
toolGenerate/qdbusxml2cpp/org.deepin.dde.daemon.Dock1Adaptor.h
toolGenerate/qdbusxml2cpp/org.deepin.dde.daemon.Dock1Adaptor.cpp
panels/dock/api/old/org.deepin.dde.daemon.Dock1.xml
panels/dock/api/dbus/org.deepin.ds.dock.xml
panels/dock/api/old/org.deepin.dde.dock1.xml
Persisted lock state in settings
  • Added keyLocked constant and m_locked field
  • Loaded/saved m_locked in init() and setLocked()
  • Emitted lockedChanged on config updates
panels/dock/docksettings.h
panels/dock/docksettings.cpp
Propagated lock state to panel and proxy
  • Added locked Q_PROPERTY, getter/setter and lockedChanged signal in DockPanel
  • Connected settings.lockedChanged to both DockPanel and DBus adaptor
  • Added locked()/setLocked() in DockDBusProxy
panels/dock/dockpanel.h
panels/dock/dockpanel.cpp
panels/dock/dockdbusproxy.h
panels/dock/dockdbusproxy.cpp
Integrated locking into QML UI
  • Added “Lock the Dock” menu item bound to Panel.locked
  • Blocked drag/resize handlers when locked
  • Switched cursor to arrow when locked
panels/dock/package/main.qml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @wjyrich - I've reviewed your changes - here's some feedback:

  • The manual edits in the qdbusxml2cpp adaptor files risk being overwritten on regeneration—consider wrapping them in HAND-EDIT markers or extending the generator instead.
  • In DockSettings::init(), the fallback branch doesn’t initialize m_locked or emit lockedChanged—ensure you handle the new Locked property there as well.
  • Consider toggling the QML menu item text between "Lock Dock" and "Unlock Dock" based on Panel.locked to make the action clearer.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +310 to +312
m_locked = newLocked;
m_dockConfig->setValue(keyLocked, m_locked);
Q_EMIT lockedChanged(m_locked);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Batch config writes via WriteJob instead of immediate setValue

Use addWriteJob(WriteJob::Locked) and rely on checkWriteJob() to handle the write, ensuring consistency with other setters.

Suggested change
m_locked = newLocked;
m_dockConfig->setValue(keyLocked, m_locked);
Q_EMIT lockedChanged(m_locked);
m_locked = newLocked;
addWriteJob(WriteJob::Locked);
Q_EMIT lockedChanged(m_locked);

@wjyrich
Copy link
Contributor Author

wjyrich commented Jun 4, 2025

/forcemerge

@deepin-bot
Copy link

deepin-bot bot commented Jun 4, 2025

This pr force merged! (status: blocked)

@deepin-bot deepin-bot bot merged commit 85e06cf into linuxdeepin:master Jun 4, 2025
7 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants