animations...

This commit is contained in:
Zacharias-Brohn
2025-11-05 13:41:44 +01:00
parent 2fea7d56bc
commit 70916e4755
3 changed files with 40 additions and 60 deletions
+2
View File
@@ -10,6 +10,8 @@ Singleton {
if (icon.includes("?path=")) { if (icon.includes("?path=")) {
const [name, path] = icon.split("?path="); const [name, path] = icon.split("?path=");
icon = Qt.resolvedUrl(`${path}/${name.slice(name.lastIndexOf("/") + 1)}`); icon = Qt.resolvedUrl(`${path}/${name.slice(name.lastIndexOf("/") + 1)}`);
} else if (icon.includes("qspixmap") && id === "chrome_status_icon_1") {
icon = icon.replace("qspixmap", "icon/discord-tray");
} }
return icon; return icon;
} }
+6 -16
View File
@@ -30,22 +30,12 @@ MouseArea {
IconImage { IconImage {
id: icon id: icon
anchors.fill: parent anchors.centerIn: parent
layer.enabled: true height: 22
width: 22
layer.onEnabledChanged: { source: root.item.icon
if (layer.enabled && status === Image.Ready) mipmap: true
analyser.requestUpdate(); smooth: false
}
onStatusChanged: {
if (layer.enabled && status === Image.Ready)
analyser.requestUpdate();
}
source: GetIcons.getTrayIcon(root.item.id, root.item.icon)
mipmap: false
asynchronous: true asynchronous: true
ImageAnalyser { ImageAnalyser {
+17 -29
View File
@@ -16,9 +16,21 @@ PanelWindow {
property var menuStack: [] property var menuStack: []
property real scaleValue: 0 property real scaleValue: 0
property int height: calcHeight() property int height: calcSize("h")
property int entryHeight: 30 property int entryHeight: 30
property int maxWidth: { property int maxWidth: calcSize("w")
visible: false
color: "transparent"
anchors {
top: true
left: true
right: true
bottom: true
}
function calcSize(String) {
if ( String === "w" ) {
let menuWidth = 0; let menuWidth = 0;
for ( let i = 0; i < listLayout.count; i++ ) { for ( let i = 0; i < listLayout.count; i++ ) {
if ( !listLayout.model.values[i].isSeparator ) { if ( !listLayout.model.values[i].isSeparator ) {
@@ -32,17 +44,7 @@ PanelWindow {
} }
return menuWidth; return menuWidth;
} }
if ( String === "h" ) {
visible: false
color: "transparent"
anchors {
top: true
left: true
right: true
bottom: true
}
function calcHeight() {
let count = 0; let count = 0;
let separatorCount = 0; let separatorCount = 0;
for (let i = 0; i < listLayout.count; i++) { for (let i = 0; i < listLayout.count; i++) {
@@ -58,20 +60,6 @@ PanelWindow {
} }
return (count * entryHeight) + ((count - 1) * 2) + (separatorCount * 3) + 10; return (count * entryHeight) + ((count - 1) * 2) + (separatorCount * 3) + 10;
} }
function calcWidth() {
let menuWidth = 0;
for ( let i = 0; i < listLayout.count; i++ ) {
if ( !listLayout.model.values[i].isSeparator ) {
let entry = listLayout.model.values[i];
tempMetrics.text = entry.text;
let textWidth = tempMetrics.width + 20 + (entry.icon ?? "" ? 30 : 0) + (entry.hasChildren ? 30 : 0);
if ( textWidth > menuWidth ) {
menuWidth = textWidth;
}
}
}
return menuWidth;
} }
function goBack() { function goBack() {
@@ -165,7 +153,7 @@ PanelWindow {
Rectangle { Rectangle {
id: menuRect id: menuRect
x: root.trayItemRect.x - ( menuRect.implicitWidth / 2 ) + 10 x: root.trayItemRect.x - ( menuRect.implicitWidth / 2 ) + 11
y: root.trayItemRect.y - 5 y: root.trayItemRect.y - 5
implicitHeight: root.height implicitHeight: root.height
implicitWidth: root.maxWidth + 20 implicitWidth: root.maxWidth + 20
@@ -213,7 +201,7 @@ PanelWindow {
ListView { ListView {
id: listLayout id: listLayout
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: root.calcHeight() - ( root.menuStack.length > 0 ? root.entryHeight + 10 : 0 ) Layout.preferredHeight: root.height - ( root.menuStack.length > 0 ? root.entryHeight + 10 : 0 )
spacing: 2 spacing: 2
model: ScriptModel { model: ScriptModel {
values: [...root.menu?.children.values] values: [...root.menu?.children.values]