Skip to content

Commit 6b3ee6e

Browse files
committed
fix: improve update dialog UI and controls
1. Added space between process title and percentage in UpdateControl for better readability 2. Increased dialog height in UpdateSelectDialog to accommodate content better 3. Replaced standard buttons with custom ButtonWithToolTip component that shows tooltips for truncated text 4. Removed redundant validation check in UpdateSetting's editingFinished handler 5. Improved layout and spacing in UpdateSelectDialog for better visual hierarchy fix: 改进更新对话框UI和控件 1. 在UpdateControl中添加进度标题和百分比之间的空格以提高可读性 2. 增加UpdateSelectDialog对话框高度以更好容纳内容 3. 使用自定义ButtonWithToolTip组件替换标准按钮,可显示截断文本的工具提示 4. 移除UpdateSetting中editingFinished处理程序中的冗余验证检查 5. 改进UpdateSelectDialog中的布局和间距以获得更好的视觉层次 pms: Bug-313015 pms: Bug-316113
1 parent 1afe029 commit 6b3ee6e

3 files changed

Lines changed: 37 additions & 12 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ ColumnLayout {
181181
Layout.alignment: Qt.AlignRight
182182
Layout.rightMargin: isDownloading ? pauseIcon.width + stopIcon.width + progressCtl.spacing * 2 : 0
183183
width: parent.width
184-
text: processTitle + Math.floor(process.value * 100) + "%"
184+
text: processTitle + " " + Math.floor(process.value * 100) + "%"
185185
font: D.DTK.fontManager.t8
186186
}
187187
}

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

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import org.deepin.dcc 1.0
1111
D.DialogWindow {
1212
id: root
1313
width: 360
14-
height: 130
14+
height: 150
1515
icon: "preferences-system"
1616
modality: Qt.WindowModal
1717

@@ -20,9 +20,12 @@ D.DialogWindow {
2020
signal upgradeShutdownBtnClicked()
2121

2222
ColumnLayout {
23-
anchors.fill: parent
24-
Label {
25-
Layout.alignment: Qt.AlignHCenter
23+
width: parent.width
24+
height: 150 - DS.Style.dialogWindow.titleBarHeight
25+
26+
D.Label {
27+
Layout.fillWidth: true
28+
horizontalAlignment: Text.AlignHCenter
2629
wrapMode: Text.WordWrap
2730
text: qsTr("The updates have been already downloaded. What do you want to do?")
2831
}
@@ -33,26 +36,26 @@ D.DialogWindow {
3336

3437
RowLayout {
3538
Layout.fillWidth: true
36-
Layout.bottomMargin: 0
39+
Layout.bottomMargin: 10
3740
spacing: 10
3841

39-
D.Button {
42+
ButtonWithToolTip {
4043
text: qsTr("Silent Installation")
4144
Layout.fillWidth: true
4245
onClicked: {
4346
root.silentBtnClicked()
4447
}
4548
}
4649

47-
D.Button {
50+
ButtonWithToolTip {
4851
text: qsTr("Update and Reboot")
4952
Layout.fillWidth: true
5053
onClicked: {
5154
root.upgradeRebootBtnClicked()
5255
}
5356
}
5457

55-
D.Button {
58+
ButtonWithToolTip {
5659
text: qsTr("Update and Shut Down")
5760
textColor: D.Palette {
5861
normal {
@@ -65,6 +68,31 @@ D.DialogWindow {
6568
root.upgradeShutdownBtnClicked()
6669
}
6770
}
71+
72+
component ButtonWithToolTip: D.Button {
73+
id: customButton
74+
// 1. 自定义内容项(核心)
75+
contentItem: Text {
76+
id: buttonText
77+
text: customButton.text
78+
font: customButton.font
79+
color: customButton.D.ColorSelector.textColor
80+
horizontalAlignment: Text.AlignHCenter
81+
verticalAlignment: Text.AlignVCenter
82+
elide: Text.ElideRight // 右侧省略
83+
width: customButton.width // 继承按钮宽度
84+
}
85+
86+
// 2. 启用悬停检测
87+
hoverEnabled: true
88+
89+
// 3. 动态 ToolTip
90+
ToolTip {
91+
visible: customButton.hovered && buttonText.truncated
92+
delay: 500
93+
text: customButton.text
94+
}
95+
}
6896
}
6997
}
7098
}

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,6 @@ DccObject {
196196
}
197197
}
198198
onEditingFinished: {
199-
if (lineEdit.showAlert) {
200-
return
201-
}
202199
if (lineEdit.text.length === 0) {
203200
lineEdit.text = dccData.model().downloadSpeedLimitSize
204201
return

0 commit comments

Comments
 (0)