mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-15 05:22:35 +02:00
* Added option to filter result of sourcesWithSocialAction by friendlyName.
This commit is contained in:
parent
ca11b08f2d
commit
ba670716a7
@ -571,10 +571,10 @@ Track::socialActionDescription( const QString& action, DescriptionMode mode ) co
|
||||
|
||||
|
||||
QList< Tomahawk::source_ptr >
|
||||
Track::sourcesWithSocialAction( const QString& action, const QVariant& value )
|
||||
Track::sourcesWithSocialAction( const QString& action, const QVariant& value, bool filterDupeNames )
|
||||
{
|
||||
Q_D( Track );
|
||||
return d->trackData->sourcesWithSocialAction( action, value );
|
||||
return d->trackData->sourcesWithSocialAction( action, value, filterDupeNames );
|
||||
}
|
||||
|
||||
|
||||
|
@ -109,7 +109,7 @@ public:
|
||||
|
||||
void loadSocialActions( bool force = false );
|
||||
QList< Tomahawk::SocialAction > allSocialActions() const;
|
||||
QList< Tomahawk::source_ptr > sourcesWithSocialAction( const QString& action, const QVariant& value = QVariant() );
|
||||
QList< Tomahawk::source_ptr > sourcesWithSocialAction( const QString& action, const QVariant& value = QVariant(), bool filterDupeNames = false );
|
||||
QString socialActionDescription( const QString& action, DescriptionMode mode ) const;
|
||||
|
||||
QList<Tomahawk::query_ptr> similarTracks() const;
|
||||
|
@ -278,7 +278,7 @@ TrackData::allSocialActions() const
|
||||
|
||||
|
||||
QList< Tomahawk::source_ptr >
|
||||
TrackData::sourcesWithSocialAction( const QString& action, const QVariant& value )
|
||||
TrackData::sourcesWithSocialAction( const QString& action, const QVariant& value, bool filterDupeNames )
|
||||
{
|
||||
QMutexLocker locker( &s_memberMutex );
|
||||
|
||||
@ -292,9 +292,24 @@ TrackData::sourcesWithSocialAction( const QString& action, const QVariant& value
|
||||
sources.removeAll( sa.source );
|
||||
continue;
|
||||
}
|
||||
if ( sources.contains( sa.source ) )
|
||||
continue;
|
||||
|
||||
bool dupe = false;
|
||||
if ( sources.contains( sa.source ) )
|
||||
dupe = true;
|
||||
if ( filterDupeNames )
|
||||
{
|
||||
foreach ( const Tomahawk::source_ptr& source, sources )
|
||||
{
|
||||
if ( source->friendlyName() == sa.source->friendlyName() )
|
||||
{
|
||||
dupe = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( dupe )
|
||||
continue;
|
||||
sources << sa.source;
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ public:
|
||||
|
||||
void loadSocialActions( bool force = false );
|
||||
QList< Tomahawk::SocialAction > allSocialActions() const;
|
||||
QList< Tomahawk::source_ptr > sourcesWithSocialAction( const QString& action, const QVariant& value = QVariant() );
|
||||
QList< Tomahawk::source_ptr > sourcesWithSocialAction( const QString& action, const QVariant& value = QVariant(), bool filterDupeNames = false );
|
||||
void setAllSocialActions( const QList< Tomahawk::SocialAction >& socialActions );
|
||||
|
||||
void loadStats();
|
||||
|
Loading…
x
Reference in New Issue
Block a user