mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
Use virtual method for factory name
This commit is contained in:
@@ -456,7 +456,7 @@ AtticaManager::payloadFetched()
|
|||||||
if ( reply->property( "createAccount" ).toBool() )
|
if ( reply->property( "createAccount" ).toBool() )
|
||||||
{
|
{
|
||||||
// Do the install / add to tomahawk
|
// Do the install / add to tomahawk
|
||||||
Tomahawk::Accounts::Account* resolver = Tomahawk::Accounts::ResolverAccountFactory::createFromPath( resolverPath, true );
|
Tomahawk::Accounts::Account* resolver = Tomahawk::Accounts::ResolverAccountFactory::createFromPath( resolverPath, "resolveraccount", true );
|
||||||
Tomahawk::Accounts::AccountManager::instance()->addAccount( resolver );
|
Tomahawk::Accounts::AccountManager::instance()->addAccount( resolver );
|
||||||
TomahawkSettings::instance()->addAccount( resolver->accountId() );
|
TomahawkSettings::instance()->addAccount( resolver->accountId() );
|
||||||
}
|
}
|
||||||
|
@@ -182,8 +182,8 @@ public:
|
|||||||
virtual Account* createAccount( const QString& accountId = QString() ) = 0;
|
virtual Account* createAccount( const QString& accountId = QString() ) = 0;
|
||||||
|
|
||||||
/// If this resolver type accepts this path on disk (For general and special resolver accounts)
|
/// If this resolver type accepts this path on disk (For general and special resolver accounts)
|
||||||
virtual bool acceptsPath( const QString& path ) const { return false; }
|
virtual bool acceptsPath( const QString& ) const { return false; }
|
||||||
virtual Account* createFromPath( const QString& path ) { return 0; }
|
virtual Account* createFromPath( const QString& ) { return 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@@ -597,7 +597,6 @@ void
|
|||||||
AccountModel::accountStateChanged( Account* account , Account::ConnectionState )
|
AccountModel::accountStateChanged( Account* account , Account::ConnectionState )
|
||||||
{
|
{
|
||||||
// Find the factory this belongs up, and update
|
// Find the factory this belongs up, and update
|
||||||
AccountFactory* factory = AccountManager::instance()->factoryForAccount( account );
|
|
||||||
for ( int i = 0; i < m_accounts.size(); i++ )
|
for ( int i = 0; i < m_accounts.size(); i++ )
|
||||||
{
|
{
|
||||||
AccountModelNode* n = m_accounts.at( i );
|
AccountModelNode* n = m_accounts.at( i );
|
||||||
|
@@ -118,6 +118,7 @@ struct AccountModelNode {
|
|||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
resolverAccount = ra;
|
resolverAccount = ra;
|
||||||
|
factory = AccountManager::instance()->factoryForAccount( ra );
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit AccountModelNode( Account* account ) : type( CustomAccountType )
|
explicit AccountModelNode( Account* account ) : type( CustomAccountType )
|
||||||
|
@@ -48,21 +48,21 @@ ResolverAccountFactory::createAccount( const QString& accountId )
|
|||||||
Account*
|
Account*
|
||||||
ResolverAccountFactory::createFromPath( const QString& path )
|
ResolverAccountFactory::createFromPath( const QString& path )
|
||||||
{
|
{
|
||||||
return createFromPath( path, false );
|
return createFromPath( path, factoryId(), false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Account*
|
Account*
|
||||||
ResolverAccountFactory::createFromPath( const QString& path, bool isAttica )
|
ResolverAccountFactory::createFromPath( const QString& path, const QString& factory, bool isAttica )
|
||||||
{
|
{
|
||||||
qDebug() << "Creating ResolverAccount from path:" << path << "is attica" << isAttica;
|
qDebug() << "Creating ResolverAccount from path:" << path << "is attica" << isAttica;
|
||||||
if ( isAttica )
|
if ( isAttica )
|
||||||
{
|
{
|
||||||
QFileInfo info( path );
|
QFileInfo info( path );
|
||||||
return new AtticaResolverAccount( generateId( "resolveraccount" ), path, info.baseName() );
|
return new AtticaResolverAccount( generateId( factory ), path, info.baseName() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return new ResolverAccount( generateId( "resolveraccount" ), path );
|
return new ResolverAccount( generateId( factory ), path );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -48,7 +48,7 @@ public:
|
|||||||
virtual Account* createFromPath( const QString& path );
|
virtual Account* createFromPath( const QString& path );
|
||||||
|
|
||||||
// Internal use
|
// Internal use
|
||||||
static Account* createFromPath( const QString& path, bool isAttica );
|
static Account* createFromPath( const QString& path, const QString& factoryId, bool isAttica );
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -47,7 +47,7 @@ SpotifyAccountFactory::acceptsPath( const QString& path ) const
|
|||||||
Account*
|
Account*
|
||||||
SpotifyAccountFactory::createFromPath( const QString& path )
|
SpotifyAccountFactory::createFromPath( const QString& path )
|
||||||
{
|
{
|
||||||
return new SpotifyAccount( generateId( "spotifyaccount" ), path );
|
return new SpotifyAccount( generateId( factoryId() ), path );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user