mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-10 07:25:37 -05:00
modules cleanup and qmlfmt everywhere
- throw in 24H clock fix and app drawer fix too
This commit is contained in:
@@ -13,22 +13,25 @@ Rectangle {
|
||||
property string section: "right"
|
||||
property var popupTarget: null
|
||||
property var parentScreen: null
|
||||
readonly property real horizontalPadding: SettingsData.topBarNoBackground ? 0 : Math.max(Theme.spacingXS, Theme.spacingS * (widgetHeight / 30))
|
||||
|
||||
signal toggleVpnPopup()
|
||||
|
||||
readonly property real horizontalPadding: SettingsData.topBarNoBackground ? 0 : Math.max(Theme.spacingXS, Theme.spacingS * (widgetHeight / 30))
|
||||
|
||||
width: Theme.iconSize + horizontalPadding * 2
|
||||
height: widgetHeight
|
||||
radius: SettingsData.topBarNoBackground ? 0 : Theme.cornerRadius
|
||||
color: {
|
||||
if (SettingsData.topBarNoBackground) return "transparent"
|
||||
const base = clickArea.containsMouse || (popupTarget && popupTarget.shouldBeVisible) ? Theme.primaryPressed : Theme.secondaryHover
|
||||
return Qt.rgba(base.r, base.g, base.b, base.a * Theme.widgetTransparency)
|
||||
if (SettingsData.topBarNoBackground) {
|
||||
return "transparent";
|
||||
}
|
||||
|
||||
const base = clickArea.containsMouse || (popupTarget && popupTarget.shouldBeVisible) ? Theme.primaryPressed : Theme.secondaryHover;
|
||||
return Qt.rgba(base.r, base.g, base.b, base.a * Theme.widgetTransparency);
|
||||
}
|
||||
|
||||
DankIcon {
|
||||
id: icon
|
||||
|
||||
name: VpnService.isBusy ? "sync" : (VpnService.connected ? "vpn_lock" : "vpn_key_off")
|
||||
size: Theme.iconSize - 6
|
||||
color: VpnService.connected ? Theme.primary : Theme.surfaceText
|
||||
@@ -41,27 +44,30 @@ Rectangle {
|
||||
to: 360
|
||||
duration: 900
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: clickArea
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onPressed: {
|
||||
if (popupTarget && popupTarget.setTriggerPosition) {
|
||||
var globalPos = mapToGlobal(0, 0)
|
||||
var currentScreen = parentScreen || Screen
|
||||
var screenX = currentScreen.x || 0
|
||||
var relativeX = globalPos.x - screenX
|
||||
popupTarget.setTriggerPosition(relativeX, barHeight + Theme.spacingXS, width, section, currentScreen)
|
||||
const globalPos = mapToGlobal(0, 0);
|
||||
const currentScreen = parentScreen || Screen;
|
||||
const screenX = currentScreen.x || 0;
|
||||
const relativeX = globalPos.x - screenX;
|
||||
popupTarget.setTriggerPosition(relativeX, barHeight + Theme.spacingXS, width, section, currentScreen);
|
||||
}
|
||||
root.toggleVpnPopup()
|
||||
root.toggleVpnPopup();
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: tooltip
|
||||
|
||||
width: Math.max(120, tooltipText.contentWidth + Theme.spacingM * 2)
|
||||
height: tooltipText.contentHeight + Theme.spacingS * 2
|
||||
radius: Theme.cornerRadius
|
||||
@@ -76,19 +82,32 @@ Rectangle {
|
||||
|
||||
Text {
|
||||
id: tooltipText
|
||||
|
||||
anchors.centerIn: parent
|
||||
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)
|
||||
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
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation { duration: Theme.shortDuration; easing.type: Theme.standardEasing }
|
||||
NumberAnimation {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user