1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-25 02:09:48 +01:00

Sort binary resolvers, then script resolvers by download count

This commit is contained in:
Leo Franchi 2012-05-25 15:13:40 -04:00
parent 098183ddca
commit 37b59126f6

View File

@ -42,6 +42,15 @@ using namespace Attica;
AtticaManager* AtticaManager::s_instance = 0;
// Sort binary resolvers above script resolvers, and script resolvers by download count
bool
resolverSort( const Attica::Content& first, const Attica::Content& second )
{
if ( !first.attribute( "typeid" ).isEmpty() && second.attribute( "typeid" ).isEmpty() )
return true;
return first.downloads() > second.downloads();
}
AtticaManager::AtticaManager( QObject* parent )
: QObject( parent )
@ -353,7 +362,10 @@ AtticaManager::resolversList( BaseJob* j )
syncServerData();
if ( ++m_resolverJobsLoaded == 2 )
{
qSort( m_resolvers.begin(), m_resolvers.end(), resolverSort );
emit resolversLoaded( m_resolvers );
}
}
@ -404,7 +416,10 @@ AtticaManager::binaryResolversList( BaseJob* j )
}
if ( ++m_resolverJobsLoaded == 2 )
{
qSort( m_resolvers.begin(), m_resolvers.end(), resolverSort );
emit resolversLoaded( m_resolvers );
}
}