mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-31 03:10:12 +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;
|
||||
Q_ASSERT( self.data() == this );
|
||||
// will emit Collection::playlistCreated(...)
|
||||
// will emit Collection::playlistDeleted(...)
|
||||
author()->collection()->deleteDynamicPlaylist( self );
|
||||
}
|
||||
|
||||
|
@@ -188,23 +188,23 @@ Tomahawk::EchonestControl::updateWidgets()
|
||||
} else if( selectedType() == "Danceability" ) {
|
||||
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" ) {
|
||||
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" ) {
|
||||
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" ) {
|
||||
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" ) {
|
||||
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" ) {
|
||||
m_currentType = Echonest::DynamicPlaylist::ArtistMinLatitude;
|
||||
QString deg = QString( QChar( 0x00B0 ) );
|
||||
@@ -234,8 +234,6 @@ Tomahawk::EchonestControl::updateWidgets()
|
||||
combo->hide();
|
||||
m_match = QWeakPointer< QWidget >( match );
|
||||
m_input = QWeakPointer< QWidget >( combo );
|
||||
|
||||
updateData();
|
||||
} else if( selectedType() == "Key" ) {
|
||||
m_currentType = Echonest::DynamicPlaylist::Key;
|
||||
|
||||
@@ -265,8 +263,6 @@ Tomahawk::EchonestControl::updateWidgets()
|
||||
combo->hide();
|
||||
m_match = QWeakPointer< QWidget >( match );
|
||||
m_input = QWeakPointer< QWidget >( combo );
|
||||
|
||||
updateData();
|
||||
} else if( selectedType() == "Sorting" ) {
|
||||
m_currentType = Echonest::DynamicPlaylist::Key;
|
||||
|
||||
@@ -299,13 +295,11 @@ Tomahawk::EchonestControl::updateWidgets()
|
||||
combo->hide();
|
||||
m_match = QWeakPointer< QWidget >( match );
|
||||
m_input = QWeakPointer< QWidget >( combo );
|
||||
|
||||
updateData();
|
||||
} else {
|
||||
m_match = QWeakPointer<QWidget>( new QWidget );
|
||||
m_input = QWeakPointer<QWidget>( new QWidget );
|
||||
}
|
||||
|
||||
updateData();
|
||||
calculateSummary();
|
||||
}
|
||||
|
||||
|
@@ -55,8 +55,8 @@ CollapsibleControls::init()
|
||||
{
|
||||
m_timeline = new QTimeLine( 300, this );
|
||||
m_timeline->setUpdateInterval( 8 );
|
||||
m_timeline->setEasingCurve( QEasingCurve::OutBack );
|
||||
m_animHeight = -1;
|
||||
m_collapseAnimation = false;
|
||||
|
||||
connect( m_timeline, SIGNAL( frameChanged( int ) ), this, SLOT( onAnimationStep( int ) ) );
|
||||
connect( m_timeline, SIGNAL( finished() ), this, SLOT( onAnimationFinished() ) );
|
||||
@@ -118,7 +118,9 @@ void
|
||||
CollapsibleControls::toggleCollapse()
|
||||
{
|
||||
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_collapseAnimation = true;
|
||||
if( m_layout->currentWidget() == m_controls ) {
|
||||
m_summary->setText( m_dynplaylist->generator()->sentenceSummary() );
|
||||
m_controls->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Ignored );
|
||||
@@ -139,6 +141,7 @@ CollapsibleControls::toggleCollapse()
|
||||
void
|
||||
CollapsibleControls::onAnimationStep( int step )
|
||||
{
|
||||
qDebug() << "ANIMATION STEP:" << step;
|
||||
resize( width(), step );
|
||||
m_animHeight = step;
|
||||
setMaximumHeight( m_animHeight );
|
||||
@@ -147,10 +150,11 @@ CollapsibleControls::onAnimationStep( int step )
|
||||
void
|
||||
CollapsibleControls::onAnimationFinished()
|
||||
{
|
||||
qDebug() << "ANIMATION DONE:" << m_animHeight;
|
||||
setMaximumHeight( m_animHeight );
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
@@ -43,12 +43,14 @@ public:
|
||||
QList< DynamicControlWrapper* > controls() const;
|
||||
|
||||
virtual QSize sizeHint() const;
|
||||
|
||||
signals:
|
||||
void controlsChanged();
|
||||
void controlChanged( const Tomahawk::dyncontrol_ptr& control );
|
||||
|
||||
private slots:
|
||||
void toggleCollapse();
|
||||
|
||||
void onAnimationStep( int );
|
||||
void onAnimationFinished();
|
||||
|
||||
@@ -66,6 +68,7 @@ private:
|
||||
// animations!
|
||||
QTimeLine* m_timeline;
|
||||
int m_animHeight;
|
||||
bool m_collapseAnimation;
|
||||
};
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user