Skip to content

Commit 1e63ca7

Browse files
committed
feat: add update detail expansion and fix version display
1. Added getDetailInfos() method to UpdateListModel to expose detailed update information including name, updateTime, info, link, and vulLevel 2. Modified UpdateLogHelper to always add detail info for system updates regardless of version number ending, removing the previous restriction that filtered out professional edition versions ending with '0' 3. Enhanced UpdateList.qml with expandable/collapsible detail sections showing version-specific information with proper styling and theme support 4. Added "View More" and "Collapse" buttons to toggle detail visibility for items with available detail information 5. Updated copyright years from 2024 to 2024-2026 across modified files Log: Added expandable update details view with version-specific information display Influence: 1. Test clicking "View More" button on update items with available details 2. Verify detail information displays correctly including version, release time, and description 3. Test "Collapse" button functionality to hide details 4. Verify theme compatibility (light/dark mode) for all new UI elements 5. Test that all system update versions now show details regardless of version number ending 6. Verify detail information structure and data mapping from backend model 7. Test with update items that have no detail information to ensure "View More" button is hidden feat: 添加更新详情展开功能并修复版本显示问题 1. 在 UpdateListModel 中添加 getDetailInfos() 方法,用于公开详细的更新信 息,包括名称、更新时间、信息、链接和安全级别 2. 修改 UpdateLogHelper,始终为系统更新添加详细信息,移除了之前过滤 以'0'结尾的专业版版本的限制 3. 增强 UpdateList.qml,添加可展开/折叠的详情部分,显示版本特定信息,并 支持适当的样式和主题 4. 添加"查看更多"和"收起"按钮,用于切换具有可用详细信息项目的可见性 5. 将修改文件的版权年份从 2024 更新为 2024-2026 Log: 新增可展开的更新详情视图,显示版本特定信息 Influence: 1. 测试在有可用详情的更新项目上点击"查看更多"按钮 2. 验证详细信息是否正确显示,包括版本、发布时间和描述 3. 测试"收起"按钮功能以隐藏详细信息 4. 验证所有新UI元素的主题兼容性(浅色/深色模式) 5. 测试所有系统更新版本现在都显示详细信息,无论版本号结尾如何 6. 验证从后端模型到前端的数据映射和结构 7. 测试没有详细信息的更新项目,确保"查看更多"按钮被隐藏 PMS: TASK-386255 Change-Id: I42878ce2d9bfb0777f50c16faf225a748978cde5
1 parent 7db1c24 commit 1e63ca7

49 files changed

Lines changed: 1941 additions & 1398 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/dcc-update-plugin/operation/updatelistmodel.cpp

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
1+
// SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd.
22
// SPDX-License-Identifier: GPL-3.0-or-later
33
#include "updatelistmodel.h"
44
#include <QLoggingCategory>
@@ -191,3 +191,23 @@ int UpdateListModel::getAllUpdateType() const
191191
}
192192
return updateType;
193193
}
194+
195+
QVariantList UpdateListModel::getDetailInfos(int index) const
196+
{
197+
QVariantList result;
198+
if (index >= 0 && index < m_updateLists.count()) {
199+
const auto& detailInfos = m_updateLists[index]->detailInfos();
200+
for (const auto& detail : detailInfos) {
201+
QVariantMap map;
202+
map["name"] = detail.name;
203+
map["updateTime"] = detail.updateTime;
204+
map["info"] = detail.info;
205+
map["link"] = detail.link;
206+
map["vulLevel"] = detail.vulLevel;
207+
result.append(map);
208+
}
209+
} else {
210+
qCWarning(logDccUpdatePlugin) << "Invalid index for getDetailInfos:" << index;
211+
}
212+
return result;
213+
}

src/dcc-update-plugin/operation/updatelistmodel.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
1+
// SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd.
22
// SPDX-License-Identifier: GPL-3.0-or-later
33
#ifndef UPDATELISTMODEL_H
44
#define UPDATELISTMODEL_H
@@ -62,6 +62,7 @@ class UpdateListModel : public QAbstractListModel
6262
QString downloadSize() const;
6363

6464
Q_INVOKABLE UpdateType getUpdateType(int index) const;
65+
Q_INVOKABLE QVariantList getDetailInfos(int index) const;
6566

6667
public Q_SLOTS:
6768
void refreshDownloadSize();

src/dcc-update-plugin/operation/updateloghelper.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2019 - 2023 UnionTech Software Technology Co., Ltd.
1+
// SPDX-FileCopyrightText: 2019 - 2026 UnionTech Software Technology Co., Ltd.
22
//
33
// SPDX-License-Identifier: LGPL-3.0-or-later
44

@@ -163,15 +163,11 @@ void UpdateLogHelper::handleSystemItemInfo(UpdateItemInfo *itemInfo) const
163163
itemInfo->setUpdateTime(log.publishTime);
164164
} else {
165165
DetailInfo detailInfo;
166-
const QString& systemVersion = log.showVersion;
167-
// 专业版不不在详细信息中显示维护线版本
168-
if (!systemVersion.isEmpty() && systemVersion.back() == '0') {
169-
qCDebug(logDccUpdatePlugin) << "Adding detail info for version:" << log.showVersion;
170-
detailInfo.name = log.showVersion;
171-
detailInfo.updateTime = log.publishTime;
172-
detailInfo.info = explain;
173-
itemInfo->addDetailInfo(detailInfo);
174-
}
166+
qCDebug(logDccUpdatePlugin) << "Adding detail info for version:" << log.showVersion;
167+
detailInfo.name = log.showVersion;
168+
detailInfo.updateTime = log.publishTime;
169+
detailInfo.info = explain;
170+
itemInfo->addDetailInfo(detailInfo);
175171
}
176172
}
177173
}

src/dcc-update-plugin/qml/UpdateList.qml

Lines changed: 122 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
1+
// SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd.
22
// SPDX-License-Identifier: GPL-3.0-or-later
33
import QtQuick 2.0
44
import QtQuick.Controls 2.0
@@ -39,6 +39,8 @@ Rectangle {
3939
contentFlow: true
4040
spacing: 0
4141

42+
property bool showDetails: false
43+
4244
content: RowLayout {
4345
spacing: 10
4446

@@ -60,7 +62,8 @@ Rectangle {
6062
Layout.alignment: Qt.AlignLeft
6163
text: model.title
6264
font: D.DTK.fontManager.t6
63-
color: D.DTK.themeType == D.ApplicationHelper.LightType ? Qt.rgba(0, 0, 0, 1) : Qt.rgba(1, 1, 1, 1)
65+
color: D.DTK.themeType == D.ApplicationHelper.LightType ?
66+
Qt.rgba(0, 0, 0, 1) : Qt.rgba(1, 1, 1, 1)
6467
width: 100
6568
Layout.fillWidth: true
6669
}
@@ -83,7 +86,8 @@ Rectangle {
8386
horizontalAlignment: Text.AlignLeft
8487
Layout.fillWidth: true
8588
font: D.DTK.fontManager.t8
86-
color: D.DTK.themeType == D.ApplicationHelper.LightType ? Qt.rgba(0, 0, 0, 1) : Qt.rgba(1, 1, 1, 1)
89+
color: D.DTK.themeType == D.ApplicationHelper.LightType ?
90+
Qt.rgba(0, 0, 0, 1) : Qt.rgba(1, 1, 1, 1)
8791
visible: model.version.length !== 0
8892
text: qsTr("Version:") + model.version
8993
}
@@ -94,24 +98,134 @@ Rectangle {
9498
Layout.fillWidth: true
9599
font: D.DTK.fontManager.t8
96100
text: model.explain
101+
textFormat: Text.RichText
97102
wrapMode: Text.WordWrap
98103
onLinkActivated: (link)=> {
99104
dccData.work().openUrl(link)
100-
}
105+
}
101106
}
102107

103108
RowLayout {
104109
D.Label {
105-
id: releaseTitle
106110
Layout.alignment: Qt.AlignLeft
107111
horizontalAlignment: Text.AlignLeft
108-
visible: model.releaseTime.length !== 0
112+
verticalAlignment: Text.AlignVCenter
113+
Layout.fillWidth: true
114+
Layout.minimumHeight: 22
109115
font: D.DTK.fontManager.t8
116+
visible: model.releaseTime.length !== 0
110117
text: qsTr("Release time:") + model.releaseTime
111118
}
112119

113-
Item {
114-
Layout.fillWidth: true
120+
D.ToolButton {
121+
textColor: D.Palette {
122+
normal {
123+
common: D.DTK.makeColor(D.Color.Highlight)
124+
}
125+
normalDark: normal
126+
hovered {
127+
common: D.DTK.makeColor(D.Color.Highlight).lightness(+30)
128+
}
129+
hoveredDark: hovered
130+
}
131+
visible: repeater.model.getDetailInfos(index).length !== 0 && !itemCtl.showDetails
132+
bottomPadding: 0
133+
font: D.DTK.fontManager.t8
134+
text: qsTr("View More")
135+
onClicked: {
136+
itemCtl.showDetails = true
137+
}
138+
background: Item {}
139+
}
140+
141+
Component.onDestruction: {
142+
itemCtl.showDetails = false
143+
}
144+
}
145+
146+
Rectangle {
147+
height: 1
148+
color: D.DTK.themeType === D.ApplicationHelper.LightType ?
149+
Qt.rgba(0, 0, 0, 0.05) : Qt.rgba(1, 1, 1, 0.05)
150+
Layout.fillWidth: true
151+
visible: itemCtl.showDetails
152+
}
153+
154+
// 详情列表
155+
Repeater {
156+
id: innerRepeater
157+
model: repeater.model.getDetailInfos(index)
158+
ColumnLayout {
159+
spacing: 6
160+
161+
D.Label {
162+
Layout.alignment: Qt.AlignLeft
163+
horizontalAlignment: Text.AlignLeft
164+
Layout.fillWidth: true
165+
font: D.DTK.fontManager.t8
166+
color: D.DTK.themeType == D.ApplicationHelper.LightType ?
167+
Qt.rgba(0, 0, 0, 1) : Qt.rgba(1, 1, 1, 1)
168+
visible: itemCtl.showDetails && modelData.name !== ""
169+
text: qsTr("Version:") + modelData.name
170+
}
171+
172+
D.Label {
173+
Layout.alignment: Qt.AlignLeft
174+
horizontalAlignment: Text.AlignLeft
175+
Layout.fillWidth: true
176+
font: D.DTK.fontManager.t8
177+
visible: itemCtl.showDetails && modelData.info !== ""
178+
text: modelData.info
179+
textFormat: Text.RichText
180+
wrapMode: Text.WordWrap
181+
onLinkActivated: (link)=> {
182+
dccData.work().openUrl(link)
183+
}
184+
}
185+
186+
RowLayout {
187+
D.Label {
188+
Layout.alignment: Qt.AlignLeft
189+
horizontalAlignment: Text.AlignLeft
190+
Layout.fillWidth: true
191+
font: D.DTK.fontManager.t8
192+
visible: itemCtl.showDetails && modelData.updateTime !== ""
193+
text: qsTr("Release time:") + modelData.updateTime
194+
}
195+
196+
D.ToolButton {
197+
textColor: D.Palette {
198+
normal {
199+
common: D.DTK.makeColor(D.Color.Highlight)
200+
}
201+
normalDark: normal
202+
hovered {
203+
common: D.DTK.makeColor(D.Color.Highlight).lightness(+30)
204+
}
205+
hoveredDark: hovered
206+
}
207+
visible: itemCtl.showDetails && (index === innerRepeater.count - 1 )
208+
bottomPadding: 0
209+
font: D.DTK.fontManager.t8
210+
text: qsTr("Collapse")
211+
onClicked: {
212+
itemCtl.showDetails = false
213+
}
214+
background: Item {}
215+
}
216+
217+
Component.onDestruction: {
218+
itemCtl.showDetails = false
219+
}
220+
}
221+
222+
Rectangle {
223+
height: 1
224+
color: D.DTK.themeType === D.ApplicationHelper.LightType ?
225+
Qt.rgba(0, 0, 0, 0.05) : Qt.rgba(1, 1, 1, 0.05)
226+
Layout.fillWidth: true
227+
visible: itemCtl.showDetails && (index !== innerRepeater.count - 1 )
228+
}
115229
}
116230
}
117231
}

src/dcc-update-plugin/translations/update_ar.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,14 @@
8585
<source>Version:</source>
8686
<translation type="unfinished"></translation>
8787
</message>
88+
<message>
89+
<source>View More</source>
90+
<translation type="unfinished"></translation>
91+
</message>
92+
<message>
93+
<source>Collapse</source>
94+
<translation type="unfinished"></translation>
95+
</message>
8896
</context>
8997
<context>
9098
<name>UpdateLogDialog</name>

0 commit comments

Comments
 (0)