From 5dc6c071d628c6e540705d11a9e83895871f5b05 Mon Sep 17 00:00:00 2001 From: miruka Date: Wed, 24 Jul 2019 17:40:06 -0400 Subject: [PATCH] Add animation when reloading config file --- src/qml/Shortcuts.qml | 2 +- src/qml/UI.qml | 13 +++++++++++++ src/qml/Window.qml | 2 ++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/qml/Shortcuts.qml b/src/qml/Shortcuts.qml index 912bb1fc..e4c86087 100644 --- a/src/qml/Shortcuts.qml +++ b/src/qml/Shortcuts.qml @@ -19,7 +19,7 @@ Item { Shortcut { sequences: settings.keys ? settings.keys.reloadConfig : [] - onActivated: py.loadSettings() + onActivated: py.loadSettings(() => { mainUI.pressAnimation.start() }) } Shortcut { diff --git a/src/qml/UI.qml b/src/qml/UI.qml index b2238c95..d954e361 100644 --- a/src/qml/UI.qml +++ b/src/qml/UI.qml @@ -11,6 +11,19 @@ import "SidePane" HRectangle { id: mainUI color: theme.ui.background + Component.onCompleted: window.mainUI = mainUI + + property alias pressAnimation: _pressAnimation + + SequentialAnimation { + id: _pressAnimation + HNumberAnimation { + target: mainUI; property: "scale"; from: 1.0; to: 0.9 + } + HNumberAnimation { + target: mainUI; property: "scale"; from: 0.9; to: 1.0 + } + } Connections { target: py diff --git a/src/qml/Window.qml b/src/qml/Window.qml index 02878718..82250564 100644 --- a/src/qml/Window.qml +++ b/src/qml/Window.qml @@ -28,6 +28,8 @@ ApplicationWindow { property bool debug: false property bool ready: false + property var mainUI: null + // Note: settingsChanged(), uiStateChanged(), etc must be called manually property var settings: ({}) onSettingsChanged: py.saveConfig("ui_settings", settings)