used external lib/oxygenanimation class to handle animations in place of QTimeLine. This will make transition to Qt Kinetic easier

svn path=/trunk/KDE/kdebase/workspace/; revision=1050690
This commit is contained in:
Hugo Pereira Da Costa 2009-11-17 21:56:04 +00:00
parent 637ff72e1f
commit 045daadccb
7 changed files with 198 additions and 129 deletions

View file

@ -6,6 +6,7 @@ add_subdirectory( config )
set(kwin_oxygen_SRCS
lib/helper.cpp
lib/tileset.cpp
lib/oxygenanimation.cpp
oxygen.cpp
oxygenbutton.cpp
oxygenclient.cpp

View file

@ -51,7 +51,8 @@ namespace Oxygen
helper_( parent.helper() ),
type_(type),
forceInactive_( false ),
timeLine_( 150, this )
glowAnimation_( new Animation( 150, this ) ),
glowIntensity_(0)
{
setAutoFillBackground(false);
setAttribute(Qt::WA_NoSystemBackground);
@ -64,10 +65,18 @@ namespace Oxygen
setCursor(Qt::ArrowCursor);
setToolTip(tip);
timeLine_.setFrameRange( 0, 1000 );
timeLine_.setCurveShape( QTimeLine::EaseInOutCurve );
connect( &timeLine_, SIGNAL( frameChanged( int ) ), SLOT( update() ) );
connect( &timeLine_, SIGNAL( finished() ), SLOT( update() ) );
// setup animation
glowAnimation().data()->setStartValue( 0 );
glowAnimation().data()->setEndValue( 1.0 );
glowAnimation().data()->setTargetObject( this );
glowAnimation().data()->setPropertyName( "glowIntensity" );
// set curve shape. Warning: this is not portable to Qt Kinetic
glowAnimation().data()->setCurveShape( Animation::EaseInOutCurve );
// setup connections
connect( glowAnimation().data(), SIGNAL( valueChanged( const QVariant& ) ), SLOT( update( void ) ) );
connect( glowAnimation().data(), SIGNAL( finished( void ) ), SLOT( update( void ) ) );
reset(0);
}
@ -79,10 +88,10 @@ namespace Oxygen
//_______________________________________________
QColor OxygenButton::buttonDetailColor(const QPalette &palette)
{
if( client_.timeLineIsRunning() && !forceInactive_ && !client_.isForcedActive()) return KColorUtils::mix(
if( client_.glowIsAnimated() && !forceInactive_ && !client_.isForcedActive()) return KColorUtils::mix(
buttonDetailColor( palette, false ),
buttonDetailColor( palette, true ),
client_.opacity() );
client_.glowIntensity() );
else return buttonDetailColor( palette, isActive() || client_.isForcedActive() );
}
@ -117,9 +126,8 @@ namespace Oxygen
//___________________________________________________
void OxygenButton::reset( unsigned long )
{
timeLine_.setDuration( client_.configuration().animationsDuration() );
}
{ glowAnimation().data()->setDuration( client_.configuration().animationsDuration() ); }
//___________________________________________________
void OxygenButton::enterEvent(QEvent *e)
@ -127,8 +135,8 @@ namespace Oxygen
KCommonDecorationButton::enterEvent(e);
if (status_ != Oxygen::Pressed) status_ = Oxygen::Hovered;
timeLine_.setDirection( QTimeLine::Forward );
if( !timeLineIsRunning() ) timeLine_.start();
glowAnimation().data()->setDirection( Animation::Forward );
if( !isAnimated() ) glowAnimation().data()->start();
}
//___________________________________________________
@ -139,8 +147,8 @@ namespace Oxygen
if( status_ == Oxygen::Hovered )
{
timeLine_.setDirection( QTimeLine::Backward );
if( !timeLineIsRunning() ) timeLine_.start();
glowAnimation().data()->setDirection( Animation::Backward );
if( !isAnimated() ) glowAnimation().data()->start();
}
status_ = Oxygen::Normal;
@ -192,7 +200,7 @@ namespace Oxygen
// base button color
QColor bt = ((type_ == ButtonItemClose && forceInactive_ ) ? client_.backgroundPalette( this, palette ):palette).window().color();
// button icon and glow color depending on timeline state
// button icon and glow color depending on glow intensity
color = (type_ == ButtonItemClose && forceInactive_ ) ?
buttonDetailColor( client_.backgroundPalette( this, palette ) ):
buttonDetailColor( palette );
@ -202,7 +210,7 @@ namespace Oxygen
KColorScheme(palette.currentColorGroup()).decoration(KColorScheme::HoverColor).color();
glow = helper_.calcDarkColor( glow );
if( timeLineIsRunning() ) color = KColorUtils::mix( color, glow, opacity() );
if( isAnimated() ) color = KColorUtils::mix( color, glow, glowIntensity() );
else if( status_ == Oxygen::Hovered ) color = glow;
// button decoration
@ -210,11 +218,11 @@ namespace Oxygen
{
// draw glow on hover
if( timeLineIsRunning() )
if( isAnimated() )
{
// mixed shadow and glow for smooth transition
painter.drawPixmap(0, 0, helper_.windecoButtonGlow( KColorUtils::mix( Qt::black, glow, opacity() ), (21.0*client_.configuration().buttonSize())/22));
painter.drawPixmap(0, 0, helper_.windecoButtonGlow( KColorUtils::mix( Qt::black, glow, glowIntensity() ), (21.0*client_.configuration().buttonSize())/22));
} else if( status_ == Oxygen::Hovered ) {

View file

@ -29,9 +29,9 @@
//////////////////////////////////////////////////////////////////////////////
#include <kcommondecoration.h>
#include <QtCore/QTimeLine>
#include "oxygen.h"
#include "lib/oxygenanimation.h"
namespace Oxygen
{
@ -50,6 +50,9 @@ namespace Oxygen
Q_OBJECT
//! declare animation progress property
Q_PROPERTY( qreal glowIntensity READ glowIntensity WRITE setGlowIntensity )
public:
//! constructor
@ -75,6 +78,21 @@ namespace Oxygen
//! configuration reset
virtual void reset( unsigned long );
//!@name glow animation
//@{
//! return animation object
virtual const Animation::Pointer& glowAnimation() const
{ return glowAnimation_; }
void setGlowIntensity( qreal value )
{ glowIntensity_ = value; }
qreal glowIntensity( void ) const
{ return glowIntensity_; }
//@}
protected:
//! press event
@ -101,13 +119,9 @@ namespace Oxygen
//! color
QColor buttonDetailColor(const QPalette&, bool active );
//! opacity
qreal opacity( void ) const
{ return qreal( timeLine_.currentFrame() ) / qreal(timeLine_.endFrame()); }
//! true if timeline is running
bool timeLineIsRunning( void ) const
{ return timeLine_.state() == QTimeLine::Running; }
//! true if animation is in progress
bool isAnimated( void ) const
{ return glowAnimation().data()->isRunning(); }
//! true if button is active
bool isActive( void ) const;
@ -129,8 +143,12 @@ namespace Oxygen
//! true if button should be forced inactive
bool forceInactive_;
//! timeline used for smooth transitions
QTimeLine timeLine_;
//! glow animation
Animation::Pointer glowAnimation_;
//! glow intensity
qreal glowIntensity_;
};

View file

@ -83,8 +83,10 @@ namespace Oxygen
KCommonDecorationUnstable(b, f),
factory_( f ),
sizeGrip_( 0 ),
timeLine_( 200, this ),
titleTimeLine_( 200, this ),
glowAnimation_( new Animation( 200, this ) ),
titleAnimation_( new Animation( 200, this ) ),
glowIntensity_(0),
titleOpacity_(0),
initialized_( false ),
forceActive_( false ),
mouseButton_( Qt::NoButton ),
@ -114,22 +116,28 @@ namespace Oxygen
widget()->setAutoFillBackground( false );
widget()->setAcceptDrops( true );
// initialize timeLine
timeLine_.setFrameRange( maxAnimationIndex/5, maxAnimationIndex );
timeLine_.setCurveShape( QTimeLine::EaseOutCurve );
connect( &timeLine_, SIGNAL( frameChanged( int ) ), widget(), SLOT( update() ) );
connect( &timeLine_, SIGNAL( finished() ), widget(), SLOT( update() ) );
connect( &timeLine_, SIGNAL( finished() ), this, SLOT( clearForceActive() ) );
// setup glow animation
glowAnimation().data()->setStartValue( 0.1 );
glowAnimation().data()->setEndValue( 0.9 );
glowAnimation().data()->setTargetObject( this );
glowAnimation().data()->setPropertyName( "glowIntensity" );
glowAnimation().data()->setCurveShape( Animation::EaseInOutCurve );
connect( glowAnimation().data(), SIGNAL( valueChanged( const QVariant& ) ), widget(), SLOT( update( void ) ) );
connect( glowAnimation().data(), SIGNAL( finished( void ) ), widget(), SLOT( update( void ) ) );
connect( glowAnimation().data(), SIGNAL( finished() ), this, SLOT( clearForceActive() ) );
// initialize titleTimeLine
titleTimeLine_.setFrameRange( 0, maxAnimationIndex );
titleTimeLine_.setCurveShape( QTimeLine::EaseInOutCurve );
connect( &titleTimeLine_, SIGNAL( frameChanged( int ) ), widget(), SLOT( update() ) );
connect( &titleTimeLine_, SIGNAL( finished() ), widget(), SLOT( update() ) );
connect( &titleTimeLine_, SIGNAL( finished() ), this, SLOT( updateOldCaption() ) );
// setup title animation
titleAnimation().data()->setStartValue( 0 );
titleAnimation().data()->setEndValue( 1 );
titleAnimation().data()->setTargetObject( this );
titleAnimation().data()->setPropertyName( "titleOpacity" );
titleAnimation().data()->setCurveShape( Animation::EaseInOutCurve );
connect( titleAnimation().data(), SIGNAL( valueChanged( const QVariant& ) ), widget(), SLOT( update( void ) ) );
connect( titleAnimation().data(), SIGNAL( finished( void ) ), widget(), SLOT( update( void ) ) );
connect( titleAnimation().data(), SIGNAL( finished( void ) ), this, SLOT( updateOldCaption() ) );
// lists
connect( &itemData_.timeLine(), SIGNAL( finished() ), this, SLOT( clearTargetItem() ) );
connect( itemData_.animation().data(), SIGNAL( finished() ), this, SLOT( clearTargetItem() ) );
// in case of preview, one wants to make the label used
// for the central widget transparent. This allows one to have
@ -168,9 +176,9 @@ namespace Oxygen
configuration_ = factory_->configuration( *this );
// animations duration
timeLine_.setDuration( configuration_.animationsDuration() );
titleTimeLine_.setDuration( configuration_.animationsDuration() );
itemData_.timeLine().setDuration( configuration_.animationsDuration() );
glowAnimation().data()->setDuration( configuration_.animationsDuration() );
titleAnimation().data()->setDuration( configuration_.animationsDuration() );
itemData_.animation().data()->setDuration( configuration_.animationsDuration() );
// should also update animations for buttons
resetButtons();
@ -448,7 +456,6 @@ namespace Oxygen
void OxygenClient::clearTargetItem( void )
{
if( !itemData_.animated() ) return;
if( itemData_.animationType() == AnimationLeave )
{ itemData_.setDirty( true ); }
@ -541,10 +548,10 @@ namespace Oxygen
//_________________________________________________________
QColor OxygenClient::titlebarTextColor(const QPalette &palette)
{
if( timeLineIsRunning() ) return KColorUtils::mix(
if( glowIsAnimated() ) return KColorUtils::mix(
titlebarTextColor( palette, false ),
titlebarTextColor( palette, true ),
opacity() );
glowIntensity() );
else return titlebarTextColor( palette, isActive() );
}
@ -594,7 +601,7 @@ namespace Oxygen
{
// check if outline is needed
if( clientGroupItems().count() < 2 && !itemData_.animated() && !( isActive() && configuration().drawTitleOutline() ) ) return;
if( clientGroupItems().count() < 2 && !itemData_.isAnimated() && !( isActive() && configuration().drawTitleOutline() ) ) return;
// get coordinates relative to the client area
// this is annoying. One could use mapTo if this was taking const QWidget* and not
@ -627,7 +634,7 @@ namespace Oxygen
int titleHeight( layoutMetric( LM_TitleEdgeTop ) + layoutMetric( LM_TitleEdgeBottom ) + layoutMetric( LM_TitleHeight ) );
// make titlebar background darker for tabbed, non-outline window
if( ( clientGroupItems().count() >= 2 || itemData_.animated() ) && !(configuration().drawTitleOutline() && isActive() ) )
if( ( clientGroupItems().count() >= 2 || itemData_.isAnimated() ) && !(configuration().drawTitleOutline() && isActive() ) )
{
QPoint topLeft( r.topLeft()-position );
@ -767,7 +774,7 @@ namespace Oxygen
const int titleTop = layoutMetric(LM_TitleEdgeTop) + r.top();
QColor local( color );
if( timeLineIsRunning() ) local = helper().alphaColor( color, opacity() );
if( glowIsAnimated() ) local = helper().alphaColor( color, glowIntensity() );
helper().drawSeparator( painter, QRect(r.top(), titleTop+titleHeight-1.5, r.width(), 2).translated( -position ), local, Qt::Horizontal);
if (clipRect.isValid()) { painter->restore(); }
@ -808,7 +815,7 @@ namespace Oxygen
void OxygenClient::renderTitleText( QPainter* painter, const QRect& rect, const QColor& color, const QColor& contrast ) const
{
if( titleTimeLineIsRunning() )
if( titleIsAnimated() )
{
if( !oldCaption().isEmpty() ) {
@ -873,7 +880,7 @@ namespace Oxygen
QRect textRect( item.boundingRect_.adjusted( 0, layoutMetric( LM_TitleEdgeTop )-1, 0, -1 ) );
// add extra space needed for title outline
if( itemCount > 1 || itemData_.animated() )
if( itemCount > 1 || itemData_.isAnimated() )
{ textRect.adjust( layoutMetric( LM_TitleBorderLeft ), 0, -layoutMetric(LM_TitleBorderRight), 0 ); }
// add extra space for the button
@ -891,7 +898,7 @@ namespace Oxygen
if( itemCount == 1 ) {
textRect = titleBoundingRect( painter->font(), textRect, caption );
if( itemData_.animated() ) {
if( itemData_.isAnimated() ) {
renderTitleOutline( painter, item.boundingRect_, palette );
@ -976,7 +983,7 @@ namespace Oxygen
//_______________________________________________________________________
void OxygenClient::renderTargetRect( QPainter* p, const QPalette& palette )
{
if( itemData_.targetRect().isNull() || itemData_.timeLineIsRunning() ) return;
if( itemData_.targetRect().isNull() || itemData_.isAnimationRunning() ) return;
p->save();
QColor color = palette.color(QPalette::Highlight);
@ -1084,9 +1091,8 @@ namespace Oxygen
// reset animation
if( animateActiveChange() )
{
timeLine_.setDirection( isActive() ? QTimeLine::Forward : QTimeLine::Backward );
if(timeLine_.state() == QTimeLine::NotRunning )
{ timeLine_.start(); }
glowAnimation().data()->setDirection( isActive() ? Animation::Forward : Animation::Backward );
if(!glowIsAnimated()) { glowAnimation().data()->start(); }
}
// update size grip so that it gets the right color
@ -1120,8 +1126,7 @@ namespace Oxygen
KCommonDecorationUnstable::captionChange();
if( !animateTitleChange() ) return;
if( titleTimeLineIsRunning() ) titleTimeLine_.stop();
titleTimeLine_.start();
titleAnimation().data()->restart();
}
@ -1131,12 +1136,12 @@ namespace Oxygen
if( configuration().drawTitleOutline() )
{
if( timeLineIsRunning() && !isForcedActive() )
if( glowIsAnimated() && !isForcedActive() )
{
QColor inactiveColor( backgroundColor( widget, palette, false ) );
QColor activeColor( backgroundColor( widget, palette, true ) );
QColor mixed( KColorUtils::mix( inactiveColor, activeColor, opacity() ) );
QColor mixed( KColorUtils::mix( inactiveColor, activeColor, glowIntensity() ) );
palette.setColor( widget->window()->backgroundRole(), mixed );
palette.setColor( QPalette::Button, mixed );
@ -1279,11 +1284,10 @@ namespace Oxygen
{
TileSet *tileSet( 0 );
if( configuration().useOxygenShadows() && timeLineIsRunning() && !isForcedActive() )
if( configuration().useOxygenShadows() && glowIsAnimated() && !isForcedActive() )
{
int frame = timeLine_.currentFrame();
if( timeLine_.direction() == QTimeLine::Backward ) frame -= timeLine_.startFrame();
int frame = maxAnimationIndex*glowIntensity();
tileSet = shadowCache().tileSet( this, frame );
} else tileSet = shadowCache().tileSet( this );
@ -1379,7 +1383,7 @@ namespace Oxygen
renderTargetRect( &painter, widget()->palette() );
// separator
if( itemCount == 1 && !itemData_.animated() && drawSeparator() )
if( itemCount == 1 && !itemData_.isAnimated() && drawSeparator() )
{ renderSeparator(&painter, frame, widget(), color ); }
}
@ -1543,7 +1547,7 @@ namespace Oxygen
if( dragStartTimer_.isActive() ) dragStartTimer_.stop();
itemData_.animate( AnimationLeave|AnimationSameTarget, sourceItem_ );
} else if( itemData_.animated() ) {
} else if( itemData_.isAnimated() ) {
itemData_.animate( AnimationLeave );

View file

@ -31,10 +31,10 @@
#include "oxygen.h"
#include "oxygenclientgroupitemdata.h"
#include "oxygenconfiguration.h"
#include "lib/oxygenanimation.h"
#include "lib/helper.h"
#include <kcommondecoration.h>
#include <QtCore/QTimeLine>
#include <QBasicTimer>
#include <QTimerEvent>
@ -47,6 +47,12 @@ namespace Oxygen
Q_OBJECT
//! declare glow intensity property
Q_PROPERTY( qreal glowIntensity READ glowIntensity WRITE setGlowIntensity )
//! declare title opacity
Q_PROPERTY( qreal titleOpacity READ titleOpacity WRITE setTitleOpacity )
public:
//! constructor
@ -71,9 +77,9 @@ namespace Oxygen
virtual bool isMaximized( void ) const
{ return maximizeMode()==MaximizeFull && !options()->moveResizeMaximizedWindows(); }
//! return true if timeLine is running
bool timeLineIsRunning( void ) const
{ return timeLine_.state() == QTimeLine::Running; }
//! true if glow is animated
bool glowIsAnimated( void ) const
{ return glowAnimation_.data()->isRunning(); }
//! true when decoration is forced active
bool isForcedActive( void ) const
@ -83,7 +89,7 @@ namespace Oxygen
bool drawSeparator( void ) const
{
return
( timeLineIsRunning() || isActive() ) &&
( glowIsAnimated() || isActive() ) &&
configuration().drawSeparator() &&
!configuration().hideTitleBar() &&
!configuration().drawTitleOutline();
@ -104,9 +110,19 @@ namespace Oxygen
const OxygenConfiguration& configuration( void ) const
{ return configuration_; }
//! return timeLine
const QTimeLine& timeLine( void ) const
{ return timeLine_; }
//!@name glow animation
//@{
virtual const Animation::Pointer& glowAnimation( void ) const
{ return glowAnimation_; }
void setGlowIntensity( qreal value )
{ glowIntensity_ = value; }
qreal glowIntensity( void ) const
{ return glowIntensity_; }
//@}
//! helper class
OxygenHelper& helper( void ) const
@ -116,14 +132,6 @@ namespace Oxygen
OxygenShadowCache& shadowCache( void ) const
{ return factory_->shadowCache(); }
//! return animation opacity
qreal opacity( void ) const
{
int frame( timeLine_.currentFrame() );
if( timeLine_.direction() == QTimeLine::Backward ) frame -= timeLine_.startFrame();
return qreal( frame )/qreal( timeLine_.endFrame() );
}
//!@name metrics and color definitions
//@{
@ -267,13 +275,22 @@ namespace Oxygen
//! return pixmap corresponding to a given tab, for dragging
QPixmap itemDragPixmap( int, const QRect& );
//! title timeline
bool titleTimeLineIsRunning( void ) const
{ return titleTimeLine_.state() == QTimeLine::Running; }
//!@name title animation
//@{
const Animation::Pointer& titleAnimation( void ) const
{ return titleAnimation_; }
bool titleIsAnimated( void ) const
{ return titleAnimation().data()->isRunning(); }
//! title opacity
qreal titleOpacity( void ) const
{ return qreal( titleTimeLine_.currentFrame() )/qreal( titleTimeLine_.endFrame() ); }
{ return titleOpacity_; }
void setTitleOpacity( qreal value )
{ titleOpacity_ = value; }
//@}
//! old caption if any
const QString& oldCaption( void ) const
@ -361,11 +378,17 @@ namespace Oxygen
//! configuration
OxygenConfiguration configuration_;
//! animation timeLine
QTimeLine timeLine_;
//! glow animation
Animation::Pointer glowAnimation_;
//! title animation timeLine
QTimeLine titleTimeLine_;
//! title animation
Animation::Pointer titleAnimation_;
//! glow intensity
qreal glowIntensity_;
//! title opacity
qreal titleOpacity_;
//! old caption
QString oldCaption_;

View file

@ -39,15 +39,23 @@ namespace Oxygen
QObject( parent ),
QList<ClientGroupItemData>(),
client_( *parent ),
timeLine_( 150, this ),
animation_( new Animation( 150, this ) ),
animationType_( AnimationNone ),
progress_(0),
draggedItem_( NoItem ),
targetItem_( NoItem )
{
timeLine_.setFrameRange( 0, maxAnimationIndex );
timeLine_.setCurveShape( QTimeLine::EaseInOutCurve );
connect( &timeLine_, SIGNAL( frameChanged( int ) ), this, SLOT( updateBoundingRects() ) );
connect( &timeLine_, SIGNAL( finished() ), this, SLOT( updateBoundingRects() ) );
// setup animation
animation().data()->setStartValue( 0 );
animation().data()->setEndValue( 1.0 );
animation().data()->setTargetObject( this );
animation().data()->setPropertyName( "progress" );
// setup connections
connect( animation().data(), SIGNAL( valueChanged( const QVariant& ) ), SLOT( updateBoundingRects( void ) ) );
connect( animation().data(), SIGNAL( finished( void ) ), SLOT( updateBoundingRects( void ) ) );
}
//________________________________________________________________
@ -76,7 +84,7 @@ namespace Oxygen
if( type == AnimationNone )
{
if( timeLineIsRunning() ) timeLine().stop();
if( isAnimationRunning() ) animation().data()->stop();
targetItem_ = NoItem;
draggedItem_ = NoItem;
targetRect_ = QRect();
@ -94,8 +102,8 @@ namespace Oxygen
} else if( (type&AnimationMove) && targetItem_ == target ) return;
// check timeLine
if( timeLineIsRunning() ) timeLine().stop();
// check animation state
if( isAnimationRunning() ) animation().data()->stop();
targetItem_ = target;
targetRect_ = QRect();
@ -149,7 +157,7 @@ namespace Oxygen
targetRect_.setWidth( width );
}
if( animate ) timeLine().start();
if( animate ) animation().data()->start();
else {
for( int index = 0; index < count(); index++ )
@ -164,8 +172,8 @@ namespace Oxygen
} else if( type & AnimationLeave ) {
// stop timeLine
if( timeLineIsRunning() ) timeLine().stop();
// stop animation state
if( isAnimationRunning() ) animation().data()->stop();
// reset target
targetItem_ = NoItem;
@ -228,7 +236,7 @@ namespace Oxygen
}
timeLine().start();
animation().data()->start();
}
@ -294,7 +302,7 @@ namespace Oxygen
void ClientGroupItemDataList::updateBoundingRects( bool alsoUpdate )
{
qreal ratio( ClientGroupItemDataList::ratio() );
qreal ratio( ClientGroupItemDataList::progress() );
for( iterator iter = begin(); iter != end(); iter++ )
{

View file

@ -29,11 +29,11 @@
//////////////////////////////////////////////////////////////////////////////
#include "oxygenbutton.h"
#include "lib/oxygenanimation.h"
#include <QtCore/QList>
#include <QtCore/QWeakPointer>
#include <QtCore/QRect>
#include <QtCore/QTimeLine>
namespace Oxygen
{
@ -102,6 +102,9 @@ namespace Oxygen
Q_OBJECT
//! declare animation progress property
Q_PROPERTY( qreal progress READ progress WRITE setProgress )
public:
//! invalid item index
@ -119,7 +122,7 @@ namespace Oxygen
{ return dirty_; }
//! true if being animated
bool animated( void ) const
bool isAnimated( void ) const
{ return animationType_ != AnimationNone; }
//! animation type
@ -137,39 +140,40 @@ namespace Oxygen
/* might need to add the side of the target here */
void animate( AnimationTypes, int = NoItem );
//! true if animation is in progress
bool isAnimationRunning( void ) const
{ return animation().data()->isRunning(); }
//! update button activity
void updateButtonActivity( int visibleItem ) const;
//! update buttons
void updateButtons( bool alsoUpdate ) const;
//! get timeLine
const QTimeLine& timeLine( void ) const
{ return timeLine_; }
//! get timeLine
QTimeLine& timeLine( void )
{ return timeLine_; }
//! true if timeLine is running
bool timeLineIsRunning( void ) const
{ return timeLine().state() == QTimeLine::Running; }
//! target rect
const QRect& targetRect( void ) const
{ return targetRect_; }
//!@name animation progress
//@{
//! return animation object
virtual const Animation::Pointer& animation() const
{ return animation_; }
void setProgress( qreal value )
{ progress_ = value; }
qreal progress( void ) const
{ return progress_; }
//@}
protected slots:
//! update bounding rects
void updateBoundingRects( bool alsoUpdate = true );
protected:
//! timeLine ratio
qreal ratio( void )
{ return qreal( timeLine().currentFrame() ) / qreal( timeLine().endFrame() ); }
private:
//! client
@ -179,12 +183,15 @@ namespace Oxygen
/* used to trigger update at next paintEvent */
bool dirty_;
//! animation timeline
QTimeLine timeLine_;
//! animation
Animation::Pointer animation_;
//! last animation
//! last animation type
AnimationTypes animationType_;
//! animation progress
qreal progress_;
//! dragged item
int draggedItem_;