mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-22 16:59:58 +01:00
Allow rating custom resolvers
This commit is contained in:
parent
ae958cb124
commit
05ea3065f8
@ -559,18 +559,22 @@ AccountModel::setData( const QModelIndex& index, const QVariant& value, int role
|
||||
// We only support rating Attica resolvers for the moment.
|
||||
Attica::Content content;
|
||||
if ( node->type == AccountModelNode::AtticaType )
|
||||
{
|
||||
content = node->atticaContent;
|
||||
|
||||
AtticaManager::ResolverState state = AtticaManager::instance()->resolverState( content );
|
||||
// For now only allow rating if a resolver is installed!
|
||||
if ( state != AtticaManager::Installed && state != AtticaManager::NeedsUpgrade )
|
||||
return false;
|
||||
} // Allow rating custom attica accounts regardless as user may have installed manually
|
||||
else if ( node->type == AccountModelNode::CustomAccountType && qobject_cast< CustomAtticaAccount* >( node->customAccount ) )
|
||||
content = qobject_cast< CustomAtticaAccount* >( node->customAccount )->atticaContent();
|
||||
|
||||
Q_ASSERT( !content.id().isNull() );
|
||||
|
||||
AtticaManager::ResolverState state = AtticaManager::instance()->resolverState( content );
|
||||
// For now only allow rating if a resolver is installed!
|
||||
if ( state != AtticaManager::Installed && state != AtticaManager::NeedsUpgrade )
|
||||
return false;
|
||||
if ( AtticaManager::instance()->userHasRated( content ) )
|
||||
return false;
|
||||
|
||||
content.setRating( value.toInt() * 20 );
|
||||
AtticaManager::instance()->uploadRating( content );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user