Skip to content

Feat: Add group setting to show screen size.#631

Merged
deepin-bot[bot] merged 1 commit intolinuxdeepin:develop/eaglefrom
GongHeng2017:202603311033-dev-eagle-fix
Mar 31, 2026
Merged

Feat: Add group setting to show screen size.#631
deepin-bot[bot] merged 1 commit intolinuxdeepin:develop/eaglefrom
GongHeng2017:202603311033-dev-eagle-fix

Conversation

@GongHeng2017
Copy link
Copy Markdown
Contributor

@GongHeng2017 GongHeng2017 commented Mar 31, 2026

-- Add group setting to show screen size.

Log: add feature
Task: https://pms.uniontech.com/task-view-387965.html

Summary by Sourcery

Introduce a configurable screen size display behavior for device monitor information, centralizing the setting in a common helper.

Enhancements:

  • Centralize the showScreenSize configuration lookup into a new Common::isShowScreenSize() utility used across the device manager.
  • Adjust monitor overview and other device info to conditionally include screen size and name based on the shared visibility setting and special device types.

-- Add group setting to show screen size.

Log: add feature
Task: https://pms.uniontech.com/task-view-387965.html
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Mar 31, 2026

Reviewer's Guide

Refactors how the Device Manager decides whether and how to display monitor screen size by centralizing the DConfig-backed setting into a new Common::isShowScreenSize() helper and applying it consistently to both the overview text and the detailed device info list.

Sequence diagram for loading monitor info with screen size setting

sequenceDiagram
    actor User
    participant DeviceManagerUI
    participant DeviceMonitor
    participant Common
    participant DConfig

    User->>DeviceManagerUI: openDeviceManager
    DeviceManagerUI->>DeviceMonitor: loadOtherDeviceInfo
    DeviceMonitor->>Common: isShowScreenSize
    Common->>DConfig: create(org.deepin.devicemanager)
    DConfig-->>Common: showScreenSize_value
    Common-->>DeviceMonitor: showScreenSize_flag
    alt showScreenSize_flag_is_true
        DeviceMonitor->>DeviceMonitor: addOtherDeviceInfo(Size, m_ScreenSize)
    else showScreenSize_flag_is_false
        DeviceMonitor->>DeviceMonitor: skip_adding_Size_info
    end
    DeviceMonitor->>DeviceManagerUI: other_device_info_list
    DeviceManagerUI-->>User: display_monitor_details
Loading

Updated class diagram for Common and DeviceMonitor screen size logic

classDiagram
    class Common {
        +static bool isShowScreenSize()
        +static QByteArray executeClientCmd(QString cmd, QStringList args, QString workPath, int msecsWaiting)
    }

    class DeviceMonitor {
        +QString getOverviewInfo()
        +void loadOtherDeviceInfo()
        +void addOtherDeviceInfo(QString key, QString value)
    }

    DeviceMonitor ..> Common : calls
    Common ..> DConfig : uses_screen_size_config
Loading

File-Level Changes

Change Details Files
Centralize the 'show screen size' configuration lookup and reuse it in device overview and details rendering.
  • Remove direct DConfig usage from DeviceMonitor and instead query a new Common::isShowScreenSize() helper
  • Update getOverviewInfo() to conditionally include screen size and/or name based on both the new setting and existing specialComType rules
  • Update loadOtherDeviceInfo() to only add the "Size" field when the new Common::isShowScreenSize() helper returns true
deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp
Introduce a reusable Common::isShowScreenSize() helper to encapsulate the DConfig access for the screen size visibility setting.
  • Add Common::isShowScreenSize() declaration to commonfunction.h
  • Implement Common::isShowScreenSize() in commonfunction.cpp, reading the 'showScreenSize' key from org.deepin.devicemanager DConfig with a default of true
deepin-devicemanager/src/commonfunction.cpp
deepin-devicemanager/src/commonfunction.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!

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 - I've left some high level feedback:

  • In Common::isShowScreenSize(), the DConfig::create(...) result is never destroyed, which can cause a leak; consider wrapping it in a smart pointer (e.g., QScopedPointer) or otherwise ensuring it is deleted after use.
  • Common::isShowScreenSize() reads DConfig on every call, which may be unnecessarily expensive for a simple flag; consider caching the value (with optional invalidation) so it’s only read once or infrequently.
  • The DeviceMonitor::getOverviewInfo() logic now has nested if (Common::isShowScreenSize()) and repeated checks for the same specialComType set; consider simplifying the branching to avoid duplication and make the formatting rules easier to follow.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `Common::isShowScreenSize()`, the `DConfig::create(...)` result is never destroyed, which can cause a leak; consider wrapping it in a smart pointer (e.g., `QScopedPointer`) or otherwise ensuring it is deleted after use.
- `Common::isShowScreenSize()` reads DConfig on every call, which may be unnecessarily expensive for a simple flag; consider caching the value (with optional invalidation) so it’s only read once or infrequently.
- The `DeviceMonitor::getOverviewInfo()` logic now has nested `if (Common::isShowScreenSize())` and repeated checks for the same `specialComType` set; consider simplifying the branching to avoid duplication and make the formatting rules easier to follow.

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: GongHeng2017, 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

@GongHeng2017
Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot
Copy link
Copy Markdown
Contributor

deepin-bot bot commented Mar 31, 2026

This pr force merged! (status: unstable)

@deepin-bot deepin-bot bot merged commit 412225e into linuxdeepin:develop/eagle Mar 31, 2026
20 of 22 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