mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-23 17:29:42 +01:00
fixes for linux binary ghns
This commit is contained in:
parent
b4dda21704
commit
841b151acc
@ -40,6 +40,7 @@
|
||||
#include <QAction>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QMessageBox>
|
||||
|
||||
using namespace Tomahawk;
|
||||
using namespace Accounts;
|
||||
@ -52,7 +53,7 @@ static QString s_resolverId = "spotify-osx";
|
||||
#elif defined(Q_OS_WIN)
|
||||
static QString s_resolverId = "spotify-win";
|
||||
#else
|
||||
static QString s_resolverId = "spotify-linux"
|
||||
static QString s_resolverId = "spotify-linux";
|
||||
#endif
|
||||
|
||||
Account*
|
||||
@ -73,7 +74,8 @@ SpotifyAccountFactory::icon() const
|
||||
|
||||
|
||||
SpotifyAccount::SpotifyAccount( const QString& accountId )
|
||||
: CustomAtticaAccount( accountId )
|
||||
: CustomAtticaAccount( accountId )
|
||||
, m_preventEnabling( false )
|
||||
{
|
||||
init();
|
||||
}
|
||||
@ -204,6 +206,22 @@ SpotifyAccount::authenticate()
|
||||
qDebug() << "Got null resolver but asked to authenticate, so installing if we have one from attica:" << res.isValid() << res.id();
|
||||
if ( res.isValid() && !res.id().isEmpty() )
|
||||
AtticaManager::instance()->installResolver( res, false );
|
||||
else
|
||||
{
|
||||
#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;
|
||||
}
|
||||
}
|
||||
else if ( !m_spotifyResolver.data()->running() )
|
||||
{
|
||||
@ -263,11 +281,13 @@ SpotifyAccount::setManualResolverPath( const QString &resolverPath )
|
||||
{
|
||||
Q_ASSERT( !resolverPath.isEmpty() );
|
||||
|
||||
QVariantHash configuration;
|
||||
configuration[ "resolverPath" ] = resolverPath;
|
||||
setConfiguration( configuration );
|
||||
QVariantHash conf = configuration();
|
||||
conf[ "resolverPath" ] = resolverPath;
|
||||
setConfiguration( conf );
|
||||
sync();
|
||||
|
||||
m_preventEnabling = false;
|
||||
|
||||
if ( !m_spotifyResolver.isNull() )
|
||||
{
|
||||
// replace
|
||||
@ -278,17 +298,17 @@ SpotifyAccount::setManualResolverPath( const QString &resolverPath )
|
||||
else
|
||||
{
|
||||
hookupResolver();
|
||||
authenticate();
|
||||
AccountManager::instance()->enableAccount( this );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SpotifyAccount::hookupAfterDeletion( bool autostart )
|
||||
SpotifyAccount::hookupAfterDeletion( bool autoEnable )
|
||||
{
|
||||
hookupResolver();
|
||||
if ( autostart )
|
||||
authenticate();
|
||||
if ( autoEnable )
|
||||
AccountManager::instance()->enableAccount( this );
|
||||
}
|
||||
|
||||
|
||||
|
@ -90,6 +90,7 @@ public:
|
||||
virtual QWidget* aclWidget() { return 0; }
|
||||
virtual Tomahawk::InfoSystem::InfoPluginPtr infoPlugin() { return Tomahawk::InfoSystem::InfoPluginPtr(); }
|
||||
virtual SipPlugin* sipPlugin() { return 0; }
|
||||
virtual bool preventEnabling() const { return m_preventEnabling; }
|
||||
|
||||
QString sendMessage( const QVariantMap& msg, QObject* receiver = 0, const QString& slot = QString() );
|
||||
|
||||
@ -118,7 +119,7 @@ private slots:
|
||||
void playlistCreated( const QString& msgType, const QVariantMap& msg );
|
||||
|
||||
void init();
|
||||
void hookupAfterDeletion( bool autostart );
|
||||
void hookupAfterDeletion( bool autoEnable );
|
||||
|
||||
private:
|
||||
bool checkForResolver();
|
||||
@ -148,6 +149,8 @@ private:
|
||||
|
||||
QHash< QString, playlist_ptr > m_waitingForCreateReply;
|
||||
|
||||
bool m_preventEnabling;
|
||||
|
||||
SmartPointerList< QAction > m_customActions;
|
||||
friend class ::SpotifyPlaylistUpdater;
|
||||
};
|
||||
|
@ -102,6 +102,10 @@ public:
|
||||
virtual Tomahawk::InfoSystem::InfoPluginPtr infoPlugin() = 0;
|
||||
virtual SipPlugin* sipPlugin() = 0;
|
||||
|
||||
// Some accounts cannot be enabled if authentication fails. Return true after failing to authenticate
|
||||
// if this is the case, and the account will not be enabled
|
||||
virtual bool preventEnabling() const { return false; }
|
||||
|
||||
AccountTypes types() const;
|
||||
|
||||
void setAccountServiceName( const QString &serviceName ) { QMutexLocker locker( &m_mutex ); m_accountServiceName = serviceName; }
|
||||
|
@ -202,6 +202,9 @@ AccountManager::enableAccount( Account* account )
|
||||
|
||||
account->authenticate();
|
||||
|
||||
if ( account->preventEnabling() )
|
||||
return;
|
||||
|
||||
account->setEnabled( true );
|
||||
m_enabledAccounts << account;
|
||||
|
||||
|
@ -616,7 +616,8 @@ AccountModel::accountStateChanged( Account* account , Account::ConnectionState )
|
||||
// For each type that this node could be, check the corresponding data
|
||||
if ( ( n->type == AccountModelNode::UniqueFactoryType && n->accounts.size() && n->accounts.first() == account ) ||
|
||||
( n->type == AccountModelNode::AtticaType && n->atticaAccount && n->atticaAccount == account ) ||
|
||||
( n->type == AccountModelNode::ManualResolverType && n->resolverAccount && n->resolverAccount == account ) )
|
||||
( n->type == AccountModelNode::ManualResolverType && n->resolverAccount && n->resolverAccount == account ) ||
|
||||
( n->type == AccountModelNode::CustomAccountType && n->customAccount && n->customAccount == account ) )
|
||||
{
|
||||
const QModelIndex idx = index( i, 0, QModelIndex() );
|
||||
emit dataChanged( idx, idx );
|
||||
|
Loading…
x
Reference in New Issue
Block a user