mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-09 15:47:38 +02:00
Allow rating custom resolvers
This commit is contained in:
@@ -559,18 +559,22 @@ AccountModel::setData( const QModelIndex& index, const QVariant& value, int role
|
|||||||
// We only support rating Attica resolvers for the moment.
|
// We only support rating Attica resolvers for the moment.
|
||||||
Attica::Content content;
|
Attica::Content content;
|
||||||
if ( node->type == AccountModelNode::AtticaType )
|
if ( node->type == AccountModelNode::AtticaType )
|
||||||
|
{
|
||||||
content = node->atticaContent;
|
content = node->atticaContent;
|
||||||
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 );
|
AtticaManager::ResolverState state = AtticaManager::instance()->resolverState( content );
|
||||||
// For now only allow rating if a resolver is installed!
|
// For now only allow rating if a resolver is installed!
|
||||||
if ( state != AtticaManager::Installed && state != AtticaManager::NeedsUpgrade )
|
if ( state != AtticaManager::Installed && state != AtticaManager::NeedsUpgrade )
|
||||||
return false;
|
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() );
|
||||||
|
|
||||||
if ( AtticaManager::instance()->userHasRated( content ) )
|
if ( AtticaManager::instance()->userHasRated( content ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
content.setRating( value.toInt() * 20 );
|
content.setRating( value.toInt() * 20 );
|
||||||
AtticaManager::instance()->uploadRating( content );
|
AtticaManager::instance()->uploadRating( content );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user