-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathUpdateHistoryDialog.qml
More file actions
215 lines (199 loc) · 9.03 KB
/
Copy pathUpdateHistoryDialog.qml
File metadata and controls
215 lines (199 loc) · 9.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
// SPDX-FileCopyrightText: 2025 - 2026 UnionTech Software Technology Co., Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.5
import org.deepin.dtk 1.0 as D
import org.deepin.dtk.style as DS
import org.deepin.dcc 1.0
D.DialogWindow {
id: root
width: 712
height: 530
icon: "preferences-system"
modality: Qt.WindowModal
title: qsTr("Update History")
ColumnLayout {
id: noUpdateLayout
x: -DS.Style.dialogWindow.contentHMargin
width: root.width// - DS.Style.dialogWindow.contentHMargin * 2
spacing: 0
// 无更新历史时的提示
Control {
visible: listView.model.rowCount() === 0
Layout.fillWidth: parent
height: 400
Item {
anchors.centerIn: parent
implicitWidth: Math.max(noUpdateIcon.implicitWidth, noUpdateLabel.implicitWidth)
implicitHeight: noUpdateIcon.implicitHeight + noUpdateLabel.implicitHeight + 20
D.DciIcon {
id: noUpdateIcon
anchors.horizontalCenter: parent.horizontalCenter
palette: D.DTK.makeIconPalette(root.palette)
mode: root.D.ColorSelector.controlState
theme: root.D.ColorSelector.controlTheme
fallbackToQIcon: false
sourceSize: Qt.size(136, 136)
name: "update_no_update_history"
}
Label {
id: noUpdateLabel
anchors.top: noUpdateIcon.bottom
anchors.topMargin: 20
anchors.horizontalCenter: noUpdateIcon.horizontalCenter
text: qsTr("No update history")
font.family: D.DTK.fontManager.t8.family
font.pixelSize: D.DTK.fontManager.t8.pixelSize
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
}
}
}
// 更新历史列表
ListView {
id: listView
width: parent.width
height: 450
spacing: 6
clip: true
cacheBuffer: 1000
ScrollBar.vertical: D.ScrollBar {
width: 10
}
model: dccData.model().historyModel
visible: model.rowCount() > 0
delegate: D.ItemDelegate {
id: logItem
width: listView.width
padding: 0
height: children.height
checkable: false
cascadeSelected: !checked
background: Rectangle {
x: 70
width: listView.width -140
property D.Palette backgroundColor: D.Palette {
normal: Qt.rgba(1, 1, 1, 1)
normalDark: Qt.rgba(1, 1, 1, 0.05)
}
radius: 6
color: D.ColorSelector.backgroundColor
}
contentItem: RowLayout {
Layout.margins: 0
Layout.fillWidth: true
D.DciIcon {
theme: logItem.D.ColorSelector.controlTheme
fallbackToQIcon: false
width: 22
height: 22
name: {
switch(Type) {
case 1: return "update_maintenance"
case 4: return "update_safe"
default: return "update_set"
}
}
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
Layout.leftMargin: 11 + 70
Layout.topMargin: 16
sourceSize: Qt.size(DS.Style.itemDelegate.checkIndicatorIconSize, DS.Style.itemDelegate.checkIndicatorIconSize)
}
ColumnLayout {
Layout.topMargin: 16
Layout.bottomMargin: 16
Layout.maximumWidth: 498
// 类型
Label {
text: {
switch(Type) {
case 1: return qsTr("System Updates")
case 4: return qsTr("Security Updates")
default: return ""
}
}
font: D.DTK.fontManager.t6
color: D.DTK.themeType == D.ApplicationHelper.LightType ? Qt.rgba(0, 0, 0, 1) : Qt.rgba(1, 1, 1, 1)
wrapMode: Text.WordWrap
Layout.fillWidth: true
}
// 摘要
Label {
text: Summary
visible: Summary !== ""
font: D.DTK.fontManager.t8
wrapMode: Text.WordWrap
Layout.fillWidth: true
}
// 详情列表
Repeater {
model: Details
ColumnLayout {
spacing: 6
Label {
text: {
switch(Type) {
case 1: return qsTr("Version:") + modelData.name
case 4: return qsTr("Vulnerability ID: ") + modelData.name
default: return ""
}
}
visible: modelData.name !== ""
font: D.DTK.fontManager.t8
color: D.DTK.themeType == D.ApplicationHelper.LightType ? Qt.rgba(0, 0, 0, 1) : Qt.rgba(1, 1, 1, 1)
wrapMode: Text.WordWrap
Layout.fillWidth: true
}
Label {
text: qsTr("Severity: ") + modelData.displayVulLevel
visible: modelData.displayVulLevel !== ""
font: D.DTK.fontManager.t8
color: D.DTK.themeType == D.ApplicationHelper.LightType ? Qt.rgba(0, 0, 0, 1) : Qt.rgba(1, 1, 1, 1)
wrapMode: Text.WordWrap
Layout.fillWidth: true
onLinkActivated: (link)=> {
if (link.startsWith("http")) {
Qt.openUrlExternally(link)
}
}
MouseArea {
anchors.fill: parent
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
acceptedButtons: Qt.NoButton
}
}
Label {
text: {
Type === 4 ? qsTr("Description: ") + modelData.description : modelData.description
}
visible: modelData.description !== ""
font: D.DTK.fontManager.t8
wrapMode: Text.WordWrap
Layout.fillWidth: true
onLinkActivated: (link)=> {
if (link.startsWith("http")) {
Qt.openUrlExternally(link)
}
}
MouseArea {
anchors.fill: parent
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
acceptedButtons: Qt.NoButton
}
}
}
}
// 升级时间
Label {
Layout.fillWidth: true
text: qsTr("Installation date:") + UpgradeTime
font: D.DTK.fontManager.t8
wrapMode: Text.WordWrap
}
}
}
}
}
}
}