From fa03ee04a2d82e84915cc7e46e420cd39725376f Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Fri, 12 Feb 2010 01:14:43 +0000 Subject: [PATCH] condition tabbing animations to the 'useAnimation' flag, for consistancy with other animations. begin and final animation states are kept visually unchanged. Only the smooth transition between the two is disabled. svn path=/trunk/KDE/kdebase/workspace/; revision=1088957 --- clients/oxygen/oxygenclient.cpp | 1 + clients/oxygen/oxygenclientgroupitemdata.cpp | 26 +++++++++++++++++--- clients/oxygen/oxygenclientgroupitemdata.h | 11 +++++++++ 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/clients/oxygen/oxygenclient.cpp b/clients/oxygen/oxygenclient.cpp index 1e1ea478ef..a323df96b6 100644 --- a/clients/oxygen/oxygenclient.cpp +++ b/clients/oxygen/oxygenclient.cpp @@ -174,6 +174,7 @@ namespace Oxygen glowAnimation().data()->setDuration( configuration_.animationsDuration() ); titleAnimationData_.data()->setDuration( configuration_.animationsDuration() ); itemData_.animation().data()->setDuration( configuration_.animationsDuration() ); + itemData_.setAnimationsEnabled( configuration_.useAnimations() ); // reset title transitions titleAnimationData_.data()->reset(); diff --git a/clients/oxygen/oxygenclientgroupitemdata.cpp b/clients/oxygen/oxygenclientgroupitemdata.cpp index 8e28aadfe0..43e6b9ffcc 100644 --- a/clients/oxygen/oxygenclientgroupitemdata.cpp +++ b/clients/oxygen/oxygenclientgroupitemdata.cpp @@ -39,6 +39,8 @@ namespace Oxygen QObject( parent ), QList(), client_( *parent ), + dirty_( false ), + animationsEnabled_( true ), animation_( new Animation( 150, this ) ), animationType_( AnimationNone ), progress_(0), @@ -157,8 +159,19 @@ namespace Oxygen targetRect_.setWidth( width ); } - if( animate ) animation().data()->start(); - else { + if( animate ) + { + + if( animationsEnabled() ) animation().data()->start(); + else { + + // change progress to maximum + progress_ = 1; + updateBoundingRects(); + + } + + } else { for( int index = 0; index < count(); index++ ) { @@ -236,7 +249,14 @@ namespace Oxygen } - animation().data()->start(); + if( animationsEnabled() ) animation().data()->start(); + else { + + // change progress to maximum + progress_ = 1; + updateBoundingRects(); + + } } diff --git a/clients/oxygen/oxygenclientgroupitemdata.h b/clients/oxygen/oxygenclientgroupitemdata.h index ae58cc8ac6..a3d79e484d 100644 --- a/clients/oxygen/oxygenclientgroupitemdata.h +++ b/clients/oxygen/oxygenclientgroupitemdata.h @@ -121,6 +121,14 @@ namespace Oxygen bool isDirty( void ) const { return dirty_; } + //! enable animations + void setAnimationsEnabled( bool value ) + { animationsEnabled_ = value; } + + //! animations enabled + bool animationsEnabled( void ) const + { return animationsEnabled_; } + //! true if being animated bool isAnimated( void ) const { return animationType_ != AnimationNone; } @@ -183,6 +191,9 @@ namespace Oxygen /* used to trigger update at next paintEvent */ bool dirty_; + //! true if animations are enabled + bool animationsEnabled_; + //! animation Animation::Pointer animation_;