Skip to content

Fix: The screen size show error.#629

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

Fix: The screen size show error.#629
deepin-bot[bot] merged 1 commit intolinuxdeepin:develop/eaglefrom
GongHeng2017:202603301342-dev-eagle-fix

Conversation

@GongHeng2017
Copy link
Copy Markdown
Contributor

@GongHeng2017 GongHeng2017 commented Mar 30, 2026

-- Add Group Policy item to control whether to display screen size.

Log: fix issue
Bug: https://pms.uniontech.com/bug-view-354275.html

Summary by Sourcery

Add configurability for displaying monitor screen size information based on a group policy setting and update licensing metadata.

New Features:

  • Introduce a configuration-controlled option to toggle display of monitor screen size in the device information view.

Enhancements:

  • Integrate DConfig usage into the device monitor to read the screen size visibility setting.
  • Update SPDX copyright years for the device manager component.

-- Add Group Policy item to control whether to display screen size.

Log: fix issue
Bug: https://pms.uniontech.com/bug-view-354275.html
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Mar 30, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds a DConfig-based group policy toggle to control whether the screen size is displayed in the device manager, and gates the existing screen size display on this setting, along with a minor SPDX copyright year range update.

Sequence diagram for loading device info with DConfig-based screen size toggle

sequenceDiagram
    actor User
    participant UI_DeviceManager
    participant DeviceMonitor
    participant DConfig

    User ->> UI_DeviceManager: Open device manager
    UI_DeviceManager ->> DeviceMonitor: loadOtherDeviceInfo()
    DeviceMonitor ->> DeviceMonitor: addOtherDeviceInfo Primary_Monitor, m_MainScreen
    DeviceMonitor ->> DConfig: create(org.deepin.devicemanager, org.deepin.devicemanager)
    DConfig -->> DeviceMonitor: dconfig_instance
    DeviceMonitor ->> DConfig: isValid()
    DConfig -->> DeviceMonitor: bool
    DeviceMonitor ->> DConfig: keyList()
    DConfig -->> DeviceMonitor: keys
    DeviceMonitor ->> DConfig: value(showScreenSize)
    DConfig -->> DeviceMonitor: QVariant
    DeviceMonitor ->> DeviceMonitor: showScreenSize = toBool()
    alt showScreenSize is true
        DeviceMonitor ->> DeviceMonitor: addOtherDeviceInfo Size, m_ScreenSize
    else showScreenSize is false
        DeviceMonitor ->> DeviceMonitor: skip adding Size
    end
    DeviceMonitor ->> DeviceMonitor: addOtherDeviceInfo Serial_Number, m_SerialNumber
    DeviceMonitor ->> DeviceMonitor: mapInfoToList()
    DeviceMonitor -->> UI_DeviceManager: device info list
    UI_DeviceManager -->> User: Display device info (Size optional)
Loading

Updated class diagram for DeviceMonitor using DConfig for screen size toggle

classDiagram
    class DeviceMonitor {
        - m_MainScreen
        - m_ScreenSize
        - m_SerialNumber
        + DeviceMonitor()
        + loadOtherDeviceInfo() void
        + addOtherDeviceInfo(key, value) void
        + mapInfoToList() void
    }

    class DConfig {
        + create(appId, configName) DConfig
        + isValid() bool
        + keyList() QList
        + value(key) QVariant
    }

    DeviceMonitor ..> DConfig : uses_for_showScreenSize_policy
Loading

File-Level Changes

Change Details Files
Gate display of screen size information behind a DConfig-driven policy flag.
  • Include DConfig header and namespace to enable configuration access in DeviceMonitor
  • Introduce a local showScreenSize flag defaulting to true in loadOtherDeviceInfo
  • Under DTKCORE_CLASS_DConfigFile, create and validate a DConfig instance for org.deepin.devicemanager
  • Read the showScreenSize key when present and use its boolean value to update the showScreenSize flag
  • Conditionally call addOtherDeviceInfo for Size only when showScreenSize is true
deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp
Update SPDX copyright notice metadata.
  • Extend the SPDX-FileCopyrightText year range to 2026
deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp
Prepare or adjust JSON config asset for DConfig usage.
  • Modify org.deepin.devicemanager.json asset file (likely to define or support the showScreenSize key)
deepin-devicemanager/assets/org.deepin.devicemanager.json

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:

  • Consider ensuring the DConfig instance created with DConfig::create is properly destroyed or parented to avoid a potential memory leak in loadOtherDeviceInfo.
  • Accessing the configuration via keyList().contains("showScreenSize") is potentially inefficient; if available in this API, prefer a direct existence check (e.g., hasKey("showScreenSize")) or handle absence via the return value.
  • The hard-coded string key "showScreenSize" is used inline; extracting it into a named constant or enum-like construct would reduce the risk of typos and make future changes easier.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider ensuring the `DConfig` instance created with `DConfig::create` is properly destroyed or parented to avoid a potential memory leak in `loadOtherDeviceInfo`.
- Accessing the configuration via `keyList().contains("showScreenSize")` is potentially inefficient; if available in this API, prefer a direct existence check (e.g., `hasKey("showScreenSize")`) or handle absence via the return value.
- The hard-coded string key "showScreenSize" is used inline; extracting it into a named constant or enum-like construct would reduce the risk of typos and make future changes easier.

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, 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 30, 2026

This pr force merged! (status: unstable)

@deepin-bot deepin-bot bot merged commit 32bdc82 into linuxdeepin:develop/eagle Mar 30, 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.

4 participants