From 39ad54f9bb74bbc80ede4704b7d78cf1f6f6ca8f Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Fri, 22 Jan 2021 21:58:37 +0200 Subject: [PATCH] provide visual indicator for multiple tasks --when the user changes Tasks tab settings between different applets, the selected applet is providing an animation --- app/view/containmentinterface.h | 2 + .../package/contents/ui/applet/AppletItem.qml | 3 + .../contents/ui/applet/ItemWrapper.qml | 57 +++++++++++++++++++ .../configuration/pages/TasksConfig.qml | 9 +++ 4 files changed, 71 insertions(+) diff --git a/app/view/containmentinterface.h b/app/view/containmentinterface.h index 8d4d0193e..6062679dc 100644 --- a/app/view/containmentinterface.h +++ b/app/view/containmentinterface.h @@ -108,6 +108,8 @@ signals: void latteTasksModelChanged(); void plasmaTasksModelChanged(); + void appletRequestedVisualIndicator(const int &plasmoidId); + private slots: void identifyShortcutsHost(); void identifyMethods(); diff --git a/containment/package/contents/ui/applet/AppletItem.qml b/containment/package/contents/ui/applet/AppletItem.qml index 8578d337e..524ef8fde 100644 --- a/containment/package/contents/ui/applet/AppletItem.qml +++ b/containment/package/contents/ui/applet/AppletItem.qml @@ -721,7 +721,10 @@ Item { appletItem.isExpanded = false; } } + + } + ///END connections //! It is used for any communication needed with the underlying applet diff --git a/containment/package/contents/ui/applet/ItemWrapper.qml b/containment/package/contents/ui/applet/ItemWrapper.qml index 7f01fd5b2..74387eb12 100644 --- a/containment/package/contents/ui/applet/ItemWrapper.qml +++ b/containment/package/contents/ui/applet/ItemWrapper.qml @@ -617,6 +617,63 @@ Item{ visible: clickedAnimation.running && !indicators.info.providesClickedAnimation } + Loader { + id: visualIndicator + anchors.fill: parent + active: showVisualIndicatorRequested + + property bool showVisualIndicatorRequested: false + + Connections { + target: root.latteView ? root.latteView.extendedInterface : null + onAppletRequestedVisualIndicator: { + if (plasmoidId === appletItem.applet.id) { + visualIndicator.showVisualIndicatorRequested = true; + } + } + } + + sourceComponent: Rectangle { + id: visualIndicatorRectangle + color: theme.highlightColor + opacity: 0 + radius: 4 + + Component.onCompleted: showVisualIndicatorAnimation.running = true; + + SequentialAnimation{ + id: showVisualIndicatorAnimation + alwaysRunToEnd: true + + PropertyAnimation { + target: visualIndicatorRectangle + property: "opacity" + to: 0.6 + duration: 3*appletItem.animations.duration.large + easing.type: Easing.OutQuad + } + + PauseAnimation { + duration: 1500 + } + + PropertyAnimation { + target: visualIndicatorRectangle + property: "opacity" + to: 0 + duration: 3*appletItem.animations.duration.large + easing.type: Easing.OutQuad + } + + ScriptAction { + script: { + visualIndicator.showVisualIndicatorRequested = false; + } + } + } + } + } + /* onHeightChanged: { if ((index == 1)|| (index==3)){ console.log("H: "+index+" ("+zoomScale+"). "+currentLayout.children[1].height+" - "+currentLayout.children[3].height+" - "+(currentLayout.children[1].height+currentLayout.children[3].height)); diff --git a/shell/package/contents/configuration/pages/TasksConfig.qml b/shell/package/contents/configuration/pages/TasksConfig.qml index cea58cb48..fd25fb091 100644 --- a/shell/package/contents/configuration/pages/TasksConfig.qml +++ b/shell/package/contents/configuration/pages/TasksConfig.qml @@ -32,11 +32,20 @@ import org.kde.latte.components 1.0 as LatteComponents import org.kde.latte.private.tasks 0.1 as LatteTasks PlasmaComponents.Page { + id: _tabsPage Layout.maximumWidth: content.width + content.Layout.leftMargin * 2 Layout.maximumHeight: content.height + units.smallSpacing * 2 property bool disableAllWindowsFunctionality: tasks.configuration.hideAllTasks + readonly property bool isCurrentPage: (tabGroup.currentTab === _tabsPage) + + onIsCurrentPageChanged: { + if (isCurrentPage && latteView.extendedInterface.latteTasksModel.count>1) { + latteView.extendedInterface.appletRequestedVisualIndicator(tasks.id); + } + } + ColumnLayout { id: content