mirror of
https://github.com/KDE/latte-dock.git
synced 2024-12-25 09:33:51 +03:00
move Animations AbilityClient into library
This commit is contained in:
parent
270ca3a7df
commit
76ef6c8111
@ -19,6 +19,7 @@
|
||||
|
||||
import QtQuick 2.7
|
||||
|
||||
import org.kde.latte.core 0.2 as LatteCore
|
||||
import org.kde.latte.abilities.definition 0.1 as AbilityDefinition
|
||||
|
||||
AbilityDefinition.Animations {
|
||||
@ -44,7 +45,14 @@ AbilityDefinition.Animations {
|
||||
//! requirements
|
||||
requirements: local.requirements
|
||||
|
||||
readonly property AbilityDefinition.Animations local: AbilityDefinition.Animations{}
|
||||
readonly property AbilityDefinition.Animations local: AbilityDefinition.Animations{
|
||||
active: local.speedFactor.current !== 0
|
||||
hoverPixelSensitivity: 1
|
||||
speedFactor.normal: active ? speedFactor.current : 1.0
|
||||
|
||||
duration.small: LatteCore.Environment.shortDuration
|
||||
duration.large: LatteCore.Environment.longDuration
|
||||
}
|
||||
|
||||
Item {
|
||||
id: ref
|
||||
|
@ -50,7 +50,7 @@ Item {
|
||||
//! optional
|
||||
readonly property alias launchers: _launchers
|
||||
|
||||
Ability.Animations {
|
||||
AbilityClient.Animations {
|
||||
id: _animations
|
||||
bridge: _abilityContainer.bridge
|
||||
}
|
||||
|
@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright 2020 Michail Vourlakos <mvourlakos@gmail.com>
|
||||
*
|
||||
* This file is part of Latte-Dock
|
||||
*
|
||||
* Latte-Dock is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* Latte-Dock is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import QtQuick 2.7
|
||||
|
||||
import org.kde.plasma.plasmoid 2.0
|
||||
|
||||
import org.kde.latte.core 0.2 as LatteCore
|
||||
import org.kde.latte.abilities.client 0.1 as AbilityClient
|
||||
|
||||
AbilityClient.Animations {
|
||||
//! Public Local Properties
|
||||
local {
|
||||
active: speedFactor.current !== 0
|
||||
hoverPixelSensitivity: 1
|
||||
|
||||
speedFactor.normal: active ? speedFactor.current : 1.0
|
||||
speedFactor.current: plasmoid.configuration.durationTime
|
||||
|
||||
duration.small: LatteCore.Environment.shortDuration
|
||||
duration.large: LatteCore.Environment.longDuration
|
||||
|
||||
requirements.zoomFactor: {
|
||||
if (!active || !LatteCore.WindowSystem.compositingActive) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
var hasHighThicknessAnimation = launcherBouncingEnabled || windowInAttentionEnabled || windowAddedInGroupEnabled;
|
||||
|
||||
return hasHighThicknessAnimation ? 1.65 : 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
//! Private Local Properties
|
||||
readonly property bool launcherBouncingEnabled: active && plasmoid.configuration.animationLauncherBouncing
|
||||
readonly property bool windowInAttentionEnabled: active && plasmoid.configuration.animationWindowInAttention
|
||||
readonly property bool newWindowSlidingEnabled: active && plasmoid.configuration.animationNewWindowSliding
|
||||
readonly property bool windowAddedInGroupEnabled: active && plasmoid.configuration.animationWindowAddedInGroup
|
||||
readonly property bool windowRemovedFromGroupEnabled: active && plasmoid.configuration.animationWindowRemovedFromGroup
|
||||
|
||||
}
|
||||
|
@ -127,6 +127,15 @@ Item {
|
||||
|
||||
readonly property alias containsDrag: mouseHandler.containsDrag
|
||||
|
||||
//! Animations
|
||||
readonly property bool launcherBouncingEnabled: appletAbilities.animations.active && plasmoid.configuration.animationLauncherBouncing
|
||||
readonly property bool newWindowSlidingEnabled: appletAbilities.animations.active && plasmoid.configuration.animationNewWindowSliding
|
||||
readonly property bool windowInAttentionEnabled: appletAbilities.animations.active && plasmoid.configuration.animationWindowInAttention
|
||||
readonly property bool windowAddedInGroupEnabled: appletAbilities.animations.active && plasmoid.configuration.animationWindowAddedInGroup
|
||||
readonly property bool windowRemovedFromGroupEnabled: appletAbilities.animations.active && plasmoid.configuration.animationWindowRemovedFromGroup
|
||||
|
||||
readonly property bool hasHighThicknessAnimation: launcherBouncingEnabled || windowInAttentionEnabled || windowAddedInGroupEnabled
|
||||
|
||||
//BEGIN properties
|
||||
property bool groupTasksByDefault: plasmoid.configuration.groupTasksByDefault
|
||||
property bool highlightWindows: hoverAction === LatteTasks.Types.HighlightWindows || hoverAction === LatteTasks.Types.PreviewAndHighlightWindows
|
||||
@ -686,6 +695,9 @@ Item {
|
||||
layout: icList.contentItem
|
||||
tasksModel: tasksModel
|
||||
|
||||
animations.local.speedFactor.current: plasmoid.configuration.durationTime
|
||||
animations.local.requirements.zoomFactor: hasHighThicknessAnimation && LatteCore.WindowSystem.compositingActive ? 1.65 : 1.0
|
||||
|
||||
indexer.updateIsBlocked: root.inDraggingPhase || root.inActivityChange
|
||||
|
||||
indicators.local.isEnabled: !plasmoid.configuration.isInLatteDock
|
||||
|
@ -95,7 +95,7 @@ Item{
|
||||
}
|
||||
|
||||
function startLauncherAnimation(){
|
||||
if(taskItem.abilities.animations.launcherBouncingEnabled){
|
||||
if(root.launcherBouncingEnabled){
|
||||
taskItem.animationStarted();
|
||||
init();
|
||||
taskItem.launcherAction();
|
||||
|
@ -98,8 +98,8 @@ Item{
|
||||
|
||||
function startNewWindowAnimation(){
|
||||
if (!taskItem.abilities.myView.isHidden
|
||||
&& ((taskItem.abilities.animations.windowInAttentionEnabled && isDemandingAttention)
|
||||
|| taskItem.abilities.animations.windowAddedInGroupEnabled)){
|
||||
&& ((root.windowInAttentionEnabled && isDemandingAttention)
|
||||
|| root.windowAddedInGroupEnabled)){
|
||||
newWindowAnimation.init();
|
||||
newWindowAnimationLoader.item.start();
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ SequentialAnimation {
|
||||
&& LatteCore.WindowSystem.compositingActive)
|
||||
|
||||
property bool enabledAnimation: (animation1 || animation4)
|
||||
&& (taskItem.abilities.animations.newWindowSlidingEnabled)
|
||||
&& root.newWindowSlidingEnabled
|
||||
&& !taskItem.inBouncingAnimation
|
||||
&& !taskItem.isSeparator
|
||||
&& taskItem.visible
|
||||
|
@ -41,7 +41,7 @@ Item{
|
||||
}
|
||||
|
||||
function removeTask(){
|
||||
if(!taskIconContainer.toBeDestroyed && taskItem.abilities.animations.windowRemovedFromGroupEnabled){
|
||||
if(!taskIconContainer.toBeDestroyed && root.windowRemovedFromGroupEnabled){
|
||||
removingAnimation.init();
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import org.kde.latte.core 0.2 as LatteCore
|
||||
///item's added Animation
|
||||
SequentialAnimation{
|
||||
id:showWindowAnimation
|
||||
property int speed: taskItem.abilities.animations.newWindowSlidingEnabled ? (1.2 * taskItem.abilities.animations.speedFactor.normal * taskItem.abilities.animations.duration.large) : 0
|
||||
property int speed: root.newWindowSlidingEnabled ? (1.2 * taskItem.abilities.animations.speedFactor.normal * taskItem.abilities.animations.duration.large) : 0
|
||||
property bool animationSent: false
|
||||
|
||||
readonly property string needLengthEvent: showWindowAnimation + "_showwindow"
|
||||
@ -38,7 +38,7 @@ SequentialAnimation{
|
||||
property: "opacity"
|
||||
to: 0
|
||||
//it is not depend to durationTime when animations are active
|
||||
duration: taskItem.abilities.animations.newWindowSlidingEnabled ? 750 : 0
|
||||
duration: root.newWindowSlidingEnabled ? 750 : 0
|
||||
easing.type: Easing.InQuad
|
||||
}
|
||||
//end of ghost animation
|
||||
|
Loading…
Reference in New Issue
Block a user