1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-13 20:39:57 +01:00

TWK-706: Don't auto-enable resolvers when upgrading them.

This commit is contained in:
Leo Franchi 2012-02-29 18:35:03 -05:00
parent 6ac0f68224
commit dc364726c0
2 changed files with 9 additions and 4 deletions

View File

@ -288,7 +288,7 @@ AtticaManager::syncServerData()
void
AtticaManager::installResolver( const Content& resolver )
AtticaManager::installResolver( const Content& resolver, bool autoEnable )
{
Q_ASSERT( !resolver.id().isNull() );
@ -302,6 +302,7 @@ AtticaManager::installResolver( const Content& resolver )
ItemJob< DownloadItem >* job = m_resolverProvider.downloadLink( resolver.id() );
connect( job, SIGNAL( finished( Attica::BaseJob* ) ), this, SLOT( resolverDownloadFinished( Attica::BaseJob* ) ) );
job->setProperty( "resolverId", resolver.id() );
job->setProperty( "autoEnable", autoEnable );
job->start();
}
@ -316,11 +317,12 @@ AtticaManager::upgradeResolver( const Content& resolver )
if ( !m_resolverStates.contains( resolver.id() ) || m_resolverStates[ resolver.id() ].state != NeedsUpgrade )
return;
const bool enabled = TomahawkSettings::instance()->enabledScriptResolvers().contains( m_resolverStates[ resolver.id() ].scriptPath );
m_resolverStates[ resolver.id() ].state = Upgrading;
emit resolverStateChanged( resolver.id() );
uninstallResolver( resolver );
installResolver( resolver );
installResolver( resolver, enabled );
}
@ -337,6 +339,7 @@ AtticaManager::resolverDownloadFinished ( BaseJob* j )
QNetworkReply* reply = TomahawkUtils::nam()->get( QNetworkRequest( url ) );
connect( reply, SIGNAL( finished() ), this, SLOT( payloadFetched() ) );
reply->setProperty( "resolverId", job->property( "resolverId" ) );
reply->setProperty( "autoEnable", job->property( "autoEnable" ) );
}
else
{
@ -372,8 +375,10 @@ AtticaManager::payloadFetched()
// update with absolute, not relative, path
m_resolverStates[ resolverId ].scriptPath = resolverPath;
const bool autoEnable = reply->property( "autoEnable" ).toBool();
// Do the install / add to tomahawk
Tomahawk::Pipeline::instance()->addScriptResolver( resolverPath, true );
Tomahawk::Pipeline::instance()->addScriptResolver( resolverPath, autoEnable );
m_resolverStates[ resolverId ].state = Installed;
TomahawkSettingsGui::instanceGui()->setAtticaResolverStates( m_resolverStates );
emit resolverInstalled( resolverId );

View File

@ -91,7 +91,7 @@ public:
bool userHasRated( const Attica::Content& c ) const;
public slots:
void installResolver( const Attica::Content& resolver );
void installResolver( const Attica::Content& resolver, bool autoEnable = true );
void upgradeResolver( const Attica::Content& resolver );
signals: