mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-08 06:25:37 -05:00
modules cleanup and qmlfmt everywhere
- throw in 24H clock fix and app drawer fix too
This commit is contained in:
@@ -11,22 +11,22 @@ Rectangle {
|
||||
property var parentScreen: null
|
||||
property real widgetHeight: 30
|
||||
readonly property real horizontalPadding: SettingsData.topBarNoBackground ? 2 : Theme.spacingS
|
||||
|
||||
readonly property int calculatedWidth: SystemTray.items.values.length
|
||||
> 0 ? SystemTray.items.values.length
|
||||
* 24 + horizontalPadding * 2 : 0
|
||||
readonly property int calculatedWidth: SystemTray.items.values.length > 0 ? SystemTray.items.values.length * 24 + horizontalPadding * 2 : 0
|
||||
|
||||
width: calculatedWidth
|
||||
height: widgetHeight
|
||||
radius: SettingsData.topBarNoBackground ? 0 : Theme.cornerRadius
|
||||
color: {
|
||||
if (SystemTray.items.values.length === 0)
|
||||
return "transparent"
|
||||
|
||||
if (SettingsData.topBarNoBackground) return "transparent"
|
||||
const baseColor = Theme.secondaryHover
|
||||
return Qt.rgba(baseColor.r, baseColor.g, baseColor.b,
|
||||
baseColor.a * Theme.widgetTransparency)
|
||||
if (SystemTray.items.values.length === 0) {
|
||||
return "transparent";
|
||||
}
|
||||
|
||||
if (SettingsData.topBarNoBackground) {
|
||||
return "transparent";
|
||||
}
|
||||
|
||||
const baseColor = Theme.secondaryHover;
|
||||
return Qt.rgba(baseColor.r, baseColor.g, baseColor.b, baseColor.a * Theme.widgetTransparency);
|
||||
}
|
||||
visible: SystemTray.items.values.length > 0
|
||||
|
||||
@@ -42,21 +42,22 @@ Rectangle {
|
||||
delegate: Item {
|
||||
property var trayItem: modelData
|
||||
property string iconSource: {
|
||||
let icon = trayItem && trayItem.icon
|
||||
let icon = trayItem && trayItem.icon;
|
||||
if (typeof icon === 'string' || icon instanceof String) {
|
||||
if (icon.includes("?path=")) {
|
||||
const split = icon.split("?path=")
|
||||
if (split.length !== 2)
|
||||
return icon
|
||||
const name = split[0]
|
||||
const path = split[1]
|
||||
const fileName = name.substring(
|
||||
name.lastIndexOf("/") + 1)
|
||||
return `file://${path}/${fileName}`
|
||||
const split = icon.split("?path=");
|
||||
if (split.length !== 2) {
|
||||
return icon;
|
||||
}
|
||||
|
||||
const name = split[0];
|
||||
const path = split[1];
|
||||
const fileName = name.substring(name.lastIndexOf("/") + 1);
|
||||
return `file://${path}/${fileName}`;
|
||||
}
|
||||
return icon
|
||||
return icon;
|
||||
}
|
||||
return ""
|
||||
return "";
|
||||
}
|
||||
|
||||
width: 24
|
||||
@@ -74,7 +75,9 @@ Rectangle {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
IconImage {
|
||||
@@ -94,37 +97,36 @@ Rectangle {
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: mouse => {
|
||||
if (!trayItem)
|
||||
return
|
||||
onClicked: (mouse) => {
|
||||
if (!trayItem) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mouse.button === Qt.LeftButton
|
||||
&& !trayItem.onlyMenu) {
|
||||
trayItem.activate()
|
||||
return
|
||||
}
|
||||
|
||||
if (trayItem.hasMenu) {
|
||||
var globalPos = mapToGlobal(0, 0)
|
||||
var currentScreen = parentScreen
|
||||
|| Screen
|
||||
var screenX = currentScreen.x || 0
|
||||
var relativeX = globalPos.x - screenX
|
||||
menuAnchor.menu = trayItem.menu
|
||||
menuAnchor.anchor.window = parentWindow
|
||||
menuAnchor.anchor.rect = Qt.rect(
|
||||
relativeX,
|
||||
Theme.barHeight + Theme.spacingS,
|
||||
parent.width, 1)
|
||||
menuAnchor.open()
|
||||
}
|
||||
}
|
||||
if (mouse.button === Qt.LeftButton && !trayItem.onlyMenu) {
|
||||
trayItem.activate();
|
||||
return ;
|
||||
}
|
||||
if (trayItem.hasMenu) {
|
||||
const globalPos = mapToGlobal(0, 0);
|
||||
const currentScreen = parentScreen || Screen;
|
||||
const screenX = currentScreen.x || 0;
|
||||
const relativeX = globalPos.x - screenX;
|
||||
menuAnchor.menu = trayItem.menu;
|
||||
menuAnchor.anchor.window = parentWindow;
|
||||
menuAnchor.anchor.rect = Qt.rect(relativeX, Theme.barHeight + Theme.spacingS, parent.width, 1);
|
||||
menuAnchor.open();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
QsMenuAnchor {
|
||||
id: menuAnchor
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user