From 8dd4cc8c64a1346c29568e75206122a18ee5903e Mon Sep 17 00:00:00 2001 From: xionglinlin Date: Fri, 20 Jun 2025 16:40:13 +0800 Subject: [PATCH] fix: improve update dialog UI and controls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/dcc-update-plugin/qml/UpdateControl.qml | 2 +- .../qml/UpdateSelectDialog.qml | 42 +++++++++++++++---- src/dcc-update-plugin/qml/UpdateSetting.qml | 3 -- 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/src/dcc-update-plugin/qml/UpdateControl.qml b/src/dcc-update-plugin/qml/UpdateControl.qml index 205e7067f..324ef1a5f 100644 --- a/src/dcc-update-plugin/qml/UpdateControl.qml +++ b/src/dcc-update-plugin/qml/UpdateControl.qml @@ -181,7 +181,7 @@ ColumnLayout { Layout.alignment: Qt.AlignRight Layout.rightMargin: isDownloading ? pauseIcon.width + stopIcon.width + progressCtl.spacing * 2 : 0 width: parent.width - text: processTitle + Math.floor(process.value * 100) + "%" + text: processTitle + " " + Math.floor(process.value * 100) + "%" font: D.DTK.fontManager.t8 } } diff --git a/src/dcc-update-plugin/qml/UpdateSelectDialog.qml b/src/dcc-update-plugin/qml/UpdateSelectDialog.qml index f57b0a470..c39594aa8 100644 --- a/src/dcc-update-plugin/qml/UpdateSelectDialog.qml +++ b/src/dcc-update-plugin/qml/UpdateSelectDialog.qml @@ -11,7 +11,7 @@ import org.deepin.dcc 1.0 D.DialogWindow { id: root width: 360 - height: 130 + height: 150 icon: "preferences-system" modality: Qt.WindowModal @@ -20,9 +20,12 @@ D.DialogWindow { signal upgradeShutdownBtnClicked() ColumnLayout { - anchors.fill: parent - Label { - Layout.alignment: Qt.AlignHCenter + width: parent.width + height: 150 - DS.Style.dialogWindow.titleBarHeight + + D.Label { + Layout.fillWidth: true + horizontalAlignment: Text.AlignHCenter wrapMode: Text.WordWrap text: qsTr("The updates have been already downloaded. What do you want to do?") } @@ -33,10 +36,10 @@ D.DialogWindow { RowLayout { Layout.fillWidth: true - Layout.bottomMargin: 0 + Layout.bottomMargin: 10 spacing: 10 - D.Button { + ButtonWithToolTip { text: qsTr("Silent Installation") Layout.fillWidth: true onClicked: { @@ -44,7 +47,7 @@ D.DialogWindow { } } - D.Button { + ButtonWithToolTip { text: qsTr("Update and Reboot") Layout.fillWidth: true onClicked: { @@ -52,7 +55,7 @@ D.DialogWindow { } } - D.Button { + ButtonWithToolTip { text: qsTr("Update and Shut Down") textColor: D.Palette { normal { @@ -65,6 +68,29 @@ D.DialogWindow { root.upgradeShutdownBtnClicked() } } + + component ButtonWithToolTip: D.Button { + id: customButton + + contentItem: Text { + id: buttonText + text: customButton.text + font: customButton.font + color: customButton.D.ColorSelector.textColor + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + elide: Text.ElideRight + width: customButton.width + } + + hoverEnabled: true + + ToolTip { + visible: customButton.hovered && buttonText.truncated + delay: 500 + text: customButton.text + } + } } } } diff --git a/src/dcc-update-plugin/qml/UpdateSetting.qml b/src/dcc-update-plugin/qml/UpdateSetting.qml index 933aa1ec9..6a33f0c00 100644 --- a/src/dcc-update-plugin/qml/UpdateSetting.qml +++ b/src/dcc-update-plugin/qml/UpdateSetting.qml @@ -196,9 +196,6 @@ DccObject { } } onEditingFinished: { - if (lineEdit.showAlert) { - return - } if (lineEdit.text.length === 0) { lineEdit.text = dccData.model().downloadSpeedLimitSize return