feat(DApplication): allow customizing website name/link in the about dialog - #778
Open
18202781743 wants to merge 1 commit into
Open
Conversation
…dialog DApplication::handleAboutAction() previously did not call DAboutDialog::setWebsiteName/setWebsiteLink when auto-creating the about dialog, so applications could not customize the website row and always fell back to the distribution default. This change: - Wires the existing (previously dead) applicationHomePage property to DAboutDialog::setWebsiteLink, fulfilling its documented purpose. - Adds a new applicationWebsiteName property mapped to DAboutDialog::setWebsiteName for the display name. - Adds Q_PROPERTY declarations for both properties. - Both are applied only when non-empty, preserving the default distribution-fallback behavior. Closes: DDE-211
Contributor
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743 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 |
Reviewer's GuideThe PR turns DApplication’s previously unused homepage setting into an effective about-dialog website link and adds an optional website display name, with non-empty overrides preserving distribution defaults and custom about-dialog instances unaffected. Sequence diagram for customized about dialog website settingssequenceDiagram
participant App as DApplication
participant Dialog as DAboutDialog
App->>App: handleAboutAction()
App->>Dialog: setWebsiteLink(applicationHomePage())
App->>Dialog: setWebsiteName(applicationWebsiteName())
Dialog-->>App: Display custom values or distribution defaults
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
背景
DApplication::handleAboutAction()在自动创建关于对话框时,只设置了 productName / productIcon / version / description / license / acknowledgement,未调用DAboutDialog::setWebsiteName/setWebsiteLink,导致应用无法自定义网站行,始终回退到发行版默认值。根因
DAboutDialog本身已具备setWebsiteName()/setWebsiteLink()能力,但DApplication的自动创建路径没有接线。DApplication已有applicationHomePage/setApplicationHomePage属性,文档明确写着「主要用于在关于对话框中进行展示」,但该属性从未被handleAboutAction()读取,属于遗留死 API。方案(采用 DDE Architect 推荐方案)
复用遗留的
applicationHomePage(作为 link 源),并新增applicationWebsiteName(作为展示名称):改动文件
include/widgets/dapplication.hQ_PROPERTY(QString applicationHomePage ...)(补齐元对象一致性)Q_PROPERTY(QString applicationWebsiteName ...)applicationWebsiteName()/setApplicationWebsiteName()声明src/widgets/dapplication.cppapplicationWebsiteName()/setApplicationWebsiteName()(读写d->websiteName)handleAboutAction()自动建对话框段落,设置完 acknowledgement 后、setAttribute(WA_DeleteOnClose)前,按「非空才覆盖」插入:src/widgets/private/dapplication_p.hQString websiteName;CHANGELOG.mdapplicationWebsiteName属性applicationHomePage现生效于关于对话框向后兼容
applicationWebsiteNamegetter/setter 与Q_PROPERTY,以及为applicationHomePage补Q_PROPERTY,均为源码/二进制兼容的加法(DTK6 SONAME 线内)。applicationHomePage和applicationWebsiteName时,两个if (!...isEmpty())均不触发,对话框仍显示发行版默认网站。applicationHomePage从死代码变为生效:变更方向符合其文档一直承诺的用途;唯一受影响的是「调用了setApplicationHomePage却期望它什么都不做」的极端组合,实际中几乎不存在。setAboutDialog()传入的对话框不走新逻辑。测试建议
新增用例覆盖 4 个组合:
并回归:
setAboutDialog自定义对话框不受影响关联
Summary by Sourcery
Enable applications to customize the website name and link displayed in automatically generated about dialogs while preserving default fallbacks.
New Features:
Bug Fixes:
Documentation: