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() )
|
if( titleAnimationData_.data()->isDirty() )
|
||||||
{
|
{
|
||||||
|
|
||||||
// contrast pixmap
|
// clear dirty flags
|
||||||
titleAnimationData_.data()->setPixmaps(
|
|
||||||
rect,
|
|
||||||
renderTitleText( rect, caption(), color ),
|
|
||||||
renderTitleText( rect, caption(), contrast ) );
|
|
||||||
|
|
||||||
titleAnimationData_.data()->setDirty( false );
|
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() ) {
|
} else if( titleAnimationData_.data()->isAnimated() ) {
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace Oxygen
|
||||||
hideTitleBar_( false ),
|
hideTitleBar_( false ),
|
||||||
useOxygenShadows_( true ),
|
useOxygenShadows_( true ),
|
||||||
useAnimations_( true ),
|
useAnimations_( true ),
|
||||||
animateTitleChange_( false ),
|
animateTitleChange_( true ),
|
||||||
animationsDuration_( 150 ),
|
animationsDuration_( 150 ),
|
||||||
tabsEnabled_( true ),
|
tabsEnabled_( true ),
|
||||||
useNarrowButtonSpacing_( false )
|
useNarrowButtonSpacing_( false )
|
||||||
|
|
|
@ -33,6 +33,9 @@
|
||||||
namespace Oxygen
|
namespace Oxygen
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// use 300 milliseconds for animation lock
|
||||||
|
const int TitleAnimationData::lockTime_ = 300;
|
||||||
|
|
||||||
//_________________________________________________________
|
//_________________________________________________________
|
||||||
TitleAnimationData::TitleAnimationData( QObject* parent ):
|
TitleAnimationData::TitleAnimationData( QObject* parent ):
|
||||||
QObject( parent ),
|
QObject( parent ),
|
||||||
|
@ -81,6 +84,25 @@ namespace Oxygen
|
||||||
emit pixmapsChanged();
|
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 )
|
void TitleAnimationData::BlendedPixmap::blend( qreal opacity )
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,8 +33,11 @@
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QWeakPointer>
|
#include <QtCore/QWeakPointer>
|
||||||
|
#include <QtCore/QBasicTimer>
|
||||||
|
#include <QtCore/QTimerEvent>
|
||||||
#include <QtGui/QPixmap>
|
#include <QtGui/QPixmap>
|
||||||
|
|
||||||
|
|
||||||
namespace Oxygen
|
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
|
bool isAnimated( void ) const
|
||||||
{ return animation().data()->isRunning(); }
|
{ return animation().data()->isRunning(); }
|
||||||
|
|
||||||
//! start animation
|
//! start lock animation timer
|
||||||
|
void lockAnimations( void )
|
||||||
|
{ animationLockTimer_.start( lockTime_, this ); }
|
||||||
|
|
||||||
|
//! start title transition animation
|
||||||
void startAnimation( void )
|
void startAnimation( void )
|
||||||
{
|
{
|
||||||
assert( !isAnimated() );
|
assert( !isAnimated() );
|
||||||
animation().data()->start();
|
animation().data()->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! finish title transition animation
|
||||||
|
void finishAnimation( void )
|
||||||
|
{
|
||||||
|
assert( isAnimated() );
|
||||||
|
animation().data()->stop();
|
||||||
|
}
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
//!@name opacity
|
//!@name opacity
|
||||||
|
@ -140,6 +159,9 @@ namespace Oxygen
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
//! timer event
|
||||||
|
void timerEvent( QTimerEvent* );
|
||||||
|
|
||||||
//! animation object
|
//! animation object
|
||||||
const Animation::Pointer& animation( void ) const
|
const Animation::Pointer& animation( void ) const
|
||||||
{ return animation_; }
|
{ return animation_; }
|
||||||
|
@ -212,6 +234,12 @@ namespace Oxygen
|
||||||
BlendedPixmap contrastPixmap_;
|
BlendedPixmap contrastPixmap_;
|
||||||
BlendedPixmap pixmap_;
|
BlendedPixmap pixmap_;
|
||||||
|
|
||||||
|
//! lock time (milliseconds
|
||||||
|
static const int lockTime_;
|
||||||
|
|
||||||
|
//! timer used to disable animations when triggered too early
|
||||||
|
QBasicTimer animationLockTimer_;
|
||||||
|
|
||||||
//! title animation
|
//! title animation
|
||||||
Animation::Pointer animation_;
|
Animation::Pointer animation_;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue