mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-23 01:09:42 +01:00
listen to results of asynchronous binary installs
This commit is contained in:
parent
a071105a26
commit
bb5e5c33ca
@ -39,6 +39,48 @@ using namespace Attica;
|
||||
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 )
|
||||
: QObject( parent )
|
||||
, m_resolverJobsLoaded( 0 )
|
||||
@ -650,3 +692,5 @@ AtticaManager::doResolverRemove( const QString& id ) const
|
||||
|
||||
TomahawkUtils::removeDirectory( resolverDir.absolutePath() );
|
||||
}
|
||||
|
||||
#include "AtticaManager.moc"
|
@ -32,6 +32,7 @@
|
||||
#include <attica/providermanager.h>
|
||||
#include <attica/content.h>
|
||||
|
||||
class BinaryInstallerHelper;
|
||||
|
||||
class DLLEXPORT AtticaManager : public QObject
|
||||
{
|
||||
@ -139,6 +140,8 @@ private:
|
||||
QMap< QString, Tomahawk::Accounts::Account* > m_customAccounts;
|
||||
|
||||
static AtticaManager* s_instance;
|
||||
|
||||
friend class ::BinaryInstallerHelper;
|
||||
};
|
||||
|
||||
class DLLEXPORT CustomAtticaAccount : public Tomahawk::Accounts::Account
|
||||
|
Loading…
x
Reference in New Issue
Block a user