update
This commit is contained in:
+60
-30
@@ -4,46 +4,54 @@
|
|||||||
|
|
||||||
import QtQuick 2.15
|
import QtQuick 2.15
|
||||||
import QtQuick.Controls 2.15
|
import QtQuick.Controls 2.15
|
||||||
|
import QtQuick.Layouts 1.15
|
||||||
import org.deepin.ds 1.0
|
import org.deepin.ds 1.0
|
||||||
import org.deepin.ds.dock 1.0
|
import org.deepin.ds.dock 1.0
|
||||||
|
|
||||||
AppletItem {
|
AppletItem {
|
||||||
id: root
|
id: root
|
||||||
objectName: "graphics driver applet"
|
objectName: "graphics driver applet"
|
||||||
implicitWidth: Panel.rootObject.dockItemMaxSize
|
|
||||||
implicitHeight: Panel.rootObject.dockItemMaxSize
|
property bool useColumnLayout: Panel.position % 2
|
||||||
property int dockOrder: 20
|
property int dockOrder: 20
|
||||||
|
property int dockSize: Panel.rootObject.dockSize || 48
|
||||||
|
|
||||||
|
implicitWidth: useColumnLayout ? dockSize : 80
|
||||||
|
implicitHeight: dockSize
|
||||||
|
|
||||||
property var applet: Applet
|
property var applet: Applet
|
||||||
|
|
||||||
AppletItemButton {
|
PanelToolTip {
|
||||||
anchors.fill: parent
|
id: toolTip
|
||||||
|
text: qsTr("Graphics Driver Manager")
|
||||||
|
toolTipX: DockPanelPositioner.x
|
||||||
|
toolTipY: DockPanelPositioner.y
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
HoverHandler {
|
||||||
anchors.fill: parent
|
onHoveredChanged: {
|
||||||
color: "#3498db"
|
if (hovered && !driverPopup.popupVisible) {
|
||||||
radius: 8
|
const point = root.mapToItem(null, root.width / 2, root.height / 2)
|
||||||
|
toolTip.DockPanelPositioner.bounding = Qt.rect(point.x, point.y, toolTip.width, toolTip.height)
|
||||||
Text {
|
toolTip.open()
|
||||||
anchors.centerIn: parent
|
} else {
|
||||||
text: "GPU"
|
toolTip.close()
|
||||||
font.pixelSize: 12
|
|
||||||
color: "white"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onClicked: {
|
|
||||||
popup.visible = !popup.visible
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Popup {
|
PanelPopup {
|
||||||
id: popup
|
id: driverPopup
|
||||||
x: 0
|
|
||||||
y: -popup.height - 10
|
|
||||||
width: 300
|
width: 300
|
||||||
height: 400
|
height: 360
|
||||||
closePolicy: Popup.CloseOnPressOutside
|
popupX: DockPanelPositioner.x
|
||||||
|
popupY: DockPanelPositioner.y
|
||||||
|
|
||||||
|
onPopupVisibleChanged: {
|
||||||
|
if (popupVisible) {
|
||||||
|
toolTip.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@@ -51,7 +59,7 @@ AppletItem {
|
|||||||
spacing: 12
|
spacing: 12
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: "Graphics Driver Manager"
|
text: qsTr("Graphics Driver Manager")
|
||||||
font.pixelSize: 16
|
font.pixelSize: 16
|
||||||
font.bold: true
|
font.bold: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@@ -65,7 +73,7 @@ AppletItem {
|
|||||||
|
|
||||||
GroupBox {
|
GroupBox {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
title: "Device Information"
|
title: qsTr("Device Information")
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@@ -87,7 +95,7 @@ AppletItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: "Refresh"
|
text: qsTr("Refresh")
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (root.applet) {
|
if (root.applet) {
|
||||||
@@ -97,7 +105,7 @@ AppletItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: "Test Install"
|
text: qsTr("Test Install")
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
enabled: root.applet && !root.applet.isInstalling
|
enabled: root.applet && !root.applet.isInstalling
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@@ -113,7 +121,7 @@ AppletItem {
|
|||||||
spacing: 8
|
spacing: 8
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: "Installing... " + (root.applet ? root.applet.installProgress + "%" : "0%")
|
text: qsTr("Installing... ") + (root.applet ? root.applet.installProgress + "%" : "0%")
|
||||||
font.pixelSize: 12
|
font.pixelSize: 12
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,7 +131,7 @@ AppletItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: "Cancel"
|
text: qsTr("Cancel")
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (root.applet) {
|
if (root.applet) {
|
||||||
@@ -137,6 +145,28 @@ AppletItem {
|
|||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
DockPanelPositioner.bounding = Qt.binding(function () {
|
||||||
|
const point = root.mapToItem(null, root.width / 2, root.height / 2)
|
||||||
|
return Qt.rect(point.x, point.y, driverPopup.width, driverPopup.height)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TapHandler {
|
||||||
|
acceptedButtons: Qt.LeftButton
|
||||||
|
gesturePolicy: TapHandler.ReleaseWithinBounds
|
||||||
|
|
||||||
|
onTapped: {
|
||||||
|
if (driverPopup.popupVisible) {
|
||||||
|
driverPopup.close()
|
||||||
|
} else {
|
||||||
|
Panel.requestClosePopup()
|
||||||
|
driverPopup.open()
|
||||||
|
}
|
||||||
|
toolTip.close()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
|
|||||||
@@ -4,6 +4,9 @@
|
|||||||
"Id": "org.deepin.ds.graphics-driver",
|
"Id": "org.deepin.ds.graphics-driver",
|
||||||
"Url": "driverview.qml",
|
"Url": "driverview.qml",
|
||||||
"Parent": "org.deepin.ds.dock",
|
"Parent": "org.deepin.ds.dock",
|
||||||
"Category": "DDE"
|
"Name": "Graphics Driver",
|
||||||
|
"Name[zh_CN]": "显卡驱动管理",
|
||||||
|
"Description": "Manage graphics driver installation and switching",
|
||||||
|
"Description[zh_CN]": "管理显卡驱动安装与切换"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user