mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-31 11:20:22 +02:00
Sort binary resolvers, then script resolvers by download count
This commit is contained in:
@@ -42,6 +42,15 @@ using namespace Attica;
|
|||||||
|
|
||||||
AtticaManager* AtticaManager::s_instance = 0;
|
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 )
|
AtticaManager::AtticaManager( QObject* parent )
|
||||||
: QObject( parent )
|
: QObject( parent )
|
||||||
@@ -353,7 +362,10 @@ AtticaManager::resolversList( BaseJob* j )
|
|||||||
syncServerData();
|
syncServerData();
|
||||||
|
|
||||||
if ( ++m_resolverJobsLoaded == 2 )
|
if ( ++m_resolverJobsLoaded == 2 )
|
||||||
|
{
|
||||||
|
qSort( m_resolvers.begin(), m_resolvers.end(), resolverSort );
|
||||||
emit resolversLoaded( m_resolvers );
|
emit resolversLoaded( m_resolvers );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -404,7 +416,10 @@ AtticaManager::binaryResolversList( BaseJob* j )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( ++m_resolverJobsLoaded == 2 )
|
if ( ++m_resolverJobsLoaded == 2 )
|
||||||
|
{
|
||||||
|
qSort( m_resolvers.begin(), m_resolvers.end(), resolverSort );
|
||||||
emit resolversLoaded( m_resolvers );
|
emit resolversLoaded( m_resolvers );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user