controlcenter: corrected launcher animation on data update
This commit is contained in:
parent
4de4a787de
commit
e72fe3f73b
1 changed files with 66 additions and 14 deletions
|
|
@ -434,6 +434,13 @@ RowLayout {
|
||||||
|
|
||||||
property var pane: root.session.launcher.active
|
property var pane: root.session.launcher.active
|
||||||
property string paneId: pane ? (pane.id || pane.entry?.id || "") : ""
|
property string paneId: pane ? (pane.id || pane.entry?.id || "") : ""
|
||||||
|
property Component targetComponent: settings
|
||||||
|
property Component nextComponent: settings
|
||||||
|
property var displayedApp: null
|
||||||
|
|
||||||
|
function getComponentForPane() {
|
||||||
|
return pane ? appDetails : settings;
|
||||||
|
}
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Appearance.padding.large * 2
|
anchors.margins: Appearance.padding.large * 2
|
||||||
|
|
@ -444,18 +451,20 @@ RowLayout {
|
||||||
clip: false
|
clip: false
|
||||||
|
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
sourceComponent: pane ? appDetails : settings
|
sourceComponent: rightLauncherLoader.targetComponent
|
||||||
|
active: true
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
targetComponent = pane ? appDetails : settings;
|
displayedApp = pane;
|
||||||
|
targetComponent = getComponentForPane();
|
||||||
nextComponent = targetComponent;
|
nextComponent = targetComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
property Component targetComponent: settings
|
onItemChanged: {
|
||||||
property Component nextComponent: settings
|
// Ensure displayedApp is set when item is created (for async loading)
|
||||||
|
if (item && pane && displayedApp !== pane) {
|
||||||
function getComponentForPane() {
|
displayedApp = pane;
|
||||||
return pane ? appDetails : settings;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Behavior on paneId {
|
Behavior on paneId {
|
||||||
|
|
@ -474,11 +483,26 @@ RowLayout {
|
||||||
easing.bezierCurve: Appearance.anim.curves.standardAccel
|
easing.bezierCurve: Appearance.anim.curves.standardAccel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
PropertyAction {
|
||||||
|
target: rightLauncherLoader
|
||||||
|
property: "displayedApp"
|
||||||
|
value: rightLauncherLoader.pane
|
||||||
|
}
|
||||||
|
PropertyAction {
|
||||||
|
target: rightLauncherLoader
|
||||||
|
property: "active"
|
||||||
|
value: false
|
||||||
|
}
|
||||||
PropertyAction {
|
PropertyAction {
|
||||||
target: rightLauncherLoader
|
target: rightLauncherLoader
|
||||||
property: "targetComponent"
|
property: "targetComponent"
|
||||||
value: rightLauncherLoader.nextComponent
|
value: rightLauncherLoader.nextComponent
|
||||||
}
|
}
|
||||||
|
PropertyAction {
|
||||||
|
target: rightLauncherLoader
|
||||||
|
property: "active"
|
||||||
|
value: true
|
||||||
|
}
|
||||||
ParallelAnimation {
|
ParallelAnimation {
|
||||||
Anim {
|
Anim {
|
||||||
target: rightLauncherLoader
|
target: rightLauncherLoader
|
||||||
|
|
@ -500,6 +524,19 @@ RowLayout {
|
||||||
nextComponent = getComponentForPane();
|
nextComponent = getComponentForPane();
|
||||||
paneId = pane ? (pane.id || pane.entry?.id || "") : "";
|
paneId = pane ? (pane.id || pane.entry?.id || "") : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onDisplayedAppChanged: {
|
||||||
|
if (displayedApp) {
|
||||||
|
const appId = displayedApp.id || displayedApp.entry?.id;
|
||||||
|
if (Config.launcher.hiddenApps && Config.launcher.hiddenApps.length > 0) {
|
||||||
|
root.hideFromLauncherChecked = Config.launcher.hiddenApps.includes(appId);
|
||||||
|
} else {
|
||||||
|
root.hideFromLauncherChecked = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
root.hideFromLauncherChecked = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -550,7 +587,7 @@ RowLayout {
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
id: iconLoader
|
id: iconLoader
|
||||||
sourceComponent: root.selectedApp ? appIconComponent : defaultIconComponent
|
sourceComponent: rightLauncherLoader.displayedApp ? appIconComponent : defaultIconComponent
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
|
|
@ -558,8 +595,8 @@ RowLayout {
|
||||||
IconImage {
|
IconImage {
|
||||||
implicitSize: Appearance.font.size.extraLarge * 3 * 2
|
implicitSize: Appearance.font.size.extraLarge * 3 * 2
|
||||||
source: {
|
source: {
|
||||||
if (!root.selectedApp) return "image-missing";
|
if (!rightLauncherLoader.displayedApp) return "image-missing";
|
||||||
const entry = root.selectedApp.entry;
|
const entry = rightLauncherLoader.displayedApp.entry;
|
||||||
if (entry && entry.icon) {
|
if (entry && entry.icon) {
|
||||||
return Quickshell.iconPath(entry.icon, "image-missing");
|
return Quickshell.iconPath(entry.icon, "image-missing");
|
||||||
}
|
}
|
||||||
|
|
@ -582,7 +619,7 @@ RowLayout {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
Layout.leftMargin: Appearance.padding.large * 2
|
Layout.leftMargin: Appearance.padding.large * 2
|
||||||
Layout.rightMargin: Appearance.padding.large * 2
|
Layout.rightMargin: Appearance.padding.large * 2
|
||||||
text: root.selectedApp ? (root.selectedApp.name || root.selectedApp.entry?.name || qsTr("Application Details")) : qsTr("Launcher Applications")
|
text: rightLauncherLoader.displayedApp ? (rightLauncherLoader.displayedApp.name || rightLauncherLoader.displayedApp.entry?.name || qsTr("Application Details")) : qsTr("Launcher Applications")
|
||||||
font.pointSize: Appearance.font.size.large
|
font.pointSize: Appearance.font.size.large
|
||||||
font.bold: true
|
font.bold: true
|
||||||
}
|
}
|
||||||
|
|
@ -613,13 +650,28 @@ RowLayout {
|
||||||
|
|
||||||
SwitchRow {
|
SwitchRow {
|
||||||
Layout.topMargin: Appearance.spacing.normal
|
Layout.topMargin: Appearance.spacing.normal
|
||||||
visible: root.selectedApp !== null
|
visible: rightLauncherLoader.displayedApp !== null
|
||||||
label: qsTr("Hide from launcher")
|
label: qsTr("Hide from launcher")
|
||||||
checked: root.hideFromLauncherChecked
|
checked: root.hideFromLauncherChecked
|
||||||
enabled: root.selectedApp !== null
|
enabled: rightLauncherLoader.displayedApp !== null
|
||||||
onToggled: checked => {
|
onToggled: checked => {
|
||||||
root.hideFromLauncherChecked = checked;
|
root.hideFromLauncherChecked = checked;
|
||||||
root.saveHiddenApps(checked);
|
if (rightLauncherLoader.displayedApp) {
|
||||||
|
const appId = rightLauncherLoader.displayedApp.id || rightLauncherLoader.displayedApp.entry?.id;
|
||||||
|
const hiddenApps = Config.launcher.hiddenApps ? [...Config.launcher.hiddenApps] : [];
|
||||||
|
if (checked) {
|
||||||
|
if (!hiddenApps.includes(appId)) {
|
||||||
|
hiddenApps.push(appId);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const index = hiddenApps.indexOf(appId);
|
||||||
|
if (index !== -1) {
|
||||||
|
hiddenApps.splice(index, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Config.launcher.hiddenApps = hiddenApps;
|
||||||
|
Config.save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue