Skip to content

feat: The newly installed app shows blue dot when it is not running.#567

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
wjyrich:fix-bug-289271-new
May 23, 2025
Merged

feat: The newly installed app shows blue dot when it is not running.#567
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
wjyrich:fix-bug-289271-new

Conversation

@wjyrich
Copy link
Copy Markdown
Contributor

@wjyrich wjyrich commented May 21, 2025

as title

PMS-BUG-289271

Summary by Sourcery

New Features:

  • Show a small blue dot badge next to apps with installedTime set but lastLaunchedTime at zero in both windowed and free-sort views and icon labels

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 21, 2025

Reviewer's Guide

Adds a blue dot indicator for newly installed but unlaunched apps by inserting a small QML Rectangle in list views and updating the IconItemDelegate to prepend a RichText dot marker.

File-Level Changes

Change Details Files
Add blue dot indicator in AppListView and FreeSortListView
  • Insert an 8×8 rounded Rectangle
  • Bind its visibility to lastLaunchedTime===0 && installedTime!==0
  • Anchor it to the item’s right edge with a rightMargin
  • Ensure proper stacking order with z-index
qml/windowed/AppListView.qml
qml/windowed/FreeSortListView.qml
Update IconItemDelegate to prefix labels with a RichText dot
  • Switch textFormat from PlainText to RichText
  • Modify text binding to prepend a font-tagged ● when lastLaunchedTime===0 && installedTime!==0
  • Preserve existing label content after the dot
qml/IconItemDelegate.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
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 @wjyrich - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 3 issues 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.

theme: ApplicationHelper.DarkType
z: 1
}
Rectangle {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: Duplicate indicator Rectangle block in multiple views

Move the duplicated 8×8 circle in AppListView and FreeSortListView into a shared QML component to avoid duplication and simplify updates.

width: 8
height: 8
radius: 4
color: "#6CA6FF"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: Hardcoded color literal

Extract this repeated hex literal into a theme or shared palette to improve maintainability and consistency.

Comment thread qml/IconItemDelegate.qml Outdated
id: iconItemLabel
text: root.text
textFormat: Text.PlainText
text: (model.lastLaunchedTime === 0 && model.installedTime !== 0 ? "<font color='#6CA6FF' size='1'>●</font>&nbsp;&nbsp;" : "") + root.text
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🚨 issue (security): Concatenating raw text into RichText risks HTML injection

Escape root.text with Qt.htmlEscape or move the indicator into its own element to prevent unescaped < or & from breaking the rich text.

Comment thread qml/IconItemDelegate.qml Outdated
text: root.text
textFormat: Text.PlainText
text: (model.lastLaunchedTime === 0 && model.installedTime !== 0 ? "<font color='#6CA6FF' size='1'>●</font>&nbsp;&nbsp;" : "") + root.text
textFormat: Text.RichText
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion (performance): Switching to RichText may impact performance and eliding

To preserve elide: Text.ElideRight, avoid embedding HTML in RichText and instead add a small Rectangle or Circle indicator next to the label.

@wjyrich wjyrich force-pushed the fix-bug-289271-new branch from a66e47a to bd87e0c Compare May 21, 2025 08:42
Comment thread qml/IconItemDelegate.qml Outdated
@wjyrich wjyrich force-pushed the fix-bug-289271-new branch from bd87e0c to 24c3ff9 Compare May 21, 2025 09:11
@deepin-ci-robot
Copy link
Copy Markdown

deepin pr auto review

代码审查意见:

  1. 代码重复

    • IconItemDelegate.qmlwindowed/AppListView.qmlwindowed/FreeSortListView.qml中,新增的Rectangle元素用于显示新安装应用的标记,代码重复。建议将这部分代码提取到一个单独的组件中,然后在需要的地方引用。
  2. 颜色硬编码

    • Rectangle元素中,颜色值"#6CA6FF"被硬编码。建议使用样式表或主题管理器来管理颜色值,以便于维护和一致性。
  3. 逻辑判断

    • IconItemDelegate.qml中,isNewlyInstalled属性用于判断应用是否为新安装。这个逻辑判断可以放在模型层,而不是在视图层。这样可以提高代码的可维护性和可测试性。
  4. 文本格式化

    • IconItemDelegate.qml中,使用RichText格式化文本时,使用了硬编码的HTML标签。建议使用QML的Text组件的font属性来控制字体大小,而不是使用HTML标签。
  5. 性能考虑

    • 如果model.lastLaunchedTimemodel.installedTime的值频繁变化,那么每次变化时都会触发视图的更新。建议在模型层进行必要的优化,以减少不必要的视图更新。
  6. 可访问性

    • 新增的Rectangle元素用于视觉提示,但没有提供相应的文本描述。建议添加accessibility属性,以便于屏幕阅读器等辅助技术能够正确解释这个元素。
  7. 代码注释

    • 新增的代码块缺少注释说明。建议添加注释,说明Rectangle元素的作用和isNewlyInstalled属性的使用场景。

综上所述,建议进行代码重构,以提高代码的可维护性、可读性和性能。

@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: BLumia, 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

@wjyrich
Copy link
Copy Markdown
Contributor Author

wjyrich commented May 23, 2025

/forcemerge

@deepin-bot
Copy link
Copy Markdown

deepin-bot Bot commented May 23, 2025

This pr force merged! (status: behind)

@deepin-bot deepin-bot Bot merged commit fcd2774 into linuxdeepin:master May 23, 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