mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-01 03:40:16 +02:00
* Updated Inbox to use new API.
This commit is contained in:
@@ -36,7 +36,7 @@ DatabaseCommand_DeleteInboxEntry::exec( DatabaseImpl* dbi )
|
|||||||
|
|
||||||
Q_ASSERT( !m_query.isNull() );
|
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();
|
emit done();
|
||||||
return;
|
return;
|
||||||
@@ -51,8 +51,8 @@ DatabaseCommand_DeleteInboxEntry::exec( DatabaseImpl* dbi )
|
|||||||
") "
|
") "
|
||||||
")" );
|
")" );
|
||||||
query.addBindValue( "Inbox" );
|
query.addBindValue( "Inbox" );
|
||||||
query.addBindValue( m_query->track() );
|
query.addBindValue( m_query->queryTrack()->track() );
|
||||||
query.addBindValue( m_query->artist() );
|
query.addBindValue( m_query->queryTrack()->artist() );
|
||||||
|
|
||||||
query.exec();
|
query.exec();
|
||||||
|
|
||||||
|
@@ -72,8 +72,10 @@ InboxModel::mergeSocialActions( QList<Tomahawk::SocialAction> first, QList<Tomah
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
InboxModel::insertEntries( const QList< Tomahawk::plentry_ptr >& 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;
|
QList< Tomahawk::plentry_ptr > toInsert;
|
||||||
for ( QList< Tomahawk::plentry_ptr >::const_iterator it = entries.constBegin();
|
for ( QList< Tomahawk::plentry_ptr >::const_iterator it = entries.constBegin();
|
||||||
it != entries.constEnd(); ++it )
|
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*/) )
|
if ( entry->query()->equals( existingEntry->query(), true /*ignoreCase*/) )
|
||||||
{
|
{
|
||||||
//We got a dupe, let's merge the social actions
|
//We got a dupe, let's merge the social actions
|
||||||
entry->query()->setAllSocialActions( mergeSocialActions( existingEntry->query()->allSocialActions(),
|
entry->query()->track()->setAllSocialActions( mergeSocialActions( existingEntry->query()->track()->allSocialActions(),
|
||||||
entry->query()->allSocialActions() ) );
|
entry->query()->track()->allSocialActions() ) );
|
||||||
toInsert.erase( jt );
|
toInsert.erase( jt );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -101,8 +103,8 @@ InboxModel::insertEntries( const QList< Tomahawk::plentry_ptr >& entries, int ro
|
|||||||
{
|
{
|
||||||
if ( plEntry->query()->equals( toInsert.at( i )->query(), true ) )
|
if ( plEntry->query()->equals( toInsert.at( i )->query(), true ) )
|
||||||
{
|
{
|
||||||
plEntry->query()->setAllSocialActions( mergeSocialActions( plEntry->query()->allSocialActions(),
|
plEntry->query()->track()->setAllSocialActions( mergeSocialActions( plEntry->query()->track()->allSocialActions(),
|
||||||
toInsert.at( i )->query()->allSocialActions() ) );
|
toInsert.at( i )->query()->track()->allSocialActions() ) );
|
||||||
toInsert.removeAt( i );
|
toInsert.removeAt( i );
|
||||||
|
|
||||||
dataChanged( index( playlistEntries().indexOf( plEntry ), 0, QModelIndex() ),
|
dataChanged( index( playlistEntries().indexOf( plEntry ), 0, QModelIndex() ),
|
||||||
@@ -187,7 +189,7 @@ InboxModel::tracksLoaded( QList< Tomahawk::query_ptr > incoming )
|
|||||||
|
|
||||||
QList< Tomahawk::SocialAction > actions;
|
QList< Tomahawk::SocialAction > actions;
|
||||||
actions << action;
|
actions << action;
|
||||||
newQuery->setAllSocialActions( actions );
|
newQuery->track()->setAllSocialActions( actions );
|
||||||
|
|
||||||
newQuery->setProperty( "data", QVariant() ); //clear
|
newQuery->setProperty( "data", QVariant() ); //clear
|
||||||
}
|
}
|
||||||
|
@@ -37,7 +37,7 @@ public slots:
|
|||||||
* On top of PlaylistModel functionality, adds deduplication/grouping of equivalent tracks
|
* On top of PlaylistModel functionality, adds deduplication/grouping of equivalent tracks
|
||||||
* sent from different sources.
|
* 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 );
|
virtual void removeIndex( const QModelIndex &index, bool moreToCome );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user