mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 13:47:26 +02:00
listen to results of asynchronous binary installs
This commit is contained in:
@@ -39,6 +39,48 @@ using namespace Attica;
|
|||||||
AtticaManager* AtticaManager::s_instance = 0;
|
AtticaManager* AtticaManager::s_instance = 0;
|
||||||
|
|
||||||
|
|
||||||
|
class BinaryInstallerHelper : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit BinaryInstallerHelper( const QString& resolverId, AtticaManager* manager)
|
||||||
|
: QObject( manager )
|
||||||
|
, m_manager( QWeakPointer< AtticaManager >( manager ) )
|
||||||
|
, m_resolverId( resolverId )
|
||||||
|
{
|
||||||
|
Q_ASSERT( !m_resolverId.isEmpty() );
|
||||||
|
Q_ASSERT( !m_manager.isNull() );
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual ~BinaryInstallerHelper() {}
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void extractSucceeded( const QString& path )
|
||||||
|
{
|
||||||
|
if ( m_manager.isNull() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
m_manager.data()->m_resolverStates[ m_resolverId ].state = AtticaManager::Installed;
|
||||||
|
TomahawkSettingsGui::instanceGui()->setAtticaResolverStates( m_manager.data()->m_resolverStates );
|
||||||
|
emit m_manager.data()->resolverInstalled( m_resolverId );
|
||||||
|
emit m_manager.data()->resolverStateChanged( m_resolverId );
|
||||||
|
}
|
||||||
|
void extractFailed()
|
||||||
|
{
|
||||||
|
if ( m_manager.isNull() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_manager.data()->resolverInstallationFailed( m_resolverId );
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString m_resolverId;
|
||||||
|
QWeakPointer<AtticaManager> m_manager;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
AtticaManager::AtticaManager( QObject* parent )
|
AtticaManager::AtticaManager( QObject* parent )
|
||||||
: QObject( parent )
|
: QObject( parent )
|
||||||
, m_resolverJobsLoaded( 0 )
|
, m_resolverJobsLoaded( 0 )
|
||||||
@@ -650,3 +692,5 @@ AtticaManager::doResolverRemove( const QString& id ) const
|
|||||||
|
|
||||||
TomahawkUtils::removeDirectory( resolverDir.absolutePath() );
|
TomahawkUtils::removeDirectory( resolverDir.absolutePath() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "AtticaManager.moc"
|
@@ -32,6 +32,7 @@
|
|||||||
#include <attica/providermanager.h>
|
#include <attica/providermanager.h>
|
||||||
#include <attica/content.h>
|
#include <attica/content.h>
|
||||||
|
|
||||||
|
class BinaryInstallerHelper;
|
||||||
|
|
||||||
class DLLEXPORT AtticaManager : public QObject
|
class DLLEXPORT AtticaManager : public QObject
|
||||||
{
|
{
|
||||||
@@ -139,6 +140,8 @@ private:
|
|||||||
QMap< QString, Tomahawk::Accounts::Account* > m_customAccounts;
|
QMap< QString, Tomahawk::Accounts::Account* > m_customAccounts;
|
||||||
|
|
||||||
static AtticaManager* s_instance;
|
static AtticaManager* s_instance;
|
||||||
|
|
||||||
|
friend class ::BinaryInstallerHelper;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DLLEXPORT CustomAtticaAccount : public Tomahawk::Accounts::Account
|
class DLLEXPORT CustomAtticaAccount : public Tomahawk::Accounts::Account
|
||||||
|
Reference in New Issue
Block a user