Skip to content

fix: Handle display configuration for specific device models#513

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:develop/eaglefrom
add-uos:develop/eagle
Aug 13, 2025
Merged

fix: Handle display configuration for specific device models#513
deepin-bot[bot] merged 1 commit into
linuxdeepin:develop/eaglefrom
add-uos:develop/eagle

Conversation

@add-uos
Copy link
Copy Markdown
Contributor

@add-uos add-uos commented Aug 13, 2025

Implemented information masking for certain display configurations on special hardware models.

Log: Add display info filtering for special devices
Bug: https://pms.uniontech.com/bug-view-328971.html
Change-Id: Ie2826605b25bdb1ef1c4956bd6856af95284b108

Summary by Sourcery

Filter out monitor information on special hardware models to prevent its display and resizing issues, and add corresponding translation.

Bug Fixes:

  • Hide the device table for the "Monitor" label on special hardware models similar to storage and memory
  • Exclude the "Monitor" label from table resizing logic when specialComType is positive

Documentation:

  • Add Chinese translation for the "Monitor" label

Implemented information masking for certain display configurations on
special hardware models.

Log: Add display info filtering for special devices
Bug: https://pms.uniontech.com/bug-view-328971.html
Change-Id: Ie2826605b25bdb1ef1c4956bd6856af95284b108
@deepin-ci-robot
Copy link
Copy Markdown

deepin pr auto review

代码审查意见:

  1. 代码重复

    • PageMultiInfo::updateInfoPageMultiInfo::resizeEvent方法中,if语句的条件判断存在重复,可以提取成一个公共函数来减少代码重复。
  2. 翻译问题

    • deepin-devicemanager_zh_CN.ts文件中,新增的Monitor翻译为“显示设备”,需要确认是否与实际业务逻辑相符。
  3. 代码可读性

    • PageMultiInfo::updateInfoPageMultiInfo::resizeEvent方法中,mp_Table->setVisible(false);mp_Table->setFixedHeight(0);的顺序可以调整,先设置可见性再调整高度,以提高代码的可读性。
  4. 资源管理

    • 确保在PageMultiInfo类中,所有动态分配的资源(如QList<DeviceBaseInfo *>等)在使用完毕后正确释放,以避免内存泄漏。
  5. 错误处理

    • PageMultiInfo::updateInfoPageMultiInfo::resizeEvent方法中,当mp_Label->text()不匹配任何预期值时,应该有相应的错误处理或日志记录,以便于调试和问题追踪。
  6. 国际化

    • 确保所有字符串资源(如tr("Storage")等)在使用前已经正确加载,避免在运行时出现字符串未翻译的情况。
  7. 注释和文档

    • PageMultiInfo::updateInfoPageMultiInfo::resizeEvent方法中,添加必要的注释说明每个if语句的意图和作用,以提高代码的可维护性。

综上所述,代码在重复性、翻译、可读性、资源管理、错误处理、国际化以及注释等方面存在改进空间。

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Aug 13, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Extended the special device handling logic to mask display configurations labeled “Monitor” similarly to “Storage” and “Memory” by updating visibility and resizing conditions in PageMultiInfo, and added the corresponding translation entry for Chinese locale.

Sequence diagram for display info masking on special devices

sequenceDiagram
    participant PageMultiInfo
    participant mp_Label
    participant mp_Table
    participant Common
    Note over PageMultiInfo: updateInfo called
    PageMultiInfo->Common: Check specialComType
    alt specialComType >= 1 and label is Storage/Memory/Monitor
        PageMultiInfo->mp_Table: setVisible(false)
        PageMultiInfo->mp_Table: setFixedHeight(0)
    else
        PageMultiInfo->mp_Table: updateTable(...)
    end
Loading

Entity relationship diagram for translation entries update

erDiagram
    TRANSLATION {
        id
        source
        translation
        location
    }
    TRANSLATION ||--|| PAGE_MULTI_INFO : references
    PAGE_MULTI_INFO {
        line_number
        label
    }
Loading

Class diagram for updated PageMultiInfo masking logic

classDiagram
    class PageMultiInfo {
        +updateInfo(QList<DeviceBaseInfo *>)
        +resizeEvent(QResizeEvent *)
        -mp_Label: QLabel
        -mp_Table: TableWidget
        -m_deviceList
        -m_menuControlList
    }
    class Common {
        +specialComType: int
    }
    PageMultiInfo --> Common: uses
    PageMultiInfo --> mp_Label: checks text
    PageMultiInfo --> mp_Table: controls visibility and size
Loading

File-Level Changes

Change Details Files
Extend specialComType-based filtering to include “Monitor”
  • Include tr("Monitor") in updateInfo visibility check
  • Add tr("Monitor") to both resizeEvent conditional branches to skip updating the table
deepin-devicemanager/src/Page/PageMultiInfo.cpp
Add Chinese translation for “Monitor”
  • Insert block for Monitor with translation “显示设备”
deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts

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

  • The repeated checks for mp_Label->text() against hardcoded labels could be extracted into a helper (e.g. an isMaskedDeviceType function or a static set) to reduce duplication and improve maintainability.
  • Consider caching mp_Label->text() in a local variable at the start of updateInfo/resizeEvent to avoid multiple calls and make the conditional logic more readable.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The repeated checks for mp_Label->text() against hardcoded labels could be extracted into a helper (e.g. an isMaskedDeviceType function or a static set) to reduce duplication and improve maintainability.
- Consider caching mp_Label->text() in a local variable at the start of updateInfo/resizeEvent to avoid multiple calls and make the conditional logic more readable.

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.

@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: add-uos, max-lvs

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

@add-uos
Copy link
Copy Markdown
Contributor Author

add-uos commented Aug 13, 2025

/merge

@deepin-bot
Copy link
Copy Markdown
Contributor

deepin-bot Bot commented Aug 13, 2025

This pr cannot be merged! (status: unstable)

@add-uos
Copy link
Copy Markdown
Contributor Author

add-uos commented Aug 13, 2025

/forcemerge

@deepin-bot
Copy link
Copy Markdown
Contributor

deepin-bot Bot commented Aug 13, 2025

This pr force merged! (status: unstable)

@deepin-bot deepin-bot Bot merged commit 71f38f8 into linuxdeepin:develop/eagle Aug 13, 2025
17 of 18 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