mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-09 07:36:48 +02:00
Fix some linux binary resolver stuff
This commit is contained in:
@@ -100,6 +100,7 @@ SpotifyAccount::init()
|
|||||||
qRegisterMetaType< Tomahawk::Accounts::SpotifyPlaylistInfo* >( "Tomahawk::Accounts::SpotifyPlaylist*" );
|
qRegisterMetaType< Tomahawk::Accounts::SpotifyPlaylistInfo* >( "Tomahawk::Accounts::SpotifyPlaylist*" );
|
||||||
|
|
||||||
setAccountFriendlyName( "Spotify" );
|
setAccountFriendlyName( "Spotify" );
|
||||||
|
setAccountServiceName( "spotify" );
|
||||||
|
|
||||||
AtticaManager::instance()->registerCustomAccount( s_resolverId, this );
|
AtticaManager::instance()->registerCustomAccount( s_resolverId, this );
|
||||||
|
|
||||||
@@ -108,7 +109,7 @@ SpotifyAccount::init()
|
|||||||
const Attica::Content res = AtticaManager::instance()->resolverForId( s_resolverId );
|
const Attica::Content res = AtticaManager::instance()->resolverForId( s_resolverId );
|
||||||
const AtticaManager::ResolverState state = AtticaManager::instance()->resolverState( res );
|
const AtticaManager::ResolverState state = AtticaManager::instance()->resolverState( res );
|
||||||
|
|
||||||
const QString path = configuration().value( "resolverPath" ).toString(); // Manual path override
|
const QString path = configuration().value( "path" ).toString(); // Manual path override
|
||||||
if ( !checkForResolver() && state != AtticaManager::Uninstalled )
|
if ( !checkForResolver() && state != AtticaManager::Uninstalled )
|
||||||
{
|
{
|
||||||
// If the user manually deleted the resolver, mark it as uninstalled, so we re-fetch for the user
|
// If the user manually deleted the resolver, mark it as uninstalled, so we re-fetch for the user
|
||||||
@@ -127,7 +128,7 @@ SpotifyAccount::hookupResolver()
|
|||||||
// initialize the resolver itself. this is called if the account actually has an installed spotify resolver,
|
// initialize the resolver itself. this is called if the account actually has an installed spotify resolver,
|
||||||
// as it might not.
|
// as it might not.
|
||||||
// If there is a spotify resolver from attica installed, create the corresponding ExternalResolver* and hook up to it
|
// If there is a spotify resolver from attica installed, create the corresponding ExternalResolver* and hook up to it
|
||||||
QString path = configuration().value( "resolverPath" ).toString();
|
QString path = configuration().value( "path" ).toString();
|
||||||
if ( path.isEmpty() )
|
if ( path.isEmpty() )
|
||||||
{
|
{
|
||||||
const Attica::Content res = AtticaManager::instance()->resolverForId( s_resolverId );
|
const Attica::Content res = AtticaManager::instance()->resolverForId( s_resolverId );
|
||||||
@@ -209,18 +210,8 @@ SpotifyAccount::authenticate()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_LINUX
|
#ifdef Q_OS_LINUX
|
||||||
// Can't install from attica yet on linux, so show a warning if the user tries to turn it on.
|
|
||||||
// TODO make a prettier display
|
|
||||||
QMessageBox box;
|
|
||||||
box.setWindowTitle( tr( "Manual Install Required" ) );
|
|
||||||
box.setTextFormat( Qt::RichText );
|
|
||||||
box.setIcon( QMessageBox::Information );
|
|
||||||
box.setText( tr( "Unfortunately, automatic installation of the Spotify resolver is not yet available on Linux.<br /><br />"
|
|
||||||
"Please use \"Install from file\" above, by fetching it from your distribution or compiling it yourself. Further instructions can be found here:<br /><br />http://www.tomahawk-player.org/resolvers/spotify" ) );
|
|
||||||
box.setStandardButtons( QMessageBox::Ok );
|
|
||||||
box.exec();
|
|
||||||
#endif
|
|
||||||
m_preventEnabling = true;
|
m_preventEnabling = true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( !m_spotifyResolver.data()->running() )
|
else if ( !m_spotifyResolver.data()->running() )
|
||||||
@@ -282,7 +273,7 @@ SpotifyAccount::setManualResolverPath( const QString &resolverPath )
|
|||||||
Q_ASSERT( !resolverPath.isEmpty() );
|
Q_ASSERT( !resolverPath.isEmpty() );
|
||||||
|
|
||||||
QVariantHash conf = configuration();
|
QVariantHash conf = configuration();
|
||||||
conf[ "resolverPath" ] = resolverPath;
|
conf[ "path" ] = resolverPath;
|
||||||
setConfiguration( conf );
|
setConfiguration( conf );
|
||||||
sync();
|
sync();
|
||||||
|
|
||||||
@@ -291,7 +282,6 @@ SpotifyAccount::setManualResolverPath( const QString &resolverPath )
|
|||||||
if ( !m_spotifyResolver.isNull() )
|
if ( !m_spotifyResolver.isNull() )
|
||||||
{
|
{
|
||||||
// replace
|
// replace
|
||||||
//connect( m_spotifyResolver.data(), SIGNAL( destroyed( QObject* ) ), this, SLOT( hookupResolver() ) );
|
|
||||||
NewClosure( m_spotifyResolver.data(), SIGNAL( destroyed() ), this, SLOT( hookupAfterDeletion( bool ) ), true );
|
NewClosure( m_spotifyResolver.data(), SIGNAL( destroyed() ), this, SLOT( hookupAfterDeletion( bool ) ), true );
|
||||||
m_spotifyResolver.data()->deleteLater();
|
m_spotifyResolver.data()->deleteLater();
|
||||||
}
|
}
|
||||||
@@ -421,6 +411,7 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg
|
|||||||
if ( msgType == "credentials" )
|
if ( msgType == "credentials" )
|
||||||
{
|
{
|
||||||
QVariantHash creds = credentials();
|
QVariantHash creds = credentials();
|
||||||
|
|
||||||
creds[ "username" ] = msg.value( "username" );
|
creds[ "username" ] = msg.value( "username" );
|
||||||
creds[ "password" ] = msg.value( "password" );
|
creds[ "password" ] = msg.value( "password" );
|
||||||
creds[ "highQuality" ] = msg.value( "highQuality" );
|
creds[ "highQuality" ] = msg.value( "highQuality" );
|
||||||
|
@@ -521,17 +521,25 @@ TomahawkSettings::doUpgrade( int oldVersion, int newVersion )
|
|||||||
// If the user doesn't have a spotify account, create one, since now it
|
// If the user doesn't have a spotify account, create one, since now it
|
||||||
// is like the last.fm account and always exists
|
// is like the last.fm account and always exists
|
||||||
QStringList allAccounts = value( "accounts/allaccounts" ).toStringList();
|
QStringList allAccounts = value( "accounts/allaccounts" ).toStringList();
|
||||||
bool found = false;
|
QString acct;
|
||||||
foreach ( const QString& account, allAccounts )
|
foreach ( const QString& account, allAccounts )
|
||||||
{
|
{
|
||||||
if ( account.startsWith( "spotifyaccount_" ) )
|
if ( account.startsWith( "spotifyaccount_" ) )
|
||||||
{
|
{
|
||||||
found = true;
|
acct = account;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !found )
|
if ( !acct.isEmpty() )
|
||||||
|
{
|
||||||
|
beginGroup( "accounts/" + acct );
|
||||||
|
QVariantHash conf = value( "configuration" ).toHash();
|
||||||
|
foreach ( const QString& key, conf.keys() )
|
||||||
|
qDebug() << key << conf[ key ].toString();
|
||||||
|
endGroup();
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
const QString accountKey = QString( "spotifyaccount_%1" ).arg( QUuid::createUuid().toString().mid( 1, 8 ) );
|
const QString accountKey = QString( "spotifyaccount_%1" ).arg( QUuid::createUuid().toString().mid( 1, 8 ) );
|
||||||
beginGroup( "accounts/" + accountKey );
|
beginGroup( "accounts/" + accountKey );
|
||||||
|
@@ -24,6 +24,10 @@
|
|||||||
#include "AtticaManager.h"
|
#include "AtticaManager.h"
|
||||||
#include "ResolverAccount.h"
|
#include "ResolverAccount.h"
|
||||||
|
|
||||||
|
#ifndef ENABLE_HEADLESS
|
||||||
|
#include <QMessageBox>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <attica/content.h>
|
#include <attica/content.h>
|
||||||
|
|
||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
@@ -492,6 +496,21 @@ AccountModel::setData( const QModelIndex& index, const QVariant& value, int role
|
|||||||
else if( state == Qt::Unchecked )
|
else if( state == Qt::Unchecked )
|
||||||
AccountManager::instance()->disableAccount( acct );
|
AccountManager::instance()->disableAccount( acct );
|
||||||
|
|
||||||
|
#if defined(Q_OS_LINUX) && !defined(ENABLE_HEADLESS)
|
||||||
|
if ( acct->preventEnabling() )
|
||||||
|
{
|
||||||
|
// Can't install from attica yet on linux, so show a warning if the user tries to turn it on.
|
||||||
|
// TODO make a prettier display
|
||||||
|
QMessageBox box;
|
||||||
|
box.setWindowTitle( tr( "Manual Install Required" ) );
|
||||||
|
box.setTextFormat( Qt::RichText );
|
||||||
|
box.setIcon( QMessageBox::Information );
|
||||||
|
box.setText( tr( "Unfortunately, automatic installation of the this resolver is not yet available on Linux.<br /><br />"
|
||||||
|
"Please use \"Install from file\" above, by fetching it from your distribution or compiling it yourself. Further instructions can be found here:<br /><br />http://www.tomahawk-player.org/resolvers/%1" ).arg( acct->accountServiceName() ) );
|
||||||
|
box.setStandardButtons( QMessageBox::Ok );
|
||||||
|
box.exec();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
emit dataChanged( index, index );
|
emit dataChanged( index, index );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user