Skip to content

fix: unify resolution display format to use ASCII 'x'#639

Merged
wyu71 merged 1 commit into
linuxdeepin:masterfrom
wyu71:master
Apr 9, 2026
Merged

fix: unify resolution display format to use ASCII 'x'#639
wyu71 merged 1 commit into
linuxdeepin:masterfrom
wyu71:master

Conversation

@wyu71
Copy link
Copy Markdown
Contributor

@wyu71 wyu71 commented Apr 9, 2026

Remove Unicode multiplication sign replacement and extra spaces from resolution strings, standardizing to plain 'WxH' format across all display adapter resolution fields.

统一显示适配器分辨率格式,移除 Unicode 乘号和多余空格,
全部使用 ASCII 'x' 格式(如 1920x1080)。

Log: 统一分辨率显示格式为 ASCII x
PMS: BUG-351831
Influence: 显示适配器的当前分辨率、最小分辨率、最大分辨率显示格式统一,不再出现格式不一致的情况。

Summary by Sourcery

Standardize display adapter resolution strings to a consistent ASCII-based format.

Bug Fixes:

  • Normalize current, minimum, and maximum resolution strings to remove Unicode multiplication signs and extra spaces, preventing inconsistent resolution display formats across the UI.

Enhancements:

  • Simplify construction of current resolution strings by avoiding unnecessary QString formatting helpers while keeping content unchanged.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Apr 9, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Standardizes all displayed resolution strings to a consistent ASCII 'WxH' format without spaces or Unicode multiplication signs, and adjusts how current resolution with refresh rate is constructed from xrandr output.

Flow diagram for resolution string normalization to ASCII WxH

flowchart LR
  A[Raw xrandr output line
  e.g. 1920 x 1080] --> B[Regex capture
  width x height groups]
  B --> C[Remove spaces
  1920x1080]
  C --> D[Assign to minResolution
  curResolution
  maxResolution]

  subgraph DeviceMonitor_current_resolution
    E[Match resolution and refresh rate
    e.g. 1920x1080 60.00] --> F[Compute curRate string]
    F --> G[Build current_resolution_without_unicode
    1920x1080@60.00]
  end

  subgraph ThreadExecXrandr_dbus_values
    H[Read maxResolutionWidth
    maxResolutionHeight
    minResolutionWidth
    minResolutionHeight] --> I[Format as %1x%2]
    I --> J[Store maxResolution
    minResolution as WxH]
  end

  D --> K[UI components display
  resolutions as ASCII WxH]
  G --> K
  J --> K
Loading

File-Level Changes

Change Details Files
Normalize current resolution strings from xrandr parsing to use raw captured resolution and plain string concatenation instead of Unicode replacement.
  • Stop replacing 'x' with the Unicode multiplication sign when setting m_CurrentResolution in setInfoFromXradr.
  • Build current resolution with refresh rate using direct string concatenation instead of QString::arg formatting.
  • Ensure resolutions without refresh rate are stored exactly as captured from the regex match.
deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp
Unify min/current/max resolution formatting from xrandr and D-Bus to compact 'WxH' ASCII format without spaces or Unicode characters.
  • When parsing xrandr output, strip spaces from min, current, and max resolution strings, and stop converting 'x' to a Unicode multiplication sign for current resolution.
  • When building min/max resolutions from D-Bus width/height values, format them as '%1x%2' with no spaces around 'x'.
deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp

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:

  • The formatting around the refresh rate is inconsistent: m_CurrentResolution = match.captured(1) + "@" + curRate; vs match.captured(1) + " @" + curRate; — consider standardizing on one exact WxH@rate format without spaces as described in the PR.
  • Resolution normalization logic (removing spaces, unifying x, appending @rate) is spread across several call sites; consider extracting a small helper to format resolutions in one place so future changes to the display format stay consistent.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The formatting around the refresh rate is inconsistent: `m_CurrentResolution = match.captured(1) + "@" + curRate;` vs `match.captured(1) + " @" + curRate;` — consider standardizing on one exact `WxH@rate` format without spaces as described in the PR.
- Resolution normalization logic (removing spaces, unifying `x`, appending `@rate`) is spread across several call sites; consider extracting a small helper to format resolutions in one place so future changes to the display format stay consistent.

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.

Remove Unicode multiplication sign replacement and extra spaces
from resolution strings, standardizing to plain 'WxH' format across
all display adapter resolution fields.

统一显示适配器分辨率格式,移除 Unicode 乘号和多余空格,
全部使用 ASCII 'x' 格式(如 1920x1080)。

Log: 统一分辨率显示格式为 ASCII x
PMS: BUG-351831
Influence: 显示适配器的当前分辨率、最小分辨率、最大分辨率显示格式统一,不再出现格式不一致的情况。
@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: lzwind, wyu71

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

@wyu71 wyu71 merged commit 31b2fbb into linuxdeepin:master Apr 9, 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