mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-09 15:47:38 +02:00
* Added option to filter result of sourcesWithSocialAction by friendlyName.
This commit is contained in:
@@ -571,10 +571,10 @@ Track::socialActionDescription( const QString& action, DescriptionMode mode ) co
|
|||||||
|
|
||||||
|
|
||||||
QList< Tomahawk::source_ptr >
|
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 );
|
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 );
|
void loadSocialActions( bool force = false );
|
||||||
QList< Tomahawk::SocialAction > allSocialActions() const;
|
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;
|
QString socialActionDescription( const QString& action, DescriptionMode mode ) const;
|
||||||
|
|
||||||
QList<Tomahawk::query_ptr> similarTracks() const;
|
QList<Tomahawk::query_ptr> similarTracks() const;
|
||||||
|
@@ -278,7 +278,7 @@ TrackData::allSocialActions() const
|
|||||||
|
|
||||||
|
|
||||||
QList< Tomahawk::source_ptr >
|
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 );
|
QMutexLocker locker( &s_memberMutex );
|
||||||
|
|
||||||
@@ -292,9 +292,24 @@ TrackData::sourcesWithSocialAction( const QString& action, const QVariant& value
|
|||||||
sources.removeAll( sa.source );
|
sources.removeAll( sa.source );
|
||||||
continue;
|
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;
|
sources << sa.source;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -80,7 +80,7 @@ public:
|
|||||||
|
|
||||||
void loadSocialActions( bool force = false );
|
void loadSocialActions( bool force = false );
|
||||||
QList< Tomahawk::SocialAction > allSocialActions() const;
|
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 setAllSocialActions( const QList< Tomahawk::SocialAction >& socialActions );
|
||||||
|
|
||||||
void loadStats();
|
void loadStats();
|
||||||
|
Reference in New Issue
Block a user