From 334951e34c596f50d0d219ca0e5f82fd3a92decc Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Mon, 22 Apr 2013 09:27:34 +0200 Subject: [PATCH] * Updated Inbox to use new API. --- .../database/DatabaseCommand_DeleteInboxEntry.cpp | 6 +++--- src/libtomahawk/playlist/InboxModel.cpp | 14 ++++++++------ src/libtomahawk/playlist/InboxModel.h | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/libtomahawk/database/DatabaseCommand_DeleteInboxEntry.cpp b/src/libtomahawk/database/DatabaseCommand_DeleteInboxEntry.cpp index 6cbfe7267..8867957b3 100644 --- a/src/libtomahawk/database/DatabaseCommand_DeleteInboxEntry.cpp +++ b/src/libtomahawk/database/DatabaseCommand_DeleteInboxEntry.cpp @@ -36,7 +36,7 @@ DatabaseCommand_DeleteInboxEntry::exec( DatabaseImpl* dbi ) Q_ASSERT( !m_query.isNull() ); - if ( m_query->track().isEmpty() || m_query->artist().isEmpty() ) + if ( m_query->queryTrack()->track().isEmpty() || m_query->queryTrack()->artist().isEmpty() ) { emit done(); return; @@ -51,8 +51,8 @@ DatabaseCommand_DeleteInboxEntry::exec( DatabaseImpl* dbi ) ") " ")" ); query.addBindValue( "Inbox" ); - query.addBindValue( m_query->track() ); - query.addBindValue( m_query->artist() ); + query.addBindValue( m_query->queryTrack()->track() ); + query.addBindValue( m_query->queryTrack()->artist() ); query.exec(); diff --git a/src/libtomahawk/playlist/InboxModel.cpp b/src/libtomahawk/playlist/InboxModel.cpp index 6169144cc..e480d9bdc 100644 --- a/src/libtomahawk/playlist/InboxModel.cpp +++ b/src/libtomahawk/playlist/InboxModel.cpp @@ -72,8 +72,10 @@ InboxModel::mergeSocialActions( QList first, QList& entries, int row ) +InboxModel::insertEntries( const QList< Tomahawk::plentry_ptr >& entries, int row, const QList< Tomahawk::PlaybackLog >& logs ) { + Q_UNUSED( logs ); // <- this is merely to silence GCC + QList< Tomahawk::plentry_ptr > toInsert; for ( QList< Tomahawk::plentry_ptr >::const_iterator it = entries.constBegin(); it != entries.constEnd(); ++it ) @@ -86,8 +88,8 @@ InboxModel::insertEntries( const QList< Tomahawk::plentry_ptr >& entries, int ro if ( entry->query()->equals( existingEntry->query(), true /*ignoreCase*/) ) { //We got a dupe, let's merge the social actions - entry->query()->setAllSocialActions( mergeSocialActions( existingEntry->query()->allSocialActions(), - entry->query()->allSocialActions() ) ); + entry->query()->track()->setAllSocialActions( mergeSocialActions( existingEntry->query()->track()->allSocialActions(), + entry->query()->track()->allSocialActions() ) ); toInsert.erase( jt ); break; } @@ -101,8 +103,8 @@ InboxModel::insertEntries( const QList< Tomahawk::plentry_ptr >& entries, int ro { if ( plEntry->query()->equals( toInsert.at( i )->query(), true ) ) { - plEntry->query()->setAllSocialActions( mergeSocialActions( plEntry->query()->allSocialActions(), - toInsert.at( i )->query()->allSocialActions() ) ); + plEntry->query()->track()->setAllSocialActions( mergeSocialActions( plEntry->query()->track()->allSocialActions(), + toInsert.at( i )->query()->track()->allSocialActions() ) ); toInsert.removeAt( i ); dataChanged( index( playlistEntries().indexOf( plEntry ), 0, QModelIndex() ), @@ -187,7 +189,7 @@ InboxModel::tracksLoaded( QList< Tomahawk::query_ptr > incoming ) QList< Tomahawk::SocialAction > actions; actions << action; - newQuery->setAllSocialActions( actions ); + newQuery->track()->setAllSocialActions( actions ); newQuery->setProperty( "data", QVariant() ); //clear } diff --git a/src/libtomahawk/playlist/InboxModel.h b/src/libtomahawk/playlist/InboxModel.h index 57c846f7c..605d82d8e 100644 --- a/src/libtomahawk/playlist/InboxModel.h +++ b/src/libtomahawk/playlist/InboxModel.h @@ -37,7 +37,7 @@ public slots: * On top of PlaylistModel functionality, adds deduplication/grouping of equivalent tracks * sent from different sources. */ - virtual void insertEntries( const QList< Tomahawk::plentry_ptr >& entries, int row = 0 ); + virtual void insertEntries( const QList< Tomahawk::plentry_ptr >& entries, int row = 0, const QList< Tomahawk::PlaybackLog >& logs = QList< Tomahawk::PlaybackLog >() ); virtual void removeIndex( const QModelIndex &index, bool moreToCome );