mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 05:37:29 +02:00
fix some expanding and shrinking
This commit is contained in:
@@ -257,7 +257,7 @@ DynamicPlaylist::reportDeleted( const Tomahawk::dynplaylist_ptr& self )
|
|||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
Q_ASSERT( self.data() == this );
|
Q_ASSERT( self.data() == this );
|
||||||
// will emit Collection::playlistCreated(...)
|
// will emit Collection::playlistDeleted(...)
|
||||||
author()->collection()->deleteDynamicPlaylist( self );
|
author()->collection()->deleteDynamicPlaylist( self );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -188,23 +188,23 @@ Tomahawk::EchonestControl::updateWidgets()
|
|||||||
} else if( selectedType() == "Danceability" ) {
|
} else if( selectedType() == "Danceability" ) {
|
||||||
m_currentType = Echonest::DynamicPlaylist::MinDanceability;
|
m_currentType = Echonest::DynamicPlaylist::MinDanceability;
|
||||||
|
|
||||||
setupMinMaxWidgets( Echonest::DynamicPlaylist::MinDanceability, Echonest::DynamicPlaylist::MaxDanceability, QString(), QString(), 10000 );
|
setupMinMaxWidgets( Echonest::DynamicPlaylist::MinDanceability, Echonest::DynamicPlaylist::MaxDanceability, tr( "Less" ), tr( "More" ), 10000 );
|
||||||
} else if( selectedType() == "Energy" ) {
|
} else if( selectedType() == "Energy" ) {
|
||||||
m_currentType = Echonest::DynamicPlaylist::MinEnergy;
|
m_currentType = Echonest::DynamicPlaylist::MinEnergy;
|
||||||
|
|
||||||
setupMinMaxWidgets( Echonest::DynamicPlaylist::MinEnergy, Echonest::DynamicPlaylist::MaxEnergy, QString(), QString(), 10000 );
|
setupMinMaxWidgets( Echonest::DynamicPlaylist::MinEnergy, Echonest::DynamicPlaylist::MaxEnergy, tr( "Less" ), tr( "More" ), 10000 );
|
||||||
} else if( selectedType() == "Artist Familiarity" ) {
|
} else if( selectedType() == "Artist Familiarity" ) {
|
||||||
m_currentType = Echonest::DynamicPlaylist::ArtistMinFamiliarity;
|
m_currentType = Echonest::DynamicPlaylist::ArtistMinFamiliarity;
|
||||||
|
|
||||||
setupMinMaxWidgets( Echonest::DynamicPlaylist::ArtistMinFamiliarity, Echonest::DynamicPlaylist::ArtistMaxFamiliarity, QString(), QString(), 10000 );
|
setupMinMaxWidgets( Echonest::DynamicPlaylist::ArtistMinFamiliarity, Echonest::DynamicPlaylist::ArtistMaxFamiliarity, tr( "Less" ), tr( "More" ), 10000 );
|
||||||
} else if( selectedType() == "Artist Hotttnesss" ) {
|
} else if( selectedType() == "Artist Hotttnesss" ) {
|
||||||
m_currentType = Echonest::DynamicPlaylist::ArtistMinHotttnesss;
|
m_currentType = Echonest::DynamicPlaylist::ArtistMinHotttnesss;
|
||||||
|
|
||||||
setupMinMaxWidgets( Echonest::DynamicPlaylist::ArtistMinHotttnesss, Echonest::DynamicPlaylist::ArtistMaxHotttnesss, QString(), QString(), 10000 );
|
setupMinMaxWidgets( Echonest::DynamicPlaylist::ArtistMinHotttnesss, Echonest::DynamicPlaylist::ArtistMaxHotttnesss, tr( "Less" ), tr( "More" ), 10000 );
|
||||||
} else if( selectedType() == "Song Hotttnesss" ) {
|
} else if( selectedType() == "Song Hotttnesss" ) {
|
||||||
m_currentType = Echonest::DynamicPlaylist::SongMinHotttnesss;
|
m_currentType = Echonest::DynamicPlaylist::SongMinHotttnesss;
|
||||||
|
|
||||||
setupMinMaxWidgets( Echonest::DynamicPlaylist::SongMinHotttnesss, Echonest::DynamicPlaylist::SongMaxHotttnesss, QString(), QString(), 10000 );
|
setupMinMaxWidgets( Echonest::DynamicPlaylist::SongMinHotttnesss, Echonest::DynamicPlaylist::SongMaxHotttnesss, tr( "Less" ), tr( "More" ), 10000 );
|
||||||
} else if( selectedType() == "Latitude" ) {
|
} else if( selectedType() == "Latitude" ) {
|
||||||
m_currentType = Echonest::DynamicPlaylist::ArtistMinLatitude;
|
m_currentType = Echonest::DynamicPlaylist::ArtistMinLatitude;
|
||||||
QString deg = QString( QChar( 0x00B0 ) );
|
QString deg = QString( QChar( 0x00B0 ) );
|
||||||
@@ -234,8 +234,6 @@ Tomahawk::EchonestControl::updateWidgets()
|
|||||||
combo->hide();
|
combo->hide();
|
||||||
m_match = QWeakPointer< QWidget >( match );
|
m_match = QWeakPointer< QWidget >( match );
|
||||||
m_input = QWeakPointer< QWidget >( combo );
|
m_input = QWeakPointer< QWidget >( combo );
|
||||||
|
|
||||||
updateData();
|
|
||||||
} else if( selectedType() == "Key" ) {
|
} else if( selectedType() == "Key" ) {
|
||||||
m_currentType = Echonest::DynamicPlaylist::Key;
|
m_currentType = Echonest::DynamicPlaylist::Key;
|
||||||
|
|
||||||
@@ -265,8 +263,6 @@ Tomahawk::EchonestControl::updateWidgets()
|
|||||||
combo->hide();
|
combo->hide();
|
||||||
m_match = QWeakPointer< QWidget >( match );
|
m_match = QWeakPointer< QWidget >( match );
|
||||||
m_input = QWeakPointer< QWidget >( combo );
|
m_input = QWeakPointer< QWidget >( combo );
|
||||||
|
|
||||||
updateData();
|
|
||||||
} else if( selectedType() == "Sorting" ) {
|
} else if( selectedType() == "Sorting" ) {
|
||||||
m_currentType = Echonest::DynamicPlaylist::Key;
|
m_currentType = Echonest::DynamicPlaylist::Key;
|
||||||
|
|
||||||
@@ -299,13 +295,11 @@ Tomahawk::EchonestControl::updateWidgets()
|
|||||||
combo->hide();
|
combo->hide();
|
||||||
m_match = QWeakPointer< QWidget >( match );
|
m_match = QWeakPointer< QWidget >( match );
|
||||||
m_input = QWeakPointer< QWidget >( combo );
|
m_input = QWeakPointer< QWidget >( combo );
|
||||||
|
|
||||||
updateData();
|
|
||||||
} else {
|
} else {
|
||||||
m_match = QWeakPointer<QWidget>( new QWidget );
|
m_match = QWeakPointer<QWidget>( new QWidget );
|
||||||
m_input = QWeakPointer<QWidget>( new QWidget );
|
m_input = QWeakPointer<QWidget>( new QWidget );
|
||||||
}
|
}
|
||||||
|
updateData();
|
||||||
calculateSummary();
|
calculateSummary();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -55,8 +55,8 @@ CollapsibleControls::init()
|
|||||||
{
|
{
|
||||||
m_timeline = new QTimeLine( 300, this );
|
m_timeline = new QTimeLine( 300, this );
|
||||||
m_timeline->setUpdateInterval( 8 );
|
m_timeline->setUpdateInterval( 8 );
|
||||||
m_timeline->setEasingCurve( QEasingCurve::OutBack );
|
|
||||||
m_animHeight = -1;
|
m_animHeight = -1;
|
||||||
|
m_collapseAnimation = false;
|
||||||
|
|
||||||
connect( m_timeline, SIGNAL( frameChanged( int ) ), this, SLOT( onAnimationStep( int ) ) );
|
connect( m_timeline, SIGNAL( frameChanged( int ) ), this, SLOT( onAnimationStep( int ) ) );
|
||||||
connect( m_timeline, SIGNAL( finished() ), this, SLOT( onAnimationFinished() ) );
|
connect( m_timeline, SIGNAL( finished() ), this, SLOT( onAnimationFinished() ) );
|
||||||
@@ -118,7 +118,9 @@ void
|
|||||||
CollapsibleControls::toggleCollapse()
|
CollapsibleControls::toggleCollapse()
|
||||||
{
|
{
|
||||||
qDebug() << "TOGGLING SIZEHINTS:" << m_controls->height() << m_summaryWidget->sizeHint();
|
qDebug() << "TOGGLING SIZEHINTS:" << m_controls->height() << m_summaryWidget->sizeHint();
|
||||||
|
m_timeline->setEasingCurve( QEasingCurve::OutBack );
|
||||||
m_timeline->setFrameRange( m_summaryWidget->sizeHint().height(), m_controls->height() );
|
m_timeline->setFrameRange( m_summaryWidget->sizeHint().height(), m_controls->height() );
|
||||||
|
m_collapseAnimation = true;
|
||||||
if( m_layout->currentWidget() == m_controls ) {
|
if( m_layout->currentWidget() == m_controls ) {
|
||||||
m_summary->setText( m_dynplaylist->generator()->sentenceSummary() );
|
m_summary->setText( m_dynplaylist->generator()->sentenceSummary() );
|
||||||
m_controls->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Ignored );
|
m_controls->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Ignored );
|
||||||
@@ -139,6 +141,7 @@ CollapsibleControls::toggleCollapse()
|
|||||||
void
|
void
|
||||||
CollapsibleControls::onAnimationStep( int step )
|
CollapsibleControls::onAnimationStep( int step )
|
||||||
{
|
{
|
||||||
|
qDebug() << "ANIMATION STEP:" << step;
|
||||||
resize( width(), step );
|
resize( width(), step );
|
||||||
m_animHeight = step;
|
m_animHeight = step;
|
||||||
setMaximumHeight( m_animHeight );
|
setMaximumHeight( m_animHeight );
|
||||||
@@ -147,10 +150,11 @@ CollapsibleControls::onAnimationStep( int step )
|
|||||||
void
|
void
|
||||||
CollapsibleControls::onAnimationFinished()
|
CollapsibleControls::onAnimationFinished()
|
||||||
{
|
{
|
||||||
|
qDebug() << "ANIMATION DONE:" << m_animHeight;
|
||||||
setMaximumHeight( m_animHeight );
|
setMaximumHeight( m_animHeight );
|
||||||
m_animHeight = -1;
|
m_animHeight = -1;
|
||||||
|
|
||||||
if( m_layout->currentWidget() == m_controls && m_timeline->direction() == QTimeLine::Backward ) {
|
if( m_collapseAnimation && m_layout->currentWidget() == m_controls && m_timeline->direction() == QTimeLine::Backward ) {
|
||||||
m_layout->setCurrentWidget( m_summaryWidget );
|
m_layout->setCurrentWidget( m_summaryWidget );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -43,12 +43,14 @@ public:
|
|||||||
QList< DynamicControlWrapper* > controls() const;
|
QList< DynamicControlWrapper* > controls() const;
|
||||||
|
|
||||||
virtual QSize sizeHint() const;
|
virtual QSize sizeHint() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void controlsChanged();
|
void controlsChanged();
|
||||||
void controlChanged( const Tomahawk::dyncontrol_ptr& control );
|
void controlChanged( const Tomahawk::dyncontrol_ptr& control );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void toggleCollapse();
|
void toggleCollapse();
|
||||||
|
|
||||||
void onAnimationStep( int );
|
void onAnimationStep( int );
|
||||||
void onAnimationFinished();
|
void onAnimationFinished();
|
||||||
|
|
||||||
@@ -66,6 +68,7 @@ private:
|
|||||||
// animations!
|
// animations!
|
||||||
QTimeLine* m_timeline;
|
QTimeLine* m_timeline;
|
||||||
int m_animHeight;
|
int m_animHeight;
|
||||||
|
bool m_collapseAnimation;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user