diff --git a/package/driverview.qml b/package/driverview.qml index 20a5663..798df83 100644 --- a/package/driverview.qml +++ b/package/driverview.qml @@ -30,28 +30,32 @@ AppletItem { 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 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 accentBlueLight: Qt.rgba(36 / 255, 118 / 255, 220 / 255, 0.15) + readonly property color accentBlue: Qt.rgba(20 / 255, 80 / 255, 160 / 255, 1) + readonly property color accentBlueLight: Qt.rgba(20 / 255, 80 / 255, 160 / 255, 0.12) // 图标区域 Rectangle { - anchors.fill: parent - color: accentBlue - radius: 8 + anchors.centerIn: parent + width: dockSize * 0.7 + height: dockSize * 0.7 + color: "transparent" + radius: width * 0.45 + border.width: 1 + border.color: root.secondaryText Text { anchors.centerIn: parent text: "GPU" - font.pixelSize: root.dockSize * 0.3 + font.pixelSize: root.dockSize * 0.22 font.bold: true - color: "white" + color: root.primaryText } } // 悬停提示 PanelToolTip { 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 toolTipY: DockPanelPositioner.y } @@ -106,6 +110,8 @@ AppletItem { Layout.fillWidth: true spacing: 10 + Item { Layout.fillWidth: true } + Rectangle { width: 28 height: 28 @@ -126,8 +132,9 @@ AppletItem { font.pixelSize: 16 font.bold: true color: root.primaryText - Layout.fillWidth: true } + + Item { Layout.fillWidth: true } } // 分隔线 @@ -200,7 +207,7 @@ AppletItem { Text { anchors.centerIn: parent - text: "GPU" + text: parseGpuVendorShort(modelData) font.pixelSize: 14 font.bold: true color: root.accentBlue @@ -272,13 +279,13 @@ AppletItem { font.pixelSize: 13 background: Rectangle { - color: refreshBtn.hovered ? root.accentBlue : root.accentBlueLight + color: refreshBtn.hovered ? Qt.darker(root.accentBlue, 1.2) : root.accentBlue radius: 8 } contentItem: Text { text: refreshBtn.text - color: refreshBtn.hovered ? "white" : root.accentBlue + color: "white" font.pixelSize: refreshBtn.font.pixelSize horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter @@ -320,6 +327,17 @@ AppletItem { 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 { acceptedButtons: Qt.LeftButton