mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-01 09:18:07 +00:00
startupfeedback: Iron out animation
This commit is contained in:
parent
76177166cf
commit
4b99637427
1 changed files with 20 additions and 8 deletions
|
|
@ -24,18 +24,15 @@ MouseArea { // use mousearea to ensure clicks don't go behind
|
||||||
property alias backgroundColor: background.color
|
property alias backgroundColor: background.color
|
||||||
property alias icon: icon.source
|
property alias icon: icon.source
|
||||||
|
|
||||||
|
property bool __openRequested: false
|
||||||
|
|
||||||
function open(splashIcon, title, x, y, sourceIconSize) {
|
function open(splashIcon, title, x, y, sourceIconSize) {
|
||||||
iconParent.scale = sourceIconSize/iconParent.width;
|
iconParent.scale = sourceIconSize/iconParent.width;
|
||||||
background.scale = 0;
|
background.scale = 0;
|
||||||
backgroundParent.x = -root.width/2 + x
|
backgroundParent.x = -root.width/2 + x
|
||||||
backgroundParent.y = -root.height/2 + y
|
backgroundParent.y = -root.height/2 + y
|
||||||
|
__openRequested = true;
|
||||||
updateIconSource(splashIcon);
|
updateIconSource(splashIcon);
|
||||||
|
|
||||||
if (ShellSettings.Settings.animationsEnabled) {
|
|
||||||
openAnimComplex.restart();
|
|
||||||
} else {
|
|
||||||
openAnimSimple.restart();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function close() {
|
function close() {
|
||||||
|
|
@ -43,6 +40,16 @@ MouseArea { // use mousearea to ensure clicks don't go behind
|
||||||
colorGenerator.resetColor();
|
colorGenerator.resetColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// call this after everything has loaded
|
||||||
|
function actuallyOpen() {
|
||||||
|
__openRequested = false;
|
||||||
|
if (ShellSettings.Settings.animationsEnabled) {
|
||||||
|
openAnimComplex.restart();
|
||||||
|
} else {
|
||||||
|
openAnimSimple.restart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// close when an app opens
|
// close when an app opens
|
||||||
property bool windowActive: Window.active
|
property bool windowActive: Window.active
|
||||||
onWindowActiveChanged: root.close();
|
onWindowActiveChanged: root.close();
|
||||||
|
|
@ -60,13 +67,13 @@ MouseArea { // use mousearea to ensure clicks don't go behind
|
||||||
target: WindowPlugin.WindowUtil
|
target: WindowPlugin.WindowUtil
|
||||||
|
|
||||||
function onAppActivationStarted(appId, iconName) {
|
function onAppActivationStarted(appId, iconName) {
|
||||||
if (!openAnimComplex.running) {
|
if (!openAnimComplex.running && !root.__openRequested) {
|
||||||
iconParent.scale = 0.5;
|
iconParent.scale = 0.5;
|
||||||
background.scale = 0.5;
|
background.scale = 0.5;
|
||||||
backgroundParent.x = 0
|
backgroundParent.x = 0
|
||||||
backgroundParent.y = 0
|
backgroundParent.y = 0
|
||||||
|
root.__openRequested = true;
|
||||||
root.updateIconSource(iconName);
|
root.updateIconSource(iconName);
|
||||||
openAnimComplex.restart();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -96,6 +103,11 @@ MouseArea { // use mousearea to ensure clicks don't go behind
|
||||||
}
|
}
|
||||||
function updateColor() {
|
function updateColor() {
|
||||||
colorToUse = colorGenerator.dominant;
|
colorToUse = colorGenerator.dominant;
|
||||||
|
|
||||||
|
// once color is finished updating, start the animation
|
||||||
|
if (root.__openRequested) {
|
||||||
|
root.actuallyOpen();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
onPaletteChanged: {
|
onPaletteChanged: {
|
||||||
// update color once palette has loaded
|
// update color once palette has loaded
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue