-
Notifications
You must be signed in to change notification settings - Fork 141
fix: Fix the issue with link text style errors #2849
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
Conversation
Reviewer's GuideRefactors how the User Experience Program description text is generated so that link styling is correctly handled across themes, and updates the QML label configuration to render rich text with theme-aware colors while reacting to theme changes at runtime. Sequence diagram for theme change updating User Experience Program textsequenceDiagram
actor User
participant DGuiApplicationHelper
participant SystemInfoWork
participant SystemInfoModel
participant UserExperienceProgramPage
participant userExperienceLabel
User->>DGuiApplicationHelper: Change theme in system settings
DGuiApplicationHelper-->>SystemInfoWork: themeTypeChanged
SystemInfoWork->>SystemInfoWork: onThemeTypeChanged()
SystemInfoWork->>SystemInfoWork: updateUserExperienceProgramText()
SystemInfoWork->>DGuiApplicationHelper: themeType()
DGuiApplicationHelper-->>SystemInfoWork: themeType value
SystemInfoWork->>SystemInfoWork: Build themed HTML with normalColor and link style
SystemInfoWork->>SystemInfoModel: setUserExperienceProgramText(htmlText)
SystemInfoModel-->>UserExperienceProgramPage: userExperienceProgramText changed
UserExperienceProgramPage-->>userExperienceLabel: text binding updated (RichText)
userExperienceLabel->>User: Display themed text with correctly styled links
Updated class diagram for SystemInfoWork and related UI text handlingclassDiagram
class SystemInfoWork {
- SystemInfoModel* m_model
+ SystemInfoWork(SystemInfoModel* model, QObject* parent)
+ void activate()
+ void deactivate()
+ void onTimezoneChanged(QString timezone)
+ void onShortDateFormatChanged(int shortDateFormate)
+ void onLicenseAuthorizationProperty()
+ void onThemeTypeChanged()
- void getLicenseState()
- void updateUserExperienceProgramText()
+ bool isUeProgramEnabled()
}
class SystemInfoModel {
+ void setUserExperienceProgramText(QString text)
+ QString userExperienceProgramText()
}
class DGuiApplicationHelper {
- static DGuiApplicationHelper* m_instance
+ static DGuiApplicationHelper* instance()
+ int themeType()
+ void themeTypeChanged()
}
class UserExperienceProgramPage {
+ SystemInfoModel* model
+ void bindUserExperienceProgramText()
}
class DLabel {
+ int leftPadding
+ int rightPadding
+ int topPadding
+ int bottomPadding
+ QFont font
+ int horizontalAlignment
+ int wrapMode
+ int textFormat
+ int width
+ QString text
+ QString currentLinkUrl
}
SystemInfoWork --> SystemInfoModel : updates
SystemInfoWork ..> DGuiApplicationHelper : uses
UserExperienceProgramPage --> SystemInfoModel : reads
UserExperienceProgramPage --> DLabel : contains userExperienceLabel
SystemInfoModel --> DLabel : text bound via userExperienceProgramText
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:
- The hard-coded ARGB hex color values used for
normalColorinupdateUserExperienceProgramText()may not stay consistent with future theme changes or accessibility requirements; consider deriving the color from the current palette or a theme helper API instead of embedding literal values. - In
UserExperienceProgramPage.qml, bindingwidth: parent ? parent.width : implicitWidthonuserExperienceLabelcan conflict with layout/parent sizing; if this label is in a layout or container that already manages width, consider removing the explicit width binding and relying on layout/anchors to avoid potential binding loops or unexpected resizing.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The hard-coded ARGB hex color values used for `normalColor` in `updateUserExperienceProgramText()` may not stay consistent with future theme changes or accessibility requirements; consider deriving the color from the current palette or a theme helper API instead of embedding literal values.
- In `UserExperienceProgramPage.qml`, binding `width: parent ? parent.width : implicitWidth` on `userExperienceLabel` can conflict with layout/parent sizing; if this label is in a layout or container that already manages width, consider removing the explicit width binding and relying on layout/anchors to avoid potential binding loops or unexpected resizing.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: caixr23, pengfeixx The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Fix the issue with link text style errors Log: Fix the issue with link text style errors pms: BUG-320975
deepin pr auto review我来对这个diff进行代码审查:
建议改进:
private:
static constexpr const char* DARK_THEME_TEXT_COLOR = "#B3FFFFFF";
static constexpr const char* LIGHT_THEME_TEXT_COLOR = "#64000000";
if (!m_model) {
qWarning() << "SystemInfoWork: model is null in updateUserExperienceProgramText";
return;
}
width: parent ? parent.width : implicitWidth这些改进将进一步提高代码的可维护性、性能和安全性。 |
|
/forcemerge |
|
This pr force merged! (status: blocked) |
Fix the issue with link text style errors
Log: Fix the issue with link text style errors
pms: BUG-320975
Summary by Sourcery
Adjust the user experience program description to use rich text with theme-aware styling and keep it updated when the application theme changes.
Bug Fixes:
Enhancements: