Skip to content

feat: export visible status for notification#1102

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
18202781743:master
Apr 17, 2025
Merged

feat: export visible status for notification#1102
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
18202781743:master

Conversation

@18202781743
Copy link
Copy Markdown
Contributor

@18202781743 18202781743 commented Apr 17, 2025

it's useful for dde-tray-loader of notification.

pms: BUG-294163

Summary by Sourcery

Export the visible status of the notification center as a DBus signal to allow external components to track its visibility state

New Features:

  • Add a VisibleChanged signal to expose the notification center's visibility status via DBus

Enhancements:

  • Implement a signal connection to propagate the notification center panel's visibility changes

it's useful for dde-tray-loader of notification.

pms: BUG-294163
@deepin-ci-robot
Copy link
Copy Markdown

deepin pr auto review

代码审查意见:

  1. notificationcenterdbusadaptor.h文件中,新增的VisibleChanged信号应该有注释说明其用途和触发条件,以便其他开发者理解其作用。

  2. notificationcenterproxy.cpp文件中,使用lambda表达式连接信号和槽时,可以考虑使用Qt::QueuedConnection来确保信号在事件循环中排队处理,避免潜在的竞态条件。

  3. notificationcenterproxy.cpp文件中,connect函数的lambda表达式可以简化,直接使用this指针作为上下文对象,不需要显式地传递this

  4. notificationcenterproxy.h文件中,signals关键字应该使用全小写,以保持与其他Qt信号定义的一致性。

  5. 确保在notificationcenterproxy.cpp文件中,panel()函数返回的指针在使用前已经进行了空指针检查,以避免潜在的空指针解引用问题。

  6. 考虑在notificationcenterproxy.h文件中,将signals部分移动到public关键字下方,以保持与其他成员函数的一致性。

  7. notificationcenterproxy.cpp文件中,connect函数的lambda表达式可以简化为:

    connect(panel(), &NotificationCenterPanel::visibleChanged, this, &NotificationCenterProxy::VisibleChanged);

    这样可以更清晰地表达出信号和槽的连接关系。

综上所述,代码的改进点主要集中在代码的可读性、安全性以及一致性上。通过这些改进,可以提高代码的质量和可维护性。

Copy link
Copy Markdown

@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 @18202781743 - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding a comment explaining why the signal is needed.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 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.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Apr 17, 2025

Reviewer's Guide by Sourcery

This pull request introduces a VisibleChanged signal to the notification center, allowing external components to track its visibility status. This is achieved by adding the signal to both the NotificationCenterDBusAdaptor and NotificationCenterProxy classes, and connecting the panel's visibility changes to the proxy's signal.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Expose a VisibleChanged signal to indicate the notification center's visibility status.
  • Added a VisibleChanged signal to NotificationCenterDBusAdaptor.
  • Added a VisibleChanged signal to NotificationCenterProxy.
  • Connected the panel's visibleChanged signal to the proxy's VisibleChanged signal.
panels/notification/center/notificationcenterdbusadaptor.h
panels/notification/center/notificationcenterproxy.cpp
panels/notification/center/notificationcenterproxy.h

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!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

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

@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, yixinshark

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

@18202781743
Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot
Copy link
Copy Markdown

deepin-bot Bot commented Apr 17, 2025

This pr force merged! (status: blocked)

@deepin-bot deepin-bot Bot merged commit 3775c14 into linuxdeepin:master Apr 17, 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