1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 03:10:12 +02:00

* Don't animate initial hide.

This commit is contained in:
Christian Muehlhaeuser
2010-11-27 05:24:35 +01:00
parent 90bba51411
commit af4898331a
3 changed files with 11 additions and 7 deletions

View File

@@ -44,7 +44,7 @@ PlaylistManager::PlaylistManager( QObject* parent )
m_splitter->addWidget( m_stack ); m_splitter->addWidget( m_stack );
m_splitter->addWidget( m_queueView ); m_splitter->addWidget( m_queueView );
m_splitter->hide( 1 ); m_splitter->hide( 1, false );
m_widget->layout()->setMargin( 0 ); m_widget->layout()->setMargin( 0 );
m_widget->layout()->addWidget( m_splitter ); m_widget->layout()->addWidget( m_splitter );

View File

@@ -3,6 +3,8 @@
#include <QDebug> #include <QDebug>
#include <QTimeLine> #include <QTimeLine>
#define ANIMATION_TIME 300
AnimatedSplitter::AnimatedSplitter( QWidget* parent ) AnimatedSplitter::AnimatedSplitter( QWidget* parent )
: QSplitter( parent ) : QSplitter( parent )
@@ -14,11 +16,12 @@ AnimatedSplitter::AnimatedSplitter( QWidget* parent )
void void
AnimatedSplitter::show( int index ) AnimatedSplitter::show( int index, bool animate )
{ {
if ( m_greedyIndex < 0 ) if ( m_greedyIndex < 0 )
return; return;
int time = animate ? ANIMATION_TIME : 0;
m_animateIndex = index; m_animateIndex = index;
QWidget* w = widget( index ); QWidget* w = widget( index );
@@ -27,7 +30,7 @@ AnimatedSplitter::show( int index )
m_greedyHeight = widget( m_greedyIndex )->height(); m_greedyHeight = widget( m_greedyIndex )->height();
QTimeLine *timeLine = new QTimeLine( 300, this ); QTimeLine *timeLine = new QTimeLine( time, this );
timeLine->setFrameRange( w->height(), size.height() ); timeLine->setFrameRange( w->height(), size.height() );
timeLine->setUpdateInterval( 10 ); timeLine->setUpdateInterval( 10 );
timeLine->setCurveShape( QTimeLine::EaseOutCurve ); timeLine->setCurveShape( QTimeLine::EaseOutCurve );
@@ -41,11 +44,12 @@ AnimatedSplitter::show( int index )
void void
AnimatedSplitter::hide( int index ) AnimatedSplitter::hide( int index, bool animate )
{ {
if ( m_greedyIndex < 0 ) if ( m_greedyIndex < 0 )
return; return;
int time = animate ? ANIMATION_TIME : 0;
m_animateIndex = index; m_animateIndex = index;
QWidget* w = widget( index ); QWidget* w = widget( index );
@@ -53,7 +57,7 @@ AnimatedSplitter::hide( int index )
m_greedyHeight = widget( m_greedyIndex )->height(); m_greedyHeight = widget( m_greedyIndex )->height();
QTimeLine *timeLine = new QTimeLine( 300, this ); QTimeLine *timeLine = new QTimeLine( time, this );
timeLine->setFrameRange( 25, w->height() ); timeLine->setFrameRange( 25, w->height() );
timeLine->setUpdateInterval( 10 ); timeLine->setUpdateInterval( 10 );
timeLine->setDirection( QTimeLine::Backward ); timeLine->setDirection( QTimeLine::Backward );

View File

@@ -10,8 +10,8 @@ Q_OBJECT
public: public:
explicit AnimatedSplitter( QWidget* parent = 0 ); explicit AnimatedSplitter( QWidget* parent = 0 );
void show( int index ); void show( int index, bool animate = true );
void hide( int index ); void hide( int index, bool animate = true );
void setGreedyWidget( int index ) { m_greedyIndex = index; } void setGreedyWidget( int index ) { m_greedyIndex = index; }