mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-01 19:18:28 -04:00
qs: large sweep of dead code removals
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
import QtQuick
|
||||
import Quickshell.Services.Mpris
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property MprisPlayer activePlayer
|
||||
property string artUrl: TrackArtService.resolvedArtUrl
|
||||
property string artUrl: ""
|
||||
property color accentColor: Theme.primary
|
||||
property var cavaService: null
|
||||
property string lastValidArtUrl: ""
|
||||
// Live mpris url — always valid for the current track; fallback so art is never blank.
|
||||
readonly property string rawArtUrl: {
|
||||
@@ -46,7 +47,7 @@ Item {
|
||||
readonly property real blobSpinSpeed: 0.03
|
||||
|
||||
readonly property bool onScreen: visible && (Window.window?.visible ?? false)
|
||||
readonly property bool blobActive: CavaService.cavaAvailable && onScreen && activePlayer?.playbackState === MprisPlaybackState.Playing && showAnimation && albumArtStatus === Image.Ready
|
||||
readonly property bool blobActive: (cavaService?.cavaAvailable ?? false) && onScreen && activePlayer?.playbackState === MprisPlaybackState.Playing && showAnimation && albumArtStatus === Image.Ready
|
||||
property var smoothedBands: [0, 0, 0, 0, 0, 0]
|
||||
property var slowBands: [0, 0, 0, 0, 0, 0]
|
||||
property var bandTargets: [0, 0, 0, 0, 0, 0]
|
||||
@@ -110,7 +111,7 @@ Item {
|
||||
}
|
||||
|
||||
function updateBands() {
|
||||
const vals = CavaService.values;
|
||||
const vals = cavaService?.values;
|
||||
if (!vals || vals.length < 6)
|
||||
return;
|
||||
|
||||
@@ -166,16 +167,16 @@ Item {
|
||||
}
|
||||
|
||||
Loader {
|
||||
active: root.onScreen && activePlayer?.playbackState === MprisPlaybackState.Playing && showAnimation
|
||||
active: root.cavaService && root.onScreen && activePlayer?.playbackState === MprisPlaybackState.Playing && showAnimation
|
||||
sourceComponent: Component {
|
||||
Ref {
|
||||
service: CavaService
|
||||
service: root.cavaService
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: CavaService
|
||||
target: root.cavaService
|
||||
enabled: blobEffect.visible
|
||||
function onValuesChanged() {
|
||||
root.updateBands();
|
||||
@@ -210,8 +211,7 @@ Item {
|
||||
property real energy: 0
|
||||
property vector4d bandsA: Qt.vector4d(0, 0, 0, 0)
|
||||
property vector2d bandsB: Qt.vector2d(0, 0)
|
||||
readonly property color accentColor: MediaAccentService.accent
|
||||
property vector4d fillColor: Qt.vector4d(accentColor.r, accentColor.g, accentColor.b, accentColor.a)
|
||||
property vector4d fillColor: Qt.vector4d(root.accentColor.r, root.accentColor.g, root.accentColor.b, root.accentColor.a)
|
||||
|
||||
Behavior on activation {
|
||||
NumberAnimation {
|
||||
@@ -231,7 +231,7 @@ Item {
|
||||
z: 1
|
||||
imageSource: root._mainSrc
|
||||
fallbackIcon: "album"
|
||||
border.color: MediaAccentService.accent
|
||||
border.color: root.accentColor
|
||||
border.width: 2
|
||||
|
||||
onImageStatusChanged: {
|
||||
@@ -251,7 +251,7 @@ Item {
|
||||
anchors.centerIn: parent
|
||||
z: 2
|
||||
fallbackIcon: ""
|
||||
border.color: MediaAccentService.accent
|
||||
border.color: root.accentColor
|
||||
border.width: 2
|
||||
opacity: 0
|
||||
visible: opacity > 0
|
||||
|
||||
@@ -93,14 +93,8 @@ Item {
|
||||
"label": "popouts"
|
||||
})
|
||||
|
||||
function _frameEdgeInset(side) {
|
||||
if (!screen)
|
||||
return 0;
|
||||
return SettingsData.frameEdgeInsetForSide(screen, side);
|
||||
}
|
||||
|
||||
function _frameGapMargin(side) {
|
||||
return _frameEdgeInset(side) + Theme.popupDistance;
|
||||
return SettingsData.frameEdgeInsetForSide(screen, side) + Theme.popupDistance;
|
||||
}
|
||||
|
||||
function _edgeClearance(side, popupGap, adjacentInset) {
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
import QtQuick
|
||||
import Quickshell.Services.Mpris
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property MprisPlayer activePlayer
|
||||
readonly property real stableLength: MprisController.activePlayerStableLength
|
||||
property real stableLength: 0
|
||||
property color accentColor: Theme.primary
|
||||
property color accentTrackColor: Theme.withAlpha(accentColor, 0.28)
|
||||
property color accentSubtleColor: Theme.withAlpha(accentColor, 0.55)
|
||||
|
||||
property real seekPreviewRatio: -1
|
||||
readonly property real playerValue: {
|
||||
@@ -142,10 +144,10 @@ Item {
|
||||
value: root.value
|
||||
actualValue: root.playerValue
|
||||
showActualPlaybackState: root.isSeeking
|
||||
fillColor: MediaAccentService.accent
|
||||
playheadColor: MediaAccentService.accent
|
||||
trackColor: MediaAccentService.accentTrack
|
||||
actualProgressColor: MediaAccentService.accentSubtle
|
||||
fillColor: root.accentColor
|
||||
playheadColor: root.accentColor
|
||||
trackColor: root.accentTrackColor
|
||||
actualProgressColor: root.accentSubtleColor
|
||||
isPlaying: activePlayer && activePlayer.playbackState === MprisPlaybackState.Playing
|
||||
onFrameTicked: {
|
||||
if (!root.isSeeking)
|
||||
@@ -186,8 +188,8 @@ Item {
|
||||
Item {
|
||||
property real lineWidth: 3
|
||||
property color trackColor: Theme.withAlpha(Theme.surfaceVariant, 0.40)
|
||||
property color fillColor: MediaAccentService.accent
|
||||
property color playheadColor: MediaAccentService.accent
|
||||
property color fillColor: root.accentColor
|
||||
property color playheadColor: root.accentColor
|
||||
property color actualProgressColor: Theme.onSurface_38
|
||||
readonly property real midY: height / 2
|
||||
|
||||
|
||||
@@ -177,7 +177,13 @@ PanelWindow {
|
||||
layer.textureSize: Qt.size(0, 0)
|
||||
opacity: 1
|
||||
|
||||
readonly property color slideoutSurfaceColor: root.customTransparency >= 0 ? Theme.withAlpha(Theme.surfaceContainer, root.customTransparency) : Theme.popupLayerColor(Theme.surfaceContainer)
|
||||
readonly property color slideoutSurfaceColor: {
|
||||
if (root.customTransparency >= 0)
|
||||
return Theme.withAlpha(Theme.surfaceContainer, root.customTransparency);
|
||||
if (Theme.isConnectedEffect)
|
||||
return Theme.connectedSurfaceColor;
|
||||
return Theme.withAlpha(Theme.surfaceContainer, Theme.popupTransparency);
|
||||
}
|
||||
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,237 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import qs.Common
|
||||
import qs.Modals.Common
|
||||
import qs.Modals.FileBrowser
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
LayoutMirroring.enabled: I18n.isRtl
|
||||
LayoutMirroring.childrenInherit: true
|
||||
|
||||
property var parentPopout: null
|
||||
property string expandedUuid: ""
|
||||
property int listHeight: 180
|
||||
|
||||
implicitHeight: 32 + 1 + listHeight + Theme.spacingS * 4 + Theme.spacingM * 2
|
||||
radius: Theme.cornerRadius
|
||||
color: Theme.nestedSurface
|
||||
border.color: Theme.outlineMedium
|
||||
border.width: Theme.layerOutlineWidth
|
||||
|
||||
FileBrowserSurfaceModal {
|
||||
id: fileBrowser
|
||||
browserTitle: I18n.tr("Import VPN")
|
||||
browserIcon: "vpn_key"
|
||||
browserType: "vpn"
|
||||
fileExtensions: VPNService.getFileFilter()
|
||||
parentPopout: root.parentPopout
|
||||
|
||||
onFileSelected: path => {
|
||||
VPNService.importVpn(path.replace("file://", ""));
|
||||
}
|
||||
}
|
||||
|
||||
ConfirmModal {
|
||||
id: deleteConfirm
|
||||
}
|
||||
|
||||
Column {
|
||||
id: contentColumn
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.spacingM
|
||||
spacing: Theme.spacingS
|
||||
|
||||
RowLayout {
|
||||
spacing: Theme.spacingS
|
||||
width: parent.width
|
||||
|
||||
StyledText {
|
||||
text: {
|
||||
if (!DMSNetworkService.connected)
|
||||
return I18n.tr("Active: None");
|
||||
const names = DMSNetworkService.activeNames || [];
|
||||
if (names.length <= 1)
|
||||
return I18n.tr("Active: %1").arg(names[0] || "VPN");
|
||||
return I18n.tr("Active: %1 +%2").arg(names[0]).arg(names.length - 1);
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
elide: Text.ElideRight
|
||||
wrapMode: Text.NoWrap
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
height: 28
|
||||
radius: 14
|
||||
color: importArea.containsMouse ? Theme.primaryHoverLight : Theme.surfaceLight
|
||||
width: 90
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
opacity: VPNService.importing ? 0.5 : 1.0
|
||||
|
||||
Row {
|
||||
anchors.centerIn: parent
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
DankIcon {
|
||||
name: VPNService.importing ? "sync" : "add"
|
||||
size: Theme.fontSizeSmall
|
||||
color: Theme.primary
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: I18n.tr("Import")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.primary
|
||||
font.weight: Font.Medium
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: importArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: VPNService.importing ? Qt.BusyCursor : Qt.PointingHandCursor
|
||||
enabled: !VPNService.importing
|
||||
onClicked: fileBrowser.open()
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
height: 28
|
||||
radius: 14
|
||||
color: discAllArea.containsMouse ? Theme.errorHover : Theme.surfaceLight
|
||||
visible: DMSNetworkService.connected
|
||||
width: 100
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
opacity: DMSNetworkService.isBusy ? 0.5 : 1.0
|
||||
|
||||
Row {
|
||||
anchors.centerIn: parent
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
DankIcon {
|
||||
name: "link_off"
|
||||
size: Theme.fontSizeSmall
|
||||
color: Theme.surfaceText
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: I18n.tr("Disconnect")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: discAllArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: DMSNetworkService.isBusy ? Qt.BusyCursor : Qt.PointingHandCursor
|
||||
enabled: !DMSNetworkService.isBusy
|
||||
onClicked: DMSNetworkService.disconnectAllActive()
|
||||
}
|
||||
}
|
||||
|
||||
DankActionButton {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
iconName: "settings"
|
||||
buttonSize: 28
|
||||
iconSize: 16
|
||||
iconColor: Theme.surfaceVariantText
|
||||
onClicked: {
|
||||
PopoutService.closeControlCenter();
|
||||
PopoutService.openSettingsWithTab("network_vpn");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
height: 1
|
||||
width: parent.width
|
||||
color: Theme.outlineStrong
|
||||
}
|
||||
|
||||
Item {
|
||||
width: parent.width
|
||||
height: root.listHeight
|
||||
|
||||
Column {
|
||||
anchors.centerIn: parent
|
||||
spacing: Theme.spacingS
|
||||
visible: DMSNetworkService.profiles.length === 0
|
||||
|
||||
DankIcon {
|
||||
name: "vpn_key_off"
|
||||
size: 36
|
||||
color: Theme.surfaceVariantText
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: I18n.tr("No VPN profiles")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceVariantText
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: I18n.tr("Click Import to add a .ovpn or .conf")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
}
|
||||
|
||||
DankListView {
|
||||
id: vpnListView
|
||||
anchors.fill: parent
|
||||
visible: DMSNetworkService.profiles.length > 0
|
||||
spacing: Theme.spacingXS
|
||||
cacheBuffer: 200
|
||||
clip: true
|
||||
|
||||
model: ScriptModel {
|
||||
values: DMSNetworkService.profiles
|
||||
objectProp: "uuid"
|
||||
}
|
||||
|
||||
delegate: VpnProfileDelegate {
|
||||
required property var modelData
|
||||
width: vpnListView.width
|
||||
profile: modelData
|
||||
isExpanded: root.expandedUuid === modelData.uuid
|
||||
onToggleExpand: {
|
||||
if (root.expandedUuid === modelData.uuid) {
|
||||
root.expandedUuid = "";
|
||||
return;
|
||||
}
|
||||
root.expandedUuid = modelData.uuid;
|
||||
VPNService.getConfig(modelData.uuid);
|
||||
}
|
||||
onDeleteRequested: {
|
||||
deleteConfirm.showWithOptions({
|
||||
"title": I18n.tr("Delete VPN"),
|
||||
"message": I18n.tr("Delete \"%1\"?").arg(modelData.name),
|
||||
"confirmText": I18n.tr("Delete"),
|
||||
"confirmColor": Theme.error,
|
||||
"onConfirm": () => VPNService.deleteVpn(modelData.uuid)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
width: 1
|
||||
height: Theme.spacingS
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,331 +0,0 @@
|
||||
import QtQuick
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
LayoutMirroring.enabled: I18n.isRtl
|
||||
LayoutMirroring.childrenInherit: true
|
||||
|
||||
required property var profile
|
||||
property bool isExpanded: false
|
||||
readonly property bool isTransient: !!profile?.transient
|
||||
readonly property bool canExpand: profile?.canExpand !== false
|
||||
readonly property bool canDelete: profile?.canDelete !== false
|
||||
|
||||
signal toggleExpand
|
||||
signal deleteRequested
|
||||
|
||||
readonly property bool isActive: DMSNetworkService.vpnStateForUuid(profile?.uuid) === "activated"
|
||||
readonly property bool isConnecting: DMSNetworkService.isVpnConnectingUuid(profile?.uuid)
|
||||
readonly property bool hasError: !isConnecting && DMSNetworkService.vpnError !== "" && DMSNetworkService.vpnErrorUuid === (profile?.uuid ?? "")
|
||||
readonly property bool isHovered: rowArea.containsMouse || expandBtn.containsMouse || deleteBtn.containsMouse
|
||||
readonly property var configData: (!isTransient && isExpanded) ? VPNService.editConfig : null
|
||||
readonly property var configFields: buildConfigFields()
|
||||
|
||||
height: isExpanded ? 46 + expandedContent.height : 46
|
||||
radius: Theme.cornerRadius
|
||||
color: isHovered ? Theme.primaryHoverLight : (isActive ? Theme.primaryPressed : Theme.surfaceLight)
|
||||
border.width: isActive ? 2 : 1
|
||||
border.color: isActive ? Theme.primary : Theme.outlineLight
|
||||
opacity: (DMSNetworkService.isBusy && !isConnecting) ? 0.5 : 1.0
|
||||
clip: true
|
||||
|
||||
function buildConfigFields() {
|
||||
if (!configData)
|
||||
return [];
|
||||
const fields = [];
|
||||
const data = configData.data || {};
|
||||
if (data.remote)
|
||||
fields.push({
|
||||
"key": "server",
|
||||
"label": I18n.tr("Server"),
|
||||
"value": data.remote
|
||||
});
|
||||
if (configData.username || data.username)
|
||||
fields.push({
|
||||
"key": "user",
|
||||
"label": I18n.tr("Username"),
|
||||
"value": configData.username || data.username
|
||||
});
|
||||
if (data.cipher)
|
||||
fields.push({
|
||||
"key": "cipher",
|
||||
"label": I18n.tr("Cipher"),
|
||||
"value": data.cipher
|
||||
});
|
||||
if (data.auth)
|
||||
fields.push({
|
||||
"key": "auth",
|
||||
"label": I18n.tr("Auth"),
|
||||
"value": data.auth
|
||||
});
|
||||
if (data["proto-tcp"] === "yes" || data["proto-tcp"] === "no")
|
||||
fields.push({
|
||||
"key": "proto",
|
||||
"label": I18n.tr("Protocol"),
|
||||
"value": data["proto-tcp"] === "yes" ? "TCP" : "UDP"
|
||||
});
|
||||
if (data["tunnel-mtu"])
|
||||
fields.push({
|
||||
"key": "mtu",
|
||||
"label": I18n.tr("MTU"),
|
||||
"value": data["tunnel-mtu"]
|
||||
});
|
||||
if (data["connection-type"])
|
||||
fields.push({
|
||||
"key": "conntype",
|
||||
"label": I18n.tr("Auth Type"),
|
||||
"value": data["connection-type"]
|
||||
});
|
||||
return fields;
|
||||
}
|
||||
|
||||
Behavior on height {
|
||||
NumberAnimation {
|
||||
duration: 150
|
||||
easing.type: Easing.OutQuad
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: rowArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: DMSNetworkService.isBusy ? Qt.BusyCursor : Qt.PointingHandCursor
|
||||
enabled: !DMSNetworkService.isBusy
|
||||
onClicked: DMSNetworkService.toggle(profile.uuid)
|
||||
}
|
||||
|
||||
Column {
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.spacingS
|
||||
spacing: Theme.spacingS
|
||||
|
||||
Row {
|
||||
width: parent.width
|
||||
height: 46 - Theme.spacingS * 2
|
||||
spacing: Theme.spacingS
|
||||
|
||||
DankSpinner {
|
||||
size: 18
|
||||
strokeWidth: 2
|
||||
color: Theme.warning
|
||||
running: root.isConnecting
|
||||
visible: root.isConnecting
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
DankIcon {
|
||||
visible: !root.isConnecting
|
||||
name: isActive ? "vpn_lock" : (root.hasError ? "error" : "vpn_key_off")
|
||||
size: 20
|
||||
color: root.hasError ? Theme.error : (isActive ? Theme.primary : Theme.surfaceText)
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
Column {
|
||||
spacing: 1
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: parent.width - 20 - ((canExpand ? 28 : 0) + (canDelete ? 28 : 0)) - Theme.spacingS * 4
|
||||
|
||||
StyledText {
|
||||
text: profile?.name ?? ""
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: isActive ? Theme.primary : Theme.surfaceText
|
||||
elide: Text.ElideRight
|
||||
wrapMode: Text.NoWrap
|
||||
width: parent.width
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: root.isConnecting ? I18n.tr("Connecting...") : (root.hasError ? DMSNetworkService.vpnError : VPNService.getVpnTypeFromProfile(profile))
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: root.isConnecting ? Theme.warning : (root.hasError ? Theme.error : Theme.surfaceTextMedium)
|
||||
wrapMode: Text.NoWrap
|
||||
width: parent.width
|
||||
elide: Text.ElideRight
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
width: Theme.spacingXS
|
||||
height: 1
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: 28
|
||||
height: 28
|
||||
radius: 14
|
||||
color: expandBtn.containsMouse ? Theme.surfacePressed : Theme.withAlpha(Theme.surfacePressed, 0)
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: canExpand
|
||||
|
||||
DankIcon {
|
||||
anchors.centerIn: parent
|
||||
name: isExpanded ? "expand_less" : "expand_more"
|
||||
size: 18
|
||||
color: Theme.surfaceText
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: expandBtn
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: root.toggleExpand()
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: 28
|
||||
height: 28
|
||||
radius: 14
|
||||
color: deleteBtn.containsMouse ? Theme.errorHover : Theme.withAlpha(Theme.errorHover, 0)
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: canDelete
|
||||
|
||||
DankIcon {
|
||||
anchors.centerIn: parent
|
||||
name: "delete"
|
||||
size: 18
|
||||
color: deleteBtn.containsMouse ? Theme.error : Theme.surfaceVariantText
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: deleteBtn
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: root.deleteRequested()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
id: expandedContent
|
||||
width: parent.width
|
||||
spacing: Theme.spacingXS
|
||||
visible: isExpanded
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 1
|
||||
color: Theme.outlineLight
|
||||
}
|
||||
|
||||
Item {
|
||||
width: parent.width
|
||||
height: VPNService.configLoading ? 40 : 0
|
||||
visible: VPNService.configLoading
|
||||
|
||||
DankSpinner {
|
||||
anchors.centerIn: parent
|
||||
size: 20
|
||||
}
|
||||
}
|
||||
|
||||
Flow {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingXS
|
||||
visible: !isTransient && !VPNService.configLoading && configData
|
||||
|
||||
Repeater {
|
||||
model: configFields
|
||||
|
||||
delegate: Rectangle {
|
||||
required property var modelData
|
||||
|
||||
width: fieldContent.width + Theme.spacingM * 2
|
||||
height: 32
|
||||
radius: Theme.cornerRadius - 2
|
||||
color: Theme.surfaceLight
|
||||
border.width: 1
|
||||
border.color: Theme.outlineLight
|
||||
|
||||
Row {
|
||||
id: fieldContent
|
||||
anchors.centerIn: parent
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
StyledText {
|
||||
text: modelData.label + ":"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: modelData.value
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DankToggle {
|
||||
width: parent.width
|
||||
text: I18n.tr("Autoconnect")
|
||||
checked: configData ? (configData.autoconnect || false) : false
|
||||
visible: !VPNService.configLoading && configData !== null
|
||||
onToggled: checked => {
|
||||
VPNService.updateConfig(profile.uuid, {
|
||||
autoconnect: checked
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingXS
|
||||
visible: !isTransient && !VPNService.configLoading && profile?.type !== "wireguard"
|
||||
|
||||
StyledText {
|
||||
text: root.hasError ? DMSNetworkService.vpnError : I18n.tr("Credentials")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: root.hasError ? Theme.error : Theme.surfaceVariantText
|
||||
}
|
||||
|
||||
DankTextField {
|
||||
id: usernameField
|
||||
width: parent.width
|
||||
placeholderText: I18n.tr("Username")
|
||||
text: (configData && (configData.username || (configData.data && configData.data.username))) || ""
|
||||
}
|
||||
|
||||
DankTextField {
|
||||
id: passwordField
|
||||
width: parent.width
|
||||
placeholderText: I18n.tr("Password")
|
||||
echoMode: TextInput.Password
|
||||
showPasswordToggle: true
|
||||
normalBorderColor: root.hasError ? Theme.error : Theme.outlineMedium
|
||||
}
|
||||
|
||||
DankButton {
|
||||
text: I18n.tr("Save credentials")
|
||||
opacity: passwordField.text.length > 0 ? 1 : 0.5
|
||||
onClicked: {
|
||||
if (passwordField.text.length === 0)
|
||||
return;
|
||||
VPNService.setCredentials(profile.uuid, usernameField.text, passwordField.text, true);
|
||||
passwordField.text = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
width: 1
|
||||
height: Theme.spacingXS
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user