fix: 优化UI细节 - 标题居中、厂商图标、透明背景、tooltip分行显示

- 弹窗标题居中显示
- GPU卡片图标根据厂商显示简称(NV/AMD/Intel等)
- 任务栏图标改为透明背景+边框样式
- 加深蓝色调提高文字对比度
- 刷新按钮改为蓝底白字
- tooltip多显卡分行显示
This commit is contained in:
2026-07-13 21:43:47 +08:00
parent b440fdf40a
commit fcc395053a
+30 -12
View File
@@ -30,28 +30,32 @@ AppletItem {
readonly property color tertiaryText: Qt.rgba(basePalette.r, basePalette.g, basePalette.b, 0.5) readonly property color tertiaryText: Qt.rgba(basePalette.r, basePalette.g, basePalette.b, 0.5)
readonly property color cardBackground: Qt.rgba(basePalette.r, basePalette.g, basePalette.b, 0.06) readonly property color cardBackground: Qt.rgba(basePalette.r, basePalette.g, basePalette.b, 0.06)
readonly property color cardBorder: Qt.rgba(basePalette.r, basePalette.g, basePalette.b, 0.1) readonly property color cardBorder: Qt.rgba(basePalette.r, basePalette.g, basePalette.b, 0.1)
readonly property color accentBlue: Qt.rgba(36 / 255, 118 / 255, 220 / 255, 1) readonly property color accentBlue: Qt.rgba(20 / 255, 80 / 255, 160 / 255, 1)
readonly property color accentBlueLight: Qt.rgba(36 / 255, 118 / 255, 220 / 255, 0.15) readonly property color accentBlueLight: Qt.rgba(20 / 255, 80 / 255, 160 / 255, 0.12)
// 图标区域 // 图标区域
Rectangle { Rectangle {
anchors.fill: parent anchors.centerIn: parent
color: accentBlue width: dockSize * 0.7
radius: 8 height: dockSize * 0.7
color: "transparent"
radius: width * 0.45
border.width: 1
border.color: root.secondaryText
Text { Text {
anchors.centerIn: parent anchors.centerIn: parent
text: "GPU" text: "GPU"
font.pixelSize: root.dockSize * 0.3 font.pixelSize: root.dockSize * 0.22
font.bold: true font.bold: true
color: "white" color: root.primaryText
} }
} }
// 悬停提示 // 悬停提示
PanelToolTip { PanelToolTip {
id: toolTip id: toolTip
text: root.ready ? root.gpuSummary : qsTr("No GPU detected") text: root.ready ? root.deviceInfo.replace(/\n/g, "\n") : qsTr("No GPU detected")
toolTipX: DockPanelPositioner.x toolTipX: DockPanelPositioner.x
toolTipY: DockPanelPositioner.y toolTipY: DockPanelPositioner.y
} }
@@ -106,6 +110,8 @@ AppletItem {
Layout.fillWidth: true Layout.fillWidth: true
spacing: 10 spacing: 10
Item { Layout.fillWidth: true }
Rectangle { Rectangle {
width: 28 width: 28
height: 28 height: 28
@@ -126,8 +132,9 @@ AppletItem {
font.pixelSize: 16 font.pixelSize: 16
font.bold: true font.bold: true
color: root.primaryText color: root.primaryText
Layout.fillWidth: true
} }
Item { Layout.fillWidth: true }
} }
// 分隔线 // 分隔线
@@ -200,7 +207,7 @@ AppletItem {
Text { Text {
anchors.centerIn: parent anchors.centerIn: parent
text: "GPU" text: parseGpuVendorShort(modelData)
font.pixelSize: 14 font.pixelSize: 14
font.bold: true font.bold: true
color: root.accentBlue color: root.accentBlue
@@ -272,13 +279,13 @@ AppletItem {
font.pixelSize: 13 font.pixelSize: 13
background: Rectangle { background: Rectangle {
color: refreshBtn.hovered ? root.accentBlue : root.accentBlueLight color: refreshBtn.hovered ? Qt.darker(root.accentBlue, 1.2) : root.accentBlue
radius: 8 radius: 8
} }
contentItem: Text { contentItem: Text {
text: refreshBtn.text text: refreshBtn.text
color: refreshBtn.hovered ? "white" : root.accentBlue color: "white"
font.pixelSize: refreshBtn.font.pixelSize font.pixelSize: refreshBtn.font.pixelSize
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
@@ -320,6 +327,17 @@ AppletItem {
return info return info
} }
// 识别 GPU 厂商简称
function parseGpuVendorShort(info) {
var name = info.toLowerCase()
if (name.indexOf("nvidia") !== -1) return "NV"
if (name.indexOf("amd") !== -1 || name.indexOf("ati") !== -1 || name.indexOf("advanced micro") !== -1) return "AMD"
if (name.indexOf("intel") !== -1) return "Intel"
if (name.indexOf("qualcomm") !== -1) return "QC"
if (name.indexOf("microsoft") !== -1) return "MS"
return "GPU"
}
// 点击处理 // 点击处理
TapHandler { TapHandler {
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton