mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-29 07:52:50 -05:00
modules cleanup and qmlfmt everywhere
- throw in 24H clock fix and app drawer fix too
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
// No external details import; content inlined for consistency
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Widgets
|
||||
import qs.Widgets
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
// No external details import; content inlined for consistency
|
||||
import qs.Widgets
|
||||
|
||||
DankPopout {
|
||||
id: root
|
||||
@@ -16,11 +17,11 @@ DankPopout {
|
||||
property var triggerScreen: null
|
||||
|
||||
function setTriggerPosition(x, y, width, section, screen) {
|
||||
triggerX = x
|
||||
triggerY = y
|
||||
triggerWidth = width
|
||||
triggerSection = section
|
||||
triggerScreen = screen
|
||||
triggerX = x;
|
||||
triggerY = y;
|
||||
triggerWidth = width;
|
||||
triggerSection = section;
|
||||
triggerScreen = screen;
|
||||
}
|
||||
|
||||
popupWidth: 360
|
||||
@@ -37,6 +38,7 @@ DankPopout {
|
||||
content: Component {
|
||||
Rectangle {
|
||||
id: content
|
||||
|
||||
implicitHeight: contentColumn.height + Theme.spacingL * 2
|
||||
color: Theme.popupBackground()
|
||||
radius: Theme.cornerRadius
|
||||
@@ -45,11 +47,10 @@ DankPopout {
|
||||
antialiasing: true
|
||||
smooth: true
|
||||
focus: true
|
||||
|
||||
Keys.onPressed: function (event) {
|
||||
Keys.onPressed: function(event) {
|
||||
if (event.key === Qt.Key_Escape) {
|
||||
root.close()
|
||||
event.accepted = true
|
||||
root.close();
|
||||
event.accepted = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,6 +86,7 @@ DankPopout {
|
||||
|
||||
Column {
|
||||
id: contentColumn
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
@@ -94,6 +96,7 @@ DankPopout {
|
||||
Item {
|
||||
width: parent.width
|
||||
height: 32
|
||||
|
||||
StyledText {
|
||||
text: "VPN Connections"
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
@@ -120,17 +123,21 @@ DankPopout {
|
||||
|
||||
MouseArea {
|
||||
id: closeArea
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onPressed: root.close()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Inlined VPN details
|
||||
Rectangle {
|
||||
id: vpnDetail
|
||||
|
||||
width: parent.width
|
||||
implicitHeight: detailsColumn.implicitHeight + Theme.spacingM * 2
|
||||
radius: Theme.cornerRadius
|
||||
@@ -141,6 +148,7 @@ DankPopout {
|
||||
|
||||
Column {
|
||||
id: detailsColumn
|
||||
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.spacingM
|
||||
spacing: Theme.spacingS
|
||||
@@ -151,20 +159,32 @@ DankPopout {
|
||||
|
||||
StyledText {
|
||||
text: {
|
||||
if (!VpnService.connected) return "Active: None"
|
||||
const names = VpnService.activeNames || []
|
||||
if (names.length <= 1) return "Active: " + (names[0] || "VPN")
|
||||
return "Active: " + names[0] + " +" + (names.length - 1)
|
||||
if (!VpnService.connected) {
|
||||
return "Active: None";
|
||||
}
|
||||
|
||||
const names = VpnService.activeNames || [];
|
||||
if (names.length <= 1) {
|
||||
return "Active: " + (names[0] || "VPN");
|
||||
}
|
||||
|
||||
return "Active: " + names[0] + " +" + (names.length - 1);
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
}
|
||||
|
||||
Item { Layout.fillWidth: true; height: 1 }
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
height: 1
|
||||
}
|
||||
|
||||
// Removed Quick Connect for clarity
|
||||
Item { width: 1; height: 1 }
|
||||
Item {
|
||||
width: 1
|
||||
height: 1
|
||||
}
|
||||
|
||||
// Disconnect all (shown only when any active)
|
||||
Rectangle {
|
||||
@@ -180,21 +200,40 @@ DankPopout {
|
||||
Row {
|
||||
anchors.centerIn: parent
|
||||
spacing: Theme.spacingXS
|
||||
DankIcon { name: "link_off"; size: Theme.fontSizeSmall; color: Theme.surfaceText }
|
||||
StyledText { text: "Disconnect"; font.pixelSize: Theme.fontSizeSmall; color: Theme.surfaceText; font.weight: Font.Medium }
|
||||
|
||||
DankIcon {
|
||||
name: "link_off"
|
||||
size: Theme.fontSizeSmall
|
||||
color: Theme.surfaceText
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Disconnect"
|
||||
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) }
|
||||
Rectangle {
|
||||
height: 1
|
||||
width: parent.width
|
||||
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.12)
|
||||
}
|
||||
|
||||
DankFlickable {
|
||||
width: parent.width
|
||||
@@ -204,6 +243,7 @@ DankPopout {
|
||||
|
||||
Column {
|
||||
id: listCol
|
||||
|
||||
width: parent.width
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
@@ -215,16 +255,38 @@ DankPopout {
|
||||
Column {
|
||||
anchors.centerIn: parent
|
||||
spacing: Theme.spacingS
|
||||
DankIcon { name: "playlist_remove"; size: 36; color: Theme.surfaceVariantText; anchors.horizontalCenter: parent.horizontalCenter }
|
||||
StyledText { text: "No VPN profiles found"; font.pixelSize: Theme.fontSizeMedium; color: Theme.surfaceVariantText; anchors.horizontalCenter: parent.horizontalCenter }
|
||||
StyledText { text: "Add a VPN in NetworkManager"; font.pixelSize: Theme.fontSizeSmall; color: Theme.surfaceVariantText; anchors.horizontalCenter: parent.horizontalCenter }
|
||||
|
||||
DankIcon {
|
||||
name: "playlist_remove"
|
||||
size: 36
|
||||
color: Theme.surfaceVariantText
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "No VPN profiles found"
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceVariantText
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Add a VPN in NetworkManager"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: VpnService.profiles
|
||||
|
||||
delegate: Rectangle {
|
||||
required property var modelData
|
||||
|
||||
width: parent ? parent.width : 300
|
||||
height: 50
|
||||
radius: Theme.cornerRadius
|
||||
@@ -249,56 +311,109 @@ DankPopout {
|
||||
Column {
|
||||
spacing: 2
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
|
||||
StyledText {
|
||||
text: modelData.name
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: VpnService.isActiveUuid(modelData.uuid) ? Theme.primary : Theme.surfaceText
|
||||
|
||||
StyledText {
|
||||
text: modelData.name
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: VpnService.isActiveUuid(modelData.uuid) ? Theme.primary : Theme.surfaceText
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: {
|
||||
if (modelData.type === "wireguard") {
|
||||
return "WireGuard";
|
||||
}
|
||||
|
||||
const svc = modelData.serviceType || "";
|
||||
if (svc.indexOf("openvpn") !== -1) {
|
||||
return "OpenVPN";
|
||||
}
|
||||
|
||||
if (svc.indexOf("wireguard") !== -1) {
|
||||
return "WireGuard (plugin)";
|
||||
}
|
||||
|
||||
if (svc.indexOf("openconnect") !== -1) {
|
||||
return "OpenConnect";
|
||||
}
|
||||
|
||||
if (svc.indexOf("fortissl") !== -1 || svc.indexOf("forti") !== -1) {
|
||||
return "Fortinet";
|
||||
}
|
||||
|
||||
if (svc.indexOf("strongswan") !== -1) {
|
||||
return "IPsec (strongSwan)";
|
||||
}
|
||||
|
||||
if (svc.indexOf("libreswan") !== -1) {
|
||||
return "IPsec (Libreswan)";
|
||||
}
|
||||
|
||||
if (svc.indexOf("l2tp") !== -1) {
|
||||
return "L2TP/IPsec";
|
||||
}
|
||||
|
||||
if (svc.indexOf("pptp") !== -1) {
|
||||
return "PPTP";
|
||||
}
|
||||
|
||||
if (svc.indexOf("vpnc") !== -1) {
|
||||
return "Cisco (vpnc)";
|
||||
}
|
||||
|
||||
if (svc.indexOf("sstp") !== -1) {
|
||||
return "SSTP";
|
||||
}
|
||||
|
||||
if (svc) {
|
||||
const parts = svc.split('.');
|
||||
return parts[parts.length - 1];
|
||||
}
|
||||
return "VPN";
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceTextMedium
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: {
|
||||
if (modelData.type === "wireguard") return "WireGuard"
|
||||
var svc = modelData.serviceType || ""
|
||||
if (svc.indexOf("openvpn") !== -1) return "OpenVPN"
|
||||
if (svc.indexOf("wireguard") !== -1) return "WireGuard (plugin)"
|
||||
if (svc.indexOf("openconnect") !== -1) return "OpenConnect"
|
||||
if (svc.indexOf("fortissl") !== -1 || svc.indexOf("forti") !== -1) return "Fortinet"
|
||||
if (svc.indexOf("strongswan") !== -1) return "IPsec (strongSwan)"
|
||||
if (svc.indexOf("libreswan") !== -1) return "IPsec (Libreswan)"
|
||||
if (svc.indexOf("l2tp") !== -1) return "L2TP/IPsec"
|
||||
if (svc.indexOf("pptp") !== -1) return "PPTP"
|
||||
if (svc.indexOf("vpnc") !== -1) return "Cisco (vpnc)"
|
||||
if (svc.indexOf("sstp") !== -1) return "SSTP"
|
||||
if (svc) {
|
||||
var parts = svc.split('.')
|
||||
return parts[parts.length-1]
|
||||
}
|
||||
return "VPN"
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceTextMedium
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
height: 1
|
||||
}
|
||||
}
|
||||
Item { Layout.fillWidth: true; height: 1 }
|
||||
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: rowArea
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: VpnService.toggle(modelData.uuid)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Item {
|
||||
height: 1
|
||||
width: 1
|
||||
}
|
||||
|
||||
Item { height: 1; width: 1 }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user