1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-21 13:21:52 +02:00

always show proper credentials, update playlist when updater is removed

This commit is contained in:
Leo Franchi
2012-04-14 22:36:07 -04:00
parent d61a99629f
commit a99b35e11b
4 changed files with 19 additions and 10 deletions

View File

@@ -358,11 +358,6 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg
else if( msgType == "userChanged" ) else if( msgType == "userChanged" )
{ {
const QString rmsg = msg.value( "msg" ).toString(); const QString rmsg = msg.value( "msg" ).toString();
//const QString olduser = msg.value( "oldUser" ).toString();
//const QString newuser = msg.value( "newUser" ).toString();
if( rmsg.isEmpty() )
return;
clearUser(); clearUser();
if ( m_configWidget.data() ) if ( m_configWidget.data() )
@@ -372,6 +367,13 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg
} }
else if ( msgType == "loginResponse" ) else if ( msgType == "loginResponse" )
{ {
QVariantHash creds = credentials();
creds[ "username" ] = msg.value( "username" ).toString();
creds[ "password" ] = msg.value( "password" ).toString();
creds[ "highQuality" ] = msg.value( "highQuality" ).toString();
setCredentials( creds );
sync();
if ( m_configWidget.data() ) if ( m_configWidget.data() )
{ {
const bool success = msg.value( "success" ).toBool(); const bool success = msg.value( "success" ).toBool();

View File

@@ -182,11 +182,8 @@ SpotifyAccountConfig::resetVerifyButton()
void void
SpotifyAccountConfig::resetLoginButton() SpotifyAccountConfig::resetLoginButton()
{ {
if ( !m_ui->loginButton->isEnabled() )
{
m_ui->loginButton->setText( tr( "Log In" ) ); m_ui->loginButton->setText( tr( "Log In" ) );
m_ui->loginButton->setEnabled( true ); m_ui->loginButton->setEnabled( true );
}
} }
/* /*

View File

@@ -288,11 +288,20 @@ Playlist::setUpdater( PlaylistUpdaterInterface* pluinterface )
m_updater = QWeakPointer< PlaylistUpdaterInterface >( pluinterface ); m_updater = QWeakPointer< PlaylistUpdaterInterface >( pluinterface );
connect( m_updater.data(), SIGNAL( changed() ), this, SIGNAL( changed() ), Qt::UniqueConnection ); connect( m_updater.data(), SIGNAL( changed() ), this, SIGNAL( changed() ), Qt::UniqueConnection );
connect( m_updater.data(), SIGNAL( destroyed( QObject* ) ), this, SLOT( updaterDestroyed() ), Qt::QueuedConnection );
emit changed(); emit changed();
} }
void
Playlist::updaterDestroyed()
{
m_updater.clear();
emit changed();
}
void void
Playlist::loadRevision( const QString& rev ) Playlist::loadRevision( const QString& rev )
{ {

View File

@@ -278,6 +278,7 @@ protected:
private slots: private slots:
void onResultsFound( const QList<Tomahawk::result_ptr>& results ); void onResultsFound( const QList<Tomahawk::result_ptr>& results );
void onResolvingFinished(); void onResolvingFinished();
void updaterDestroyed();
private: private:
Playlist(); Playlist();