From 0794c0e84f38f96e73fff1cb513320b2b247efd8 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Sat, 1 Dec 2018 09:42:09 +0200 Subject: [PATCH] refactor:blockAnimations moved to View::Effects --rename blockAnimations to animationsBlocked --- app/dock/dockview.cpp | 15 --------------- app/dock/dockview.h | 6 ------ app/dock/effects.cpp | 15 +++++++++++++++ app/dock/effects.h | 8 +++++++- app/dock/positioner.cpp | 8 ++++---- containment/package/contents/ui/main.qml | 2 +- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/app/dock/dockview.cpp b/app/dock/dockview.cpp index 04c4a57e1..611c0abe5 100644 --- a/app/dock/dockview.cpp +++ b/app/dock/dockview.cpp @@ -675,21 +675,6 @@ void DockView::setAlignment(int alignment) emit alignmentChanged(); } -bool DockView::blockAnimations() const -{ - return m_blockAnimations; -} - -void DockView::setBlockAnimations(bool block) -{ - if (m_blockAnimations == block) { - return; - } - - m_blockAnimations = block; - emit blockAnimationsChanged(); -} - bool DockView::themeHasShadow() const { return PanelShadows::self()->enabled(); diff --git a/app/dock/dockview.h b/app/dock/dockview.h index 5aebec5b3..84233812f 100644 --- a/app/dock/dockview.h +++ b/app/dock/dockview.h @@ -66,7 +66,6 @@ class DockView : public PlasmaQuick::ContainmentView Q_OBJECT Q_PROPERTY(bool alternativesIsShown READ alternativesIsShown NOTIFY alternativesIsShownChanged) Q_PROPERTY(bool behaveAsPlasmaPanel READ behaveAsPlasmaPanel WRITE setBehaveAsPlasmaPanel NOTIFY behaveAsPlasmaPanelChanged) - Q_PROPERTY(bool blockAnimations READ blockAnimations WRITE setBlockAnimations NOTIFY blockAnimationsChanged) Q_PROPERTY(bool contextMenuIsShown READ contextMenuIsShown NOTIFY contextMenuIsShownChanged) Q_PROPERTY(bool dockWinBehavior READ dockWinBehavior WRITE setDockWinBehavior NOTIFY dockWinBehaviorChanged) //! Because Latte uses animations, changing to edit mode it may be different than @@ -125,9 +124,6 @@ public: bool behaveAsPlasmaPanel() const; void setBehaveAsPlasmaPanel(bool behavior); - bool blockAnimations() const; - void setBlockAnimations(bool block); - bool contextMenuIsShown() const; bool dockWinBehavior() const; @@ -231,7 +227,6 @@ signals: void alternativesIsShownChanged(); void alignmentChanged(); void behaveAsPlasmaPanelChanged(); - void blockAnimationsChanged(); void contextMenuIsShownChanged(); void currentScreenChanged(); void dockLocationChanged(); @@ -281,7 +276,6 @@ private: bool m_alternativesIsShown{false}; bool m_behaveAsPlasmaPanel{false}; - bool m_blockAnimations{false}; bool m_dockWinBehavior{true}; bool m_inDelete{false}; bool m_inEditMode{false}; diff --git a/app/dock/effects.cpp b/app/dock/effects.cpp index b54920fba..d0cf71ad5 100644 --- a/app/dock/effects.cpp +++ b/app/dock/effects.cpp @@ -59,6 +59,21 @@ void Effects::init() connect(this, SIGNAL(innerShadowChanged()), m_view->corona(), SIGNAL(availableScreenRectChanged())); } +bool Effects::animationsBlocked() const +{ + return m_animationsBlocked; +} + +void Effects::setAnimationsBlocked(bool blocked) +{ + if (m_animationsBlocked == blocked) { + return; + } + + m_animationsBlocked = blocked; + emit animationsBlockedChanged(); +} + bool Effects::colorizerEnabled() const { return m_colorizerEnabled; diff --git a/app/dock/effects.h b/app/dock/effects.h index 31d1d2936..6ae0d2414 100644 --- a/app/dock/effects.h +++ b/app/dock/effects.h @@ -37,12 +37,13 @@ namespace View { class Effects: public QObject { Q_OBJECT - Q_PROPERTY(bool backgroundOpacity READ backgroundOpacity WRITE setBackgroundOpacity NOTIFY backgroundOpacityChanged) + Q_PROPERTY(bool animationsBlocked READ animationsBlocked NOTIFY animationsBlockedChanged) Q_PROPERTY(bool colorizerEnabled READ colorizerEnabled WRITE setColorizerEnabled NOTIFY colorizerEnabledChanged) Q_PROPERTY(bool drawShadows READ drawShadows WRITE setDrawShadows NOTIFY drawShadowsChanged) Q_PROPERTY(bool drawEffects READ drawEffects WRITE setDrawEffects NOTIFY drawEffectsChanged) //! thickness shadow size when is drawn inside the window from qml + Q_PROPERTY(int backgroundOpacity READ backgroundOpacity WRITE setBackgroundOpacity NOTIFY backgroundOpacityChanged) Q_PROPERTY(int innerShadow READ innerShadow WRITE setInnerShadow NOTIFY innerShadowChanged) Q_PROPERTY(QRect mask READ mask WRITE setMask NOTIFY maskChanged) @@ -54,6 +55,9 @@ public: Effects(DockView *parent); virtual ~Effects(); + bool animationsBlocked() const; + void setAnimationsBlocked(bool blocked); + bool colorizerEnabled() const; void setColorizerEnabled(bool enabled); @@ -85,6 +89,7 @@ public slots: void updateEnabledBorders(); signals: + void animationsBlockedChanged(); void backgroundOpacityChanged(); void colorizerEnabledChanged(); void drawShadowsChanged(); @@ -98,6 +103,7 @@ private slots: void init(); private: + bool m_animationsBlocked{false}; bool m_colorizerEnabled{false}; bool m_drawShadows{true}; bool m_drawEffects{false}; diff --git a/app/dock/positioner.cpp b/app/dock/positioner.cpp index 5926f6da3..698d13035 100644 --- a/app/dock/positioner.cpp +++ b/app/dock/positioner.cpp @@ -572,7 +572,7 @@ void Positioner::initSignalingForLocationChangeSliding() if (m_goToLocation != Plasma::Types::Floating) { m_goToLocation = Plasma::Types::Floating; QTimer::singleShot(100, [this]() { - m_view->setBlockAnimations(false); + m_view->effects()->setAnimationsBlocked(false); emit showDockAfterLocationChangeFinished(); m_view->showSettingsWindow(); @@ -590,7 +590,7 @@ void Positioner::initSignalingForLocationChangeSliding() if (m_goToScreen) { m_goToScreen = nullptr; QTimer::singleShot(100, [this]() { - m_view->setBlockAnimations(false); + m_view->effects()->setAnimationsBlocked(false); emit showDockAfterScreenChangeFinished(); m_view->showSettingsWindow(); @@ -608,7 +608,7 @@ void Positioner::initSignalingForLocationChangeSliding() if (!m_moveToLayout.isEmpty() && m_view->managedLayout()) { m_moveToLayout = ""; QTimer::singleShot(100, [this]() { - m_view->setBlockAnimations(false); + m_view->effects()->setAnimationsBlocked(false); emit showDockAfterMovingToLayoutFinished(); m_view->showSettingsWindow(); }); @@ -619,7 +619,7 @@ void Positioner::initSignalingForLocationChangeSliding() //! this is used for both location and screen change cases, this signal //! is send when the sliding-out animation has finished connect(this, &Positioner::hideDockDuringLocationChangeFinished, this, [&]() { - m_view->setBlockAnimations(true); + m_view->effects()->setAnimationsBlocked(true); if (m_goToLocation != Plasma::Types::Floating) { m_view->setLocation(m_goToLocation); diff --git a/containment/package/contents/ui/main.qml b/containment/package/contents/ui/main.qml index 149fa7804..2d84da960 100644 --- a/containment/package/contents/ui/main.qml +++ b/containment/package/contents/ui/main.qml @@ -397,7 +397,7 @@ DragDrop.DropArea { property int tasksCount: latteApplet ? latteApplet.tasksCount : 0 property real durationTime: { - if ((dock && dock.blockAnimations) || !Latte.WindowSystem.compositingActive) { + if ((dock && dock.effects && dock.effects.animationsBlocked) || !Latte.WindowSystem.compositingActive) { return 0; }