From 9c5966000c97430a0e667fd9b5b08e0dc1703fbb Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Fri, 30 Mar 2012 17:47:28 -0400 Subject: [PATCH 1/7] TWK-799: Don't set autoupdate when loading playlist view --- src/libtomahawk/infobar/infobar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libtomahawk/infobar/infobar.cpp b/src/libtomahawk/infobar/infobar.cpp index 4296b75ae..bdfe8bd74 100644 --- a/src/libtomahawk/infobar/infobar.cpp +++ b/src/libtomahawk/infobar/infobar.cpp @@ -85,7 +85,7 @@ InfoBar::InfoBar( QWidget* parent ) m_autoUpdate->setText( tr( "Automatically update" ) ); m_autoUpdate->setLayoutDirection( Qt::RightToLeft ); m_autoUpdate->setPalette( whitePal ); - connect( m_autoUpdate, SIGNAL( stateChanged( int ) ), this, SIGNAL( autoUpdateChanged( int ) ) ); + connect( m_autoUpdate, SIGNAL( toggled(bool) ), this, SIGNAL( autoUpdateChanged( int ) ) ); ui->horizontalLayout->addWidget( m_autoUpdate ); From f84d08e0110c5e531e9e518e4fca66b1bbdc7e79 Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Sat, 31 Mar 2012 08:49:18 -0400 Subject: [PATCH 2/7] Don't sort related artists in footnotes --- src/libtomahawk/context/pages/RelatedArtistsContext.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libtomahawk/context/pages/RelatedArtistsContext.cpp b/src/libtomahawk/context/pages/RelatedArtistsContext.cpp index 1c403e5e0..39f632bd6 100644 --- a/src/libtomahawk/context/pages/RelatedArtistsContext.cpp +++ b/src/libtomahawk/context/pages/RelatedArtistsContext.cpp @@ -37,6 +37,8 @@ RelatedArtistsContext::RelatedArtistsContext() m_relatedModel->setColumnStyle( TreeModel::TrackOnly ); m_relatedView->setTreeModel( m_relatedModel ); m_relatedView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); + m_relatedView->setSortingEnabled( false ); + m_relatedView->proxyModel()->sort( -1 ); QPalette pal = m_relatedView->palette(); pal.setColor( QPalette::Window, QColor( 0, 0, 0, 0 ) ); From b3b70cea829de39668a65de9345c409c288417ba Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Sat, 31 Mar 2012 09:05:14 -0400 Subject: [PATCH 3/7] TWK-795: Filter dups from last.fm top artists --- src/libtomahawk/infosystem/infoplugins/generic/lastfmplugin.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libtomahawk/infosystem/infoplugins/generic/lastfmplugin.cpp b/src/libtomahawk/infosystem/infoplugins/generic/lastfmplugin.cpp index bf2d0134c..cff7abe19 100644 --- a/src/libtomahawk/infosystem/infoplugins/generic/lastfmplugin.cpp +++ b/src/libtomahawk/infosystem/infoplugins/generic/lastfmplugin.cpp @@ -585,6 +585,8 @@ LastFmPlugin::topTracksReturned() QNetworkReply* reply = qobject_cast( sender() ); QStringList topTracks = lastfm::Artist::getTopTracks( reply ); + topTracks.removeDuplicates(); + QVariantMap returnedData; returnedData["tracks"] = topTracks; From fb13ccd285e8cf9085ce56ddc283a0ce47cfbfdb Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Sat, 31 Mar 2012 09:26:07 -0400 Subject: [PATCH 4/7] Oops, fix signals/slot params --- src/libtomahawk/infobar/infobar.cpp | 2 +- src/libtomahawk/infobar/infobar.h | 2 +- src/libtomahawk/viewmanager.cpp | 6 +++--- src/libtomahawk/viewmanager.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libtomahawk/infobar/infobar.cpp b/src/libtomahawk/infobar/infobar.cpp index bdfe8bd74..0a5425f50 100644 --- a/src/libtomahawk/infobar/infobar.cpp +++ b/src/libtomahawk/infobar/infobar.cpp @@ -85,7 +85,7 @@ InfoBar::InfoBar( QWidget* parent ) m_autoUpdate->setText( tr( "Automatically update" ) ); m_autoUpdate->setLayoutDirection( Qt::RightToLeft ); m_autoUpdate->setPalette( whitePal ); - connect( m_autoUpdate, SIGNAL( toggled(bool) ), this, SIGNAL( autoUpdateChanged( int ) ) ); + connect( m_autoUpdate, SIGNAL( toggled( bool ) ), this, SIGNAL( autoUpdateChanged( bool ) ) ); ui->horizontalLayout->addWidget( m_autoUpdate ); diff --git a/src/libtomahawk/infobar/infobar.h b/src/libtomahawk/infobar/infobar.h index f16339d52..7f1f9d8ee 100644 --- a/src/libtomahawk/infobar/infobar.h +++ b/src/libtomahawk/infobar/infobar.h @@ -60,7 +60,7 @@ public slots: void setAutoUpdateAvailable( bool b ); signals: void filterTextChanged( const QString& filter ); - void autoUpdateChanged( int state ); + void autoUpdateChanged( bool checked ); protected: void changeEvent( QEvent* e ); diff --git a/src/libtomahawk/viewmanager.cpp b/src/libtomahawk/viewmanager.cpp index ef8008773..cf21a8a74 100644 --- a/src/libtomahawk/viewmanager.cpp +++ b/src/libtomahawk/viewmanager.cpp @@ -112,7 +112,7 @@ ViewManager::ViewManager( QObject* parent ) connect( &m_filterTimer, SIGNAL( timeout() ), SLOT( applyFilter() ) ); connect( m_infobar, SIGNAL( filterTextChanged( QString ) ), SLOT( setFilter( QString ) ) ); - connect( m_infobar, SIGNAL( autoUpdateChanged( int ) ), SLOT( autoUpdateChanged( int ) ) ); + connect( m_infobar, SIGNAL( autoUpdateChanged( bool ) ), SLOT( autoUpdateChanged( bool ) ) ); connect( this, SIGNAL( tomahawkLoaded() ), m_whatsHotWidget, SLOT( fetchData() ) ); connect( this, SIGNAL( tomahawkLoaded() ), m_welcomeWidget, SLOT( loadData() ) ); @@ -537,9 +537,9 @@ ViewManager::applyFilter() void -ViewManager::autoUpdateChanged( int state ) +ViewManager::autoUpdateChanged( bool toggled ) { - currentPage()->setAutoUpdate( state == Qt::Checked ); + currentPage()->setAutoUpdate( toggled ); } diff --git a/src/libtomahawk/viewmanager.h b/src/libtomahawk/viewmanager.h index 1320fd1bb..2762902ac 100644 --- a/src/libtomahawk/viewmanager.h +++ b/src/libtomahawk/viewmanager.h @@ -174,7 +174,7 @@ private slots: void setFilter( const QString& filter ); void applyFilter(); - void autoUpdateChanged( int ); + void autoUpdateChanged( bool ); void onWidgetDestroyed( QWidget* widget ); From fec670f27c2804777d16d853b51e9ab776018c86 Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Sat, 31 Mar 2012 09:26:30 -0400 Subject: [PATCH 5/7] TWK-793: Let the sourcetreeview sort before we scroll otherwise we might scroll the wrong amount --- src/sourcetree/sourcetreeview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sourcetree/sourcetreeview.cpp b/src/sourcetree/sourcetreeview.cpp index 6e1d08ddc..b6f94c0bc 100644 --- a/src/sourcetree/sourcetreeview.cpp +++ b/src/sourcetree/sourcetreeview.cpp @@ -98,7 +98,7 @@ SourceTreeView::SourceTreeView( QWidget* parent ) m_model = new SourcesModel( this ); m_proxyModel = new SourcesProxyModel( m_model, this ); - connect( m_proxyModel, SIGNAL( selectRequest( QPersistentModelIndex ) ), SLOT( selectRequest( QPersistentModelIndex ) ) ); + connect( m_proxyModel, SIGNAL( selectRequest( QPersistentModelIndex ) ), SLOT( selectRequest( QPersistentModelIndex ) ), Qt::QueuedConnection ); connect( m_proxyModel, SIGNAL( expandRequest( QPersistentModelIndex ) ), SLOT( expandRequest( QPersistentModelIndex ) ) ); connect( m_proxyModel, SIGNAL( toggleExpandRequest( QPersistentModelIndex ) ), SLOT( toggleExpandRequest( QPersistentModelIndex ) ) ); From 5b6c4560aebf9972d2a72a17eb54cc025052f047 Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Sat, 31 Mar 2012 09:53:47 -0400 Subject: [PATCH 6/7] TWK-785: Rename playlist after revision is created so plitem is selectable --- src/sourcetree/items/categoryitems.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sourcetree/items/categoryitems.cpp b/src/sourcetree/items/categoryitems.cpp index 4be8e182f..a9c1a5131 100644 --- a/src/sourcetree/items/categoryitems.cpp +++ b/src/sourcetree/items/categoryitems.cpp @@ -295,6 +295,7 @@ CategoryAddItem::playlistToRenameLoaded() QTimer::singleShot( 400, APP->mainWindow()->sourceTreeView(), SLOT( renamePlaylist() ) ); disconnect( pl, SIGNAL( dynamicRevisionLoaded( Tomahawk::DynamicPlaylistRevision ) ), this, SLOT( playlistToRenameLoaded() ) ); + disconnect( pl, SIGNAL( revisionLoaded( Tomahawk::PlaylistRevision ) ), this, SLOT( playlistToRenameLoaded() ) ); } @@ -306,8 +307,7 @@ CategoryAddItem::parsedDroppedTracks( const QList< query_ptr >& tracks ) playlist_ptr newpl = Playlist::create( SourceList::instance()->getLocal(), uuid(), "New Playlist", "", SourceList::instance()->getLocal()->friendlyName(), false, tracks ); ViewManager::instance()->show( newpl ); - // Give a shot to try to rename it. The playlist has to be created first. ugly. - QTimer::singleShot( 300, APP->mainWindow()->sourceTreeView(), SLOT( renamePlaylist() ) ); + connect( newpl.data(), SIGNAL( revisionLoaded( Tomahawk::PlaylistRevision ) ), this, SLOT( playlistToRenameLoaded() ) ); } else if( m_categoryType == SourcesModel::StationsCategory ) { // seed the playlist with these song or artist filters QString name; From 5dcf426cdf13f04b2cf27167a67412cf6e787d5c Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Sat, 31 Mar 2012 10:03:53 -0400 Subject: [PATCH 7/7] TWK-770: Fix echonest sentence summary grammar --- .../playlist/dynamic/echonest/EchonestGenerator.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp b/src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp index dcb34acef..dd55845e8 100644 --- a/src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp +++ b/src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp @@ -597,7 +597,9 @@ EchonestGenerator::sentenceSummary() suffix = ", "; else suffix = "."; - } else + } else if ( i < required.size() - 2 ) // An item in the list that is before the second to last one, don't use ", and", we only want that for the last item + suffix += ", "; + else suffix += ", and "; } sentence += center + suffix;