-
Notifications
You must be signed in to change notification settings - Fork 40
Fix: [resolution] Change resolution by task. #545
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: [resolution] Change resolution by task. #545
Conversation
-- Change resolution by task.
Reviewer's GuideThis PR ensures that any detected 1920x1080 resolution string is programmatically converted to 1920x1200 within both DeviceMonitor and DeviceGpu classes by inserting conditional checks and string replacements in relevant methods. Sequence diagram for resolution string conversion in DeviceMonitor and DeviceGpusequenceDiagram
participant DeviceMonitor
participant DeviceGpu
participant "Resolution String"
DeviceMonitor->>"Resolution String": Detects "1920x1080"
DeviceMonitor->>"Resolution String": Replaces "1080" with "1200"
DeviceGpu->>"Resolution String": Detects "1920x1080" in min, cur, max
DeviceGpu->>"Resolution String": Replaces "1080" with "1200"
Class diagram for updated DeviceMonitor and DeviceGpu resolution handlingclassDiagram
class DeviceMonitor {
- m_SupportResolution : QString
- m_CurrentResolution : QString
setInfoFromHwinfo(mapInfo: QMap<QString, QString>)
setInfoFromXradr(main: QString, edid: QString, xrandr: QString) : bool
setMainInfoFromXrandr(info: QString, raw: QString) : bool
}
class DeviceGpu {
- m_MinimumResolution : QString
- m_CurrentResolution : QString
- m_MaximumResolution : QString
setXrandrInfo(mapInfo: QMap<QString, QString>)
}
DeviceMonitor <|-- DeviceGpu
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes - here's some feedback:
- There's a lot of duplicated logic for detecting and replacing “1080” with “1200” across multiple methods—consider extracting this into a single helper function to keep the code DRY and easier to maintain.
- When appending resolutions to m_SupportResolution you’re always adding a trailing comma and space—trim or conditionally add separators to avoid having an extra ", " at the end of the string.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- There's a lot of duplicated logic for detecting and replacing “1080” with “1200” across multiple methods—consider extracting this into a single helper function to keep the code DRY and easier to maintain.
- When appending resolutions to m_SupportResolution you’re always adding a trailing comma and space—trim or conditionally add separators to avoid having an extra ", " at the end of the string.
## Individual Comments
### Comment 1
<location> `deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp:225-226` </location>
<code_context>
m_CurrentResolution = mapInfo["curResolution"];
m_MaximumResolution = mapInfo["maxResolution"];
+ if (m_MinimumResolution.contains("1920") && m_MinimumResolution.contains("1080")) {
+ m_MinimumResolution.replace("1080", "1200");
+ }
+ if (m_CurrentResolution.contains("1920") && m_CurrentResolution.contains("1080")) {
</code_context>
<issue_to_address>
**suggestion:** Resolution replacement logic is duplicated for multiple member variables.
Consider extracting the repeated replacement logic into a utility function to improve maintainability and reduce code duplication.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| if (m_MinimumResolution.contains("1920") && m_MinimumResolution.contains("1080")) { | ||
| m_MinimumResolution.replace("1080", "1200"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Resolution replacement logic is duplicated for multiple member variables.
Consider extracting the repeated replacement logic into a utility function to improve maintainability and reduce code duplication.
|
/forcemerge |
4a88453
into
linuxdeepin:develop/tmp-eagle
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
-- Change resolution by task.
Summary by Sourcery
Apply custom resolution mapping to convert 1920×1080 to 1920×1200 across device monitoring and GPU resolution routines
Enhancements: