re-enabled title transition animation. Add animation 'lock' in case title is changed to frequently (e.g. in kmail/thunderbird new mail window). Set the lock duration to 300 milliseconds.
svn path=/trunk/KDE/kdebase/workspace/; revision=1088954
This commit is contained in:
parent
fd47ff5332
commit
c896faa443
4 changed files with 80 additions and 10 deletions
|
@ -811,15 +811,35 @@ namespace Oxygen
|
|||
if( titleAnimationData_.data()->isDirty() )
|
||||
{
|
||||
|
||||
// contrast pixmap
|
||||
titleAnimationData_.data()->setPixmaps(
|
||||
rect,
|
||||
renderTitleText( rect, caption(), color ),
|
||||
renderTitleText( rect, caption(), contrast ) );
|
||||
|
||||
// clear dirty flags
|
||||
titleAnimationData_.data()->setDirty( false );
|
||||
titleAnimationData_.data()->startAnimation();
|
||||
renderTitleText( painter, rect, color, contrast );
|
||||
|
||||
// finish current animation if running
|
||||
if( titleAnimationData_.data()->isAnimated() )
|
||||
{ titleAnimationData_.data()->finishAnimation(); }
|
||||
|
||||
if( !titleAnimationData_.data()->isLocked() )
|
||||
{
|
||||
|
||||
// set pixmaps
|
||||
titleAnimationData_.data()->setPixmaps(
|
||||
rect,
|
||||
renderTitleText( rect, caption(), color ),
|
||||
renderTitleText( rect, caption(), contrast ) );
|
||||
|
||||
titleAnimationData_.data()->startAnimation();
|
||||
renderTitleText( painter, rect, color, contrast );
|
||||
|
||||
} else if( !caption().isEmpty() ) {
|
||||
|
||||
renderTitleText( painter, rect, caption(), color, contrast );
|
||||
|
||||
}
|
||||
|
||||
// lock animations (this must be done whether or not
|
||||
// animation was actually started, in order to extend locking
|
||||
// every time title get changed too rapidly
|
||||
titleAnimationData_.data()->lockAnimations();
|
||||
|
||||
} else if( titleAnimationData_.data()->isAnimated() ) {
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace Oxygen
|
|||
hideTitleBar_( false ),
|
||||
useOxygenShadows_( true ),
|
||||
useAnimations_( true ),
|
||||
animateTitleChange_( false ),
|
||||
animateTitleChange_( true ),
|
||||
animationsDuration_( 150 ),
|
||||
tabsEnabled_( true ),
|
||||
useNarrowButtonSpacing_( false )
|
||||
|
|
|
@ -33,6 +33,9 @@
|
|||
namespace Oxygen
|
||||
{
|
||||
|
||||
// use 300 milliseconds for animation lock
|
||||
const int TitleAnimationData::lockTime_ = 300;
|
||||
|
||||
//_________________________________________________________
|
||||
TitleAnimationData::TitleAnimationData( QObject* parent ):
|
||||
QObject( parent ),
|
||||
|
@ -81,6 +84,25 @@ namespace Oxygen
|
|||
emit pixmapsChanged();
|
||||
}
|
||||
|
||||
//_________________________________________________________
|
||||
void TitleAnimationData::timerEvent( QTimerEvent* e )
|
||||
{
|
||||
|
||||
if( e->timerId() != animationLockTimer_.timerId() )
|
||||
{ return QObject::timerEvent( e ); }
|
||||
|
||||
// stop veto
|
||||
animationLockTimer_.stop();
|
||||
|
||||
if( !isAnimated() )
|
||||
{
|
||||
// triggers pixmap updates
|
||||
reset();
|
||||
emit pixmapsChanged();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//_________________________________________________________
|
||||
void TitleAnimationData::BlendedPixmap::blend( qreal opacity )
|
||||
{
|
||||
|
|
|
@ -33,8 +33,11 @@
|
|||
#include <cassert>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QWeakPointer>
|
||||
#include <QtCore/QBasicTimer>
|
||||
#include <QtCore/QTimerEvent>
|
||||
#include <QtGui/QPixmap>
|
||||
|
||||
|
||||
namespace Oxygen
|
||||
{
|
||||
|
||||
|
@ -94,16 +97,32 @@ namespace Oxygen
|
|||
//@{
|
||||
|
||||
|
||||
//! returns true if animations are locked
|
||||
bool isLocked( void ) const
|
||||
{ return animationLockTimer_.isActive(); }
|
||||
|
||||
//! returns true if title transition animation is currently running
|
||||
bool isAnimated( void ) const
|
||||
{ return animation().data()->isRunning(); }
|
||||
|
||||
//! start animation
|
||||
//! start lock animation timer
|
||||
void lockAnimations( void )
|
||||
{ animationLockTimer_.start( lockTime_, this ); }
|
||||
|
||||
//! start title transition animation
|
||||
void startAnimation( void )
|
||||
{
|
||||
assert( !isAnimated() );
|
||||
animation().data()->start();
|
||||
}
|
||||
|
||||
//! finish title transition animation
|
||||
void finishAnimation( void )
|
||||
{
|
||||
assert( isAnimated() );
|
||||
animation().data()->stop();
|
||||
}
|
||||
|
||||
//@}
|
||||
|
||||
//!@name opacity
|
||||
|
@ -140,6 +159,9 @@ namespace Oxygen
|
|||
|
||||
protected:
|
||||
|
||||
//! timer event
|
||||
void timerEvent( QTimerEvent* );
|
||||
|
||||
//! animation object
|
||||
const Animation::Pointer& animation( void ) const
|
||||
{ return animation_; }
|
||||
|
@ -212,6 +234,12 @@ namespace Oxygen
|
|||
BlendedPixmap contrastPixmap_;
|
||||
BlendedPixmap pixmap_;
|
||||
|
||||
//! lock time (milliseconds
|
||||
static const int lockTime_;
|
||||
|
||||
//! timer used to disable animations when triggered too early
|
||||
QBasicTimer animationLockTimer_;
|
||||
|
||||
//! title animation
|
||||
Animation::Pointer animation_;
|
||||
|
||||
|
|
Loading…
Reference in a new issue