Skip to content

Commit 8b648ac

Browse files
MyLeeJiEunmhduiy
authored andcommitted
fix: conditionally show hyperlink in acknowledgments
1. Add D.LicenseInfoProvider to check license path validity in AboutDialog 2. Only display open-source software text as hyperlink when license path is valid 3. Pass LicenseInfoProvider instance to LicenseDialog instead of license path string Log: Fix open-source software acknowledgement text to only hyperlink when license info is available fix: 根据许可路径有效性条件显示超链接 1. 在关于对话框中添加 D.LicenseInfoProvider 检查许可路径有效性 2. 仅在许可路径有效时将开源软件文本显示为超链接 3. 将 LicenseInfoProvider 实例传递给许可对话框,替代路径字符串 Log: 修复开源软件致谢文本,仅在许可信息可用时显示为超链接 PMS: BUG-361031
1 parent 08bed9b commit 8b648ac

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

qt6/src/qml/AboutDialog.qml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ DialogWindow {
3131
id: contentView
3232
width: parent.width
3333
implicitHeight: contentLayout.implicitHeight
34+
35+
D.LicenseInfoProvider {
36+
id: licensePathChecker
37+
path: control.licensePath
38+
}
39+
3440
ColumnLayout {
3541
id: contentLayout
3642
spacing: 0
@@ -138,7 +144,13 @@ DialogWindow {
138144
}
139145
Label {
140146
id: acknowledgmentsLabel
141-
text: qsTr("Sincerely appreciate the %1 used.").arg(control.__websiteLinkTemplate.arg("-").arg(qsTr("open-source software")))
147+
text: {
148+
var softwareText = qsTr("open-source software");
149+
if (licensePathChecker.valid)
150+
return qsTr("Sincerely appreciate the %1 used.").arg(control.__websiteLinkTemplate.arg("-").arg(softwareText));
151+
else
152+
return qsTr("Sincerely appreciate the %1 used.").arg(softwareText);
153+
}
142154
textFormat: Text.RichText
143155
Layout.fillWidth: true
144156
font: D.DTK.fontManager.t8
@@ -173,7 +185,7 @@ DialogWindow {
173185
id: licenseDialogLoader
174186
active: false
175187
sourceComponent: LicenseDialog {
176-
licensePath: control.licensePath
188+
licenseProvider: licensePathChecker
177189
onClosing: function (close) {
178190
licenseDialogLoader.active = false
179191
}

qt6/src/qml/LicenseDialog.qml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ DialogWindow {
1515
height: 900
1616
title: qsTr("open-source software")
1717

18-
property alias licensePath: licenseProvider.path
18+
property D.LicenseInfoProvider licenseProvider
1919

2020
header: D.DialogTitleBar {
2121
leftContent: Item {
@@ -37,10 +37,6 @@ DialogWindow {
3737
implicitWidth: control.width - control.leftPadding - control.rightPadding
3838
implicitHeight: control.height - DS.Style.dialogWindow.titleBarHeight - DS.Style.dialogWindow.contentHMargin
3939

40-
D.LicenseInfoProvider {
41-
id: licenseProvider
42-
}
43-
4440
StackView {
4541
id: stackView
4642
anchors.fill: parent

0 commit comments

Comments
 (0)