feat: improve PageMultiInfo CPU header info display and device genera…#634
Merged
deepin-bot[bot] merged 1 commit intolinuxdeepin:develop/eagle-20260325from Apr 1, 2026
Conversation
Reviewer's GuideAdds a CPU-specific header info scroll area to PageMultiInfo and computes CPU header metadata during device generation so the CPU page can display rich, scrollable summary information while keeping layout and visibility behavior consistent with other pages. Sequence diagram for CPU header info generation and displaysequenceDiagram
participant DeviceGenerator
participant DeviceManager
participant PageMultiInfo
participant DeviceCpu
participant HeaderInfoTableWidget
DeviceGenerator->>DeviceGenerator: generatorCpuDevice()
loop For_each_cpu_in_lsCpu
DeviceGenerator->>DeviceManager: addCpuDevice(device)
end
alt At_least_one_cpu
DeviceGenerator->>DeviceGenerator: calAndSetCpuHeaderInfo(firstProcessorInfo, coreNum, logicalNum)
DeviceGenerator->>DeviceManager: setCpuHeaderInfo(cpuHeaderInfo)
end
PageMultiInfo->>PageMultiInfo: updateInfo(lst)
PageMultiInfo->>DeviceCpu: dynamic_cast from lst.at(0)
alt Is_cpu_page
PageMultiInfo->>DeviceManager: getCpuHeaderInfo(headerInfo)
PageMultiInfo->>PageMultiInfo: clearLayout(mp_HeaderInfoWidgetLay)
loop For_each_headerInfo_group
PageMultiInfo->>HeaderInfoTableWidget: new HeaderInfoTableWidget(mp_HeaderInfoWidget)
PageMultiInfo->>HeaderInfoTableWidget: updateData(headerInfoGroup)
PageMultiInfo->>PageMultiInfo: mp_HeaderInfoWidgetLay->addWidget(headerWidget)
end
PageMultiInfo->>PageMultiInfo: configure mp_HeaderInfoWidget (height, resize, visible true)
else Not_cpu_page
PageMultiInfo->>PageMultiInfo: mp_HeaderInfoWidget->setVisible(false)
PageMultiInfo->>PageMultiInfo: mp_HeaderInfoWidget->setMaximumHeight(0)
end
Updated class diagram for CPU header info flowclassDiagram
class DeviceGenerator {
+generatorCpuDevice() void
-calAndSetCpuHeaderInfo(firstProcessorInfo QMap~QString_QString~, coreNum int, logicalNum int) void
-m_ListBusID QStringList
}
class DeviceManager {
+instance() DeviceManager*
+addCpuDevice(device DeviceBaseInfo*) void
+setCpuHeaderInfo(cpuHeaderInfo QList~QList~QPair~QString_QString~~~~) void
+getCpuHeaderInfo(headerInfo QList~QList~QPair~QString_QString~~~~&) void
}
class PageMultiInfo {
+PageMultiInfo(parent QWidget*)
+~PageMultiInfo()
+updateInfo(lst QList~DeviceBaseInfo*~&) void
+initWidgets() void
-clearLayout(layout QLayout*) void
-mp_Label DLabel*
-mp_HeaderInfoWidget DScrollArea*
-mp_HeaderInfoContainer DWidget*
-mp_HeaderInfoWidgetLay QVBoxLayout*
-mp_Table PageTableHeader*
-mp_Detail PageDetail*
-m_lstDevice QList~DeviceBaseInfo*~
-m_deviceList QList~QStringList~
-m_menuControlList QList~QStringList~
}
class DeviceBaseInfo {
<<abstract>>
}
class DeviceCpu {
}
class HeaderInfoTableWidget {
+HeaderInfoTableWidget(parent QWidget*)
+updateData(data QList~QPair~QString_QString~~&) void
}
class PageTableHeader {
}
class PageDetail {
}
class DScrollArea {
}
class DWidget {
}
class DLabel {
}
class QVBoxLayout {
}
class QLayout {
}
DeviceGenerator --> DeviceManager : uses
DeviceGenerator ..> DeviceBaseInfo : creates
DeviceGenerator ..> DeviceCpu
PageMultiInfo --> DScrollArea : composition
PageMultiInfo --> DWidget : composition
PageMultiInfo --> QVBoxLayout : composition
PageMultiInfo --> PageTableHeader : composition
PageMultiInfo --> PageDetail : composition
PageMultiInfo --> DLabel : composition
PageMultiInfo ..> DeviceCpu : dynamic_cast
PageMultiInfo ..> DeviceManager : getCpuHeaderInfo
PageMultiInfo ..> HeaderInfoTableWidget : creates
DeviceCpu --|> DeviceBaseInfo
QVBoxLayout --|> QLayout
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The
clearLayouthelper is declared as a slot and only clears direct widgets (ignores nested sub-layouts); consider making it a private non-slot utility and handlingitem->layout()recursively to avoid leaking or orphaning nested layout content if the container ever becomes more complex. - In
calAndSetCpuHeaderInfo, the thread count calculationlogicalNum / coreNumwith a fallback of2whencoreNum == 0may produce misleading values (e.g., whenlogicalNumis 0 or inconsistent); it would be safer to explicitly guard against invalid or zero values and choose a neutral default such as 1 or an empty field instead of hardcoding 2.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `clearLayout` helper is declared as a slot and only clears direct widgets (ignores nested sub-layouts); consider making it a private non-slot utility and handling `item->layout()` recursively to avoid leaking or orphaning nested layout content if the container ever becomes more complex.
- In `calAndSetCpuHeaderInfo`, the thread count calculation `logicalNum / coreNum` with a fallback of `2` when `coreNum == 0` may produce misleading values (e.g., when `logicalNum` is 0 or inconsistent); it would be safer to explicitly guard against invalid or zero values and choose a neutral default such as 1 or an empty field instead of hardcoding 2.
## Individual Comments
### Comment 1
<location path="deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp" line_range="1298-1307" />
<code_context>
+ QPair<QString, QString> totalL1dCache(tr("L1i cache"), strTotalL1iCache);
</code_context>
<issue_to_address>
**nitpick:** Using the same variable name totalL1dCache for different cache levels reduces readability and is error-prone.
Please rename each variable to reflect its specific cache level (e.g. totalL1iCache, totalL2Cache, totalL3Cache) so the logic is self‑documenting and less prone to copy‑paste errors.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
4d78d2c to
e94a488
Compare
…tion - Update PageMultiInfo to use scroll area container layout for CPU header detail widgets - Add/adjust accessor usage for header info in CPU page - Refactor scroll area content resizing and visibility behavior - Update DeviceGenerator logic and declarations (internal feature updates) - Keep UI behavior consistent with latest header info widget layout Log: add feature for cpu info show. Task: https://pms.uniontech.com/task-view-387697.html
e94a488 to
6c51615
Compare
max-lvs
approved these changes
Apr 1, 2026
|
[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 |
Contributor
Author
|
/forcemerge |
Contributor
|
This pr force merged! (status: unstable) |
37f5c80
into
linuxdeepin:develop/eagle-20260325
20 of 22 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…tion
Log: add feature for cpu info show.
Task: https://pms.uniontech.com/task-view-387697.html
Summary by Sourcery
Add a scrollable CPU header information section to the multi-info page and populate it using computed CPU summary data from the device generator.
New Features:
Enhancements: