1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 21:42:51 -05:00

VPN multi-active: toggle per row fixes reconnection, add Quick Connect + Disconnect All, header/tooltips summarize multiple active; default allow multiple active

This commit is contained in:
Jon Rogers
2025-08-30 16:28:42 -04:00
parent 7f467b0a0d
commit d1890c69c9
3 changed files with 77 additions and 41 deletions

View File

@@ -77,7 +77,12 @@ Rectangle {
Text {
id: tooltipText
anchors.centerIn: parent
text: VpnService.connected ? ("VPN Connected • " + (VpnService.activeName || "")) : "VPN Disconnected"
text: {
if (!VpnService.connected) return "VPN Disconnected"
const names = VpnService.activeNames || []
if (names.length <= 1) return "VPN Connected • " + (names[0] || "")
return "VPN Connected • " + names[0] + " +" + (names.length - 1)
}
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText
}

View File

@@ -162,32 +162,59 @@ DankPopout {
Item { Layout.fillWidth: true; height: 1 }
// Quick connect when not connected
// Rectangle {
// height: 28
// radius: 14
// color: quickBtnArea.containsMouse ? Theme.primaryHoverLight : Theme.surfaceLight
// visible: !VpnService.connected && VpnService.profiles.length > 0
// width: 120
// Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
// border.width: 1
// border.color: Theme.outlineLight
//
// Row {
// anchors.centerIn: parent
// spacing: Theme.spacingXS
// DankIcon { name: "link"; size: Theme.fontSizeSmall; color: Theme.surfaceText }
// StyledText { text: "Connect"; font.pixelSize: Theme.fontSizeSmall; color: Theme.surfaceText; font.weight: Font.Medium }
// }
//
// MouseArea {
// id: quickBtnArea
// anchors.fill: parent
// hoverEnabled: true
// cursorShape: Qt.PointingHandCursor
// onClicked: VpnService.toggle()
// }
// }
// Quick connect
Rectangle {
height: 28
radius: 14
color: quickBtnArea.containsMouse ? Theme.primaryHoverLight : Theme.surfaceLight
visible: VpnService.profiles.length > 0
width: 120
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
border.width: 1
border.color: Theme.outlineLight
Row {
anchors.centerIn: parent
spacing: Theme.spacingXS
DankIcon { name: "link"; size: Theme.fontSizeSmall; color: Theme.surfaceText }
StyledText { text: "Connect"; font.pixelSize: Theme.fontSizeSmall; color: Theme.surfaceText; font.weight: Font.Medium }
}
MouseArea {
id: quickBtnArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: VpnService.toggle()
}
}
// Disconnect all (visible when any active)
Rectangle {
height: 28
radius: 14
color: discAllArea.containsMouse ? Theme.errorHover : Theme.surfaceLight
visible: VpnService.connected
width: 130
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
border.width: 1
border.color: Theme.outlineLight
Row {
anchors.centerIn: parent
spacing: Theme.spacingXS
DankIcon { name: "link_off"; size: Theme.fontSizeSmall; color: Theme.surfaceText }
StyledText { text: "Disconnect All"; font.pixelSize: Theme.fontSizeSmall; color: Theme.surfaceText; font.weight: Font.Medium }
}
MouseArea {
id: discAllArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: VpnService.disconnectAllActive()
}
}
}
Rectangle { height: 1; width: parent.width; color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.12) }
@@ -255,13 +282,7 @@ DankPopout {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
if (modelData.uuid === VpnService.activeUuid) {
VpnService.disconnect(modelData.uuid)
} else {
VpnService.connect(modelData.uuid)
}
}
onClicked: VpnService.toggle(modelData.uuid)
}
}
}