mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-14 10:05:32 +02:00
TWK-706: Don't auto-enable resolvers when upgrading them.
This commit is contained in:
@@ -288,7 +288,7 @@ AtticaManager::syncServerData()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AtticaManager::installResolver( const Content& resolver )
|
AtticaManager::installResolver( const Content& resolver, bool autoEnable )
|
||||||
{
|
{
|
||||||
Q_ASSERT( !resolver.id().isNull() );
|
Q_ASSERT( !resolver.id().isNull() );
|
||||||
|
|
||||||
@@ -302,6 +302,7 @@ AtticaManager::installResolver( const Content& resolver )
|
|||||||
ItemJob< DownloadItem >* job = m_resolverProvider.downloadLink( resolver.id() );
|
ItemJob< DownloadItem >* job = m_resolverProvider.downloadLink( resolver.id() );
|
||||||
connect( job, SIGNAL( finished( Attica::BaseJob* ) ), this, SLOT( resolverDownloadFinished( Attica::BaseJob* ) ) );
|
connect( job, SIGNAL( finished( Attica::BaseJob* ) ), this, SLOT( resolverDownloadFinished( Attica::BaseJob* ) ) );
|
||||||
job->setProperty( "resolverId", resolver.id() );
|
job->setProperty( "resolverId", resolver.id() );
|
||||||
|
job->setProperty( "autoEnable", autoEnable );
|
||||||
|
|
||||||
job->start();
|
job->start();
|
||||||
}
|
}
|
||||||
@@ -316,11 +317,12 @@ AtticaManager::upgradeResolver( const Content& resolver )
|
|||||||
if ( !m_resolverStates.contains( resolver.id() ) || m_resolverStates[ resolver.id() ].state != NeedsUpgrade )
|
if ( !m_resolverStates.contains( resolver.id() ) || m_resolverStates[ resolver.id() ].state != NeedsUpgrade )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
const bool enabled = TomahawkSettings::instance()->enabledScriptResolvers().contains( m_resolverStates[ resolver.id() ].scriptPath );
|
||||||
m_resolverStates[ resolver.id() ].state = Upgrading;
|
m_resolverStates[ resolver.id() ].state = Upgrading;
|
||||||
emit resolverStateChanged( resolver.id() );
|
emit resolverStateChanged( resolver.id() );
|
||||||
|
|
||||||
uninstallResolver( resolver );
|
uninstallResolver( resolver );
|
||||||
installResolver( resolver );
|
installResolver( resolver, enabled );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -337,6 +339,7 @@ AtticaManager::resolverDownloadFinished ( BaseJob* j )
|
|||||||
QNetworkReply* reply = TomahawkUtils::nam()->get( QNetworkRequest( url ) );
|
QNetworkReply* reply = TomahawkUtils::nam()->get( QNetworkRequest( url ) );
|
||||||
connect( reply, SIGNAL( finished() ), this, SLOT( payloadFetched() ) );
|
connect( reply, SIGNAL( finished() ), this, SLOT( payloadFetched() ) );
|
||||||
reply->setProperty( "resolverId", job->property( "resolverId" ) );
|
reply->setProperty( "resolverId", job->property( "resolverId" ) );
|
||||||
|
reply->setProperty( "autoEnable", job->property( "autoEnable" ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -372,8 +375,10 @@ AtticaManager::payloadFetched()
|
|||||||
// update with absolute, not relative, path
|
// update with absolute, not relative, path
|
||||||
m_resolverStates[ resolverId ].scriptPath = resolverPath;
|
m_resolverStates[ resolverId ].scriptPath = resolverPath;
|
||||||
|
|
||||||
|
const bool autoEnable = reply->property( "autoEnable" ).toBool();
|
||||||
|
|
||||||
// Do the install / add to tomahawk
|
// Do the install / add to tomahawk
|
||||||
Tomahawk::Pipeline::instance()->addScriptResolver( resolverPath, true );
|
Tomahawk::Pipeline::instance()->addScriptResolver( resolverPath, autoEnable );
|
||||||
m_resolverStates[ resolverId ].state = Installed;
|
m_resolverStates[ resolverId ].state = Installed;
|
||||||
TomahawkSettingsGui::instanceGui()->setAtticaResolverStates( m_resolverStates );
|
TomahawkSettingsGui::instanceGui()->setAtticaResolverStates( m_resolverStates );
|
||||||
emit resolverInstalled( resolverId );
|
emit resolverInstalled( resolverId );
|
||||||
|
@@ -91,7 +91,7 @@ public:
|
|||||||
bool userHasRated( const Attica::Content& c ) const;
|
bool userHasRated( const Attica::Content& c ) const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void installResolver( const Attica::Content& resolver );
|
void installResolver( const Attica::Content& resolver, bool autoEnable = true );
|
||||||
void upgradeResolver( const Attica::Content& resolver );
|
void upgradeResolver( const Attica::Content& resolver );
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
Reference in New Issue
Block a user