Skip to content

Commit e6973e8

Browse files
committed
fix: enhance update list display and version info
1. Added version field to UpdateListModel for displaying package versions 2. Modified SystemUpdateLog structure to include systemVersion and remove unused upgradeTime 3. Updated UpdateWorker to sync update info with log helper 4. Improved QML layout with better typography and version display 5. Removed unused click signal and simplified release time display 6. Added proper font sizing using DTK font manager fix: 增强更新列表显示和版本信息 1. 在 UpdateListModel 中添加版本字段用于显示软件包版本 2. 修改 SystemUpdateLog 结构体,添加 systemVersion 并移除未使用的 upgradeTime 3. 更新 UpdateWorker 以同步更新信息与日志助手 4. 改进 QML 布局,优化排版并添加版本显示 5. 移除未使用的点击信号并简化发布时间显示 6. 使用 DTK 字体管理器添加适当的字体大小设置 pms: Bug-318147
1 parent 5851952 commit e6973e8

37 files changed

Lines changed: 296 additions & 152 deletions

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ QVariant UpdateListModel::data(const QModelIndex &index, int role) const
2525
switch (role) {
2626
case Title:
2727
return data->name();
28+
case Version:
29+
return data->currentVersion();
2830
case TitleDescription:
2931
return data->explain();
3032
case UpdateLog:

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class UpdateListModel : public QAbstractListModel
1919
public:
2020
enum updateRoles {
2121
Title = Qt::UserRole + 1,
22+
Version,
2223
TitleDescription,
2324
UpdateLog,
2425
ReleaseTime,
@@ -48,6 +49,7 @@ class UpdateListModel : public QAbstractListModel
4849
{
4950
QHash<int, QByteArray> roles;
5051
roles[Title] = "title";
52+
roles[Version] = "version";
5153
roles[TitleDescription] = "titleDescription";
5254
roles[UpdateLog] = "updateLog";
5355
roles[ReleaseTime] = "releaseTime";

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ struct SystemUpdateLog {
6868
QString showVersion;
6969
QString cnLog = "";
7070
QString enLog = "";
71+
QString systemVersion;
7172
QString publishTime;
72-
QString upgradeTime; // 更新时间
7373
int isUnstable=0;
7474
int logType = 1;
7575

@@ -81,8 +81,9 @@ struct SystemUpdateLog {
8181
item.showVersion = obj.value("showVersion").toString();
8282
item.cnLog = obj.value("cnLog").toString();
8383
item.enLog = obj.value("enLog").toString();
84-
item.isUnstable = obj.value("isUnstable").toInt();
84+
item.systemVersion = obj.value("systemVersion").toString();
8585
item.publishTime = DCC_NAMESPACE::utcDateTime2LocalDate(obj.value("publishTime").toString());
86+
item.isUnstable = obj.value("isUnstable").toInt();
8687
if (obj.contains("logType")) {
8788
item.logType = obj.value("logType").toInt();
8889
}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,10 @@ void UpdateWorker::activate()
240240
if (!watcher->isError()) {
241241
QDBusPendingReply<QString> reply = watcher->reply();
242242
UpdateLogHelper::ref().handleUpdateLog(reply.value());
243+
auto resultMap = m_model->getAllUpdateInfos();
244+
for (UpdateType type : resultMap.keys()) {
245+
UpdateLogHelper::ref().updateItemInfo(resultMap.value(type));
246+
}
243247
} else {
244248
qCWarning(DCC_UPDATE_WORKER) << "Get update log failed";
245249
}
@@ -1399,6 +1403,10 @@ void UpdateWorker::onCheckUpdateStatusChanged(const QString& value)
13991403
if (!watcher->isError()) {
14001404
QDBusPendingReply<QString> reply = watcher->reply();
14011405
UpdateLogHelper::ref().handleUpdateLog(reply.value());
1406+
auto resultMap = m_model->getAllUpdateInfos();
1407+
for (UpdateType type : resultMap.keys()) {
1408+
UpdateLogHelper::ref().updateItemInfo(resultMap.value(type));
1409+
}
14021410
} else {
14031411
qCWarning(DCC_UPDATE_WORKER) << "Get update log failed";
14041412
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ ColumnLayout {
5555
font {
5656
pixelSize: D.DTK.fontManager.t5.pixelSize
5757
family: D.DTK.fontManager.t5.family
58-
bold: true
58+
weight: Font.Medium
5959
}
60+
color: D.DTK.themeType == D.ApplicationHelper.LightType ? Qt.rgba(0, 0, 0, 1) : Qt.rgba(1, 1, 1, 1)
6061
text: updateTitle
6162
}
6263
}

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

Lines changed: 23 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ Rectangle {
1414
id: root
1515

1616
property alias model: repeater.model
17-
signal clicked(int index, bool checked)
1817

1918
color: "transparent"
2019
implicitHeight: layoutView.height
@@ -53,13 +52,14 @@ Rectangle {
5352

5453
ColumnLayout {
5554
Layout.alignment: Qt.AlignRight
56-
spacing: 10
55+
spacing: 6
5756

5857
RowLayout {
5958
Label {
6059
Layout.alignment: Qt.AlignLeft
6160
text: model.title
62-
font.pixelSize: 14
61+
font: D.DTK.fontManager.t6
62+
color: D.DTK.themeType == D.ApplicationHelper.LightType ? Qt.rgba(0, 0, 0, 1) : Qt.rgba(1, 1, 1, 1)
6363
width: 100
6464
Layout.fillWidth: true
6565
}
@@ -80,34 +80,30 @@ Rectangle {
8080
Layout.alignment: Qt.AlignLeft
8181
horizontalAlignment: Text.AlignLeft
8282
Layout.fillWidth: true
83-
font.pixelSize: 12
84-
text: model.titleDescription
85-
wrapMode: Text.WordWrap
86-
}
87-
88-
Rectangle {
89-
visible: false
90-
height: 1
91-
color: parent.palette.window
92-
Layout.topMargin: 10
93-
Layout.bottomMargin: 10
94-
Layout.fillWidth: true
83+
font: D.DTK.fontManager.t8
84+
color: D.DTK.themeType == D.ApplicationHelper.LightType ? Qt.rgba(0, 0, 0, 1) : Qt.rgba(1, 1, 1, 1)
85+
visible: model.version.length !== 0
86+
text: qsTr("Version:") + model.version
9587
}
9688

9789
D.Label {
98-
visible: false
9990
Layout.alignment: Qt.AlignLeft
10091
horizontalAlignment: Text.AlignLeft
101-
font.pixelSize: 12
102-
text: qsTr("Updates:")
92+
Layout.fillWidth: true
93+
font: D.DTK.fontManager.t8
94+
text: model.titleDescription
95+
wrapMode: Text.WordWrap
96+
onLinkActivated: (link)=> {
97+
dccData.work().openUrl(link)
98+
}
10399
}
104100

105101
D.Label {
106102
id: shortLog
107103
Layout.alignment: Qt.AlignLeft
108104
horizontalAlignment: Text.AlignLeft
109105
text: model.updateLog
110-
font.pixelSize: 12
106+
font: D.DTK.fontManager.t8
111107
Layout.fillWidth: true
112108
opacity: 0.7
113109
wrapMode: Text.WordWrap
@@ -120,33 +116,21 @@ Rectangle {
120116
Layout.alignment: Qt.AlignLeft
121117
horizontalAlignment: Text.AlignLeft
122118
text: ""
123-
font.pixelSize: 12
119+
font: D.DTK.fontManager.t8
124120
Layout.fillWidth: true
125121
opacity: 0.7
126122
wrapMode: Text.WordWrap
127123
}
128124

129125
RowLayout {
130-
RowLayout {
131-
visible: releaseContent.text.length !== 0
126+
D.Label {
127+
id: releaseTitle
132128
Layout.alignment: Qt.AlignLeft
133-
D.Label {
134-
id: releaseTitle
135-
Layout.alignment: Qt.AlignLeft
136-
horizontalAlignment: Text.AlignLeft
137-
font.pixelSize: 12
138-
text: qsTr("Release time:")
139-
opacity: 0.7
140-
}
141-
142-
D.Label {
143-
id: releaseContent
144-
Layout.alignment: Qt.AlignLeft
145-
horizontalAlignment: Text.AlignLeft
146-
font.pixelSize: 12
147-
text: model.releaseTime
148-
opacity: 0.7
149-
}
129+
horizontalAlignment: Text.AlignLeft
130+
visible: model.releaseTime.length !== 0
131+
font: D.DTK.fontManager.t8
132+
text: qsTr("Release time:") + model.releaseTime
133+
opacity: 0.7
150134
}
151135

152136
Item {
@@ -170,14 +154,8 @@ Rectangle {
170154

171155
background: DccItemBackground {
172156
separatorVisible: true
173-
//highlightEnable: false
174-
}
175-
176-
onClicked: {
177-
root.clicked(index, !model.checked)
178157
}
179158
}
180159
}
181160
}
182161
}
183-

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@
7979
<source>Collapse</source>
8080
<translation>قم بطي ذلك</translation>
8181
</message>
82+
<message>
83+
<source>Version:</source>
84+
<translation type="unfinished"></translation>
85+
</message>
8286
</context>
8387
<context>
8488
<name>UpdateLogDialog</name>

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@
7979
<source>Collapse</source>
8080
<translation type="unfinished"></translation>
8181
</message>
82+
<message>
83+
<source>Version:</source>
84+
<translation type="unfinished"></translation>
85+
</message>
8286
</context>
8387
<context>
8488
<name>UpdateLogDialog</name>

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@
7979
<source>Collapse</source>
8080
<translation type="unfinished"></translation>
8181
</message>
82+
<message>
83+
<source>Version:</source>
84+
<translation type="unfinished"></translation>
85+
</message>
8286
</context>
8387
<context>
8488
<name>UpdateLogDialog</name>

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?xml version="1.0" ?><!DOCTYPE TS><TS version="2.1" language="ca">
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!DOCTYPE TS>
3+
<TS version="2.1" language="ca">
24
<context>
35
<name>CheckUpdate</name>
46
<message>
@@ -77,6 +79,10 @@
7779
<source>Collapse</source>
7880
<translation>Replega</translation>
7981
</message>
82+
<message>
83+
<source>Version:</source>
84+
<translation type="unfinished"></translation>
85+
</message>
8086
</context>
8187
<context>
8288
<name>UpdateLogDialog</name>
@@ -517,4 +523,4 @@
517523
<translation>La capacitat de la bateria és inferior al 60%. Per obtenir actualitzacions correctes, endolleu el dispositiu.</translation>
518524
</message>
519525
</context>
520-
</TS>
526+
</TS>

0 commit comments

Comments
 (0)