1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-25 10:19:41 +01:00

Let SipHandler set the avatar for MyCollection

This commit is contained in:
Dominik Schmidt 2011-04-21 13:42:16 +02:00
parent 3182a294d7
commit 3e20fd1f6a
6 changed files with 26 additions and 2 deletions

View File

@ -179,6 +179,7 @@ SipHandler::loadPlugin( const QString& path )
QObject::connect( sip, SIGNAL( error( int, QString ) ), SLOT( onError( int, QString ) ) );
QObject::connect( sip, SIGNAL( avatarReceived( QString, QPixmap ) ), SLOT( onAvatarReceived( QString, QPixmap ) ) );
QObject::connect( sip, SIGNAL( avatarReceived( QPixmap ) ), SLOT( onAvatarReceived( QPixmap ) ) );
m_plugins << sip;
}
}
@ -411,3 +412,9 @@ void SipHandler::onAvatarReceived( const QString& from, const QPixmap& avatar )
qDebug() << Q_FUNC_INFO << from << "no control connection setup yet";
}
}
void SipHandler::onAvatarReceived( const QPixmap& avatar )
{
qDebug() << Q_FUNC_INFO << "Set own avatar on MyCollection";
SourceList::instance()->getLocal()->setAvatar( avatar );
}

View File

@ -63,7 +63,12 @@ private slots:
void onSettingsChanged();
void onAvatarReceived( const QString& from, const QPixmap& avatar = QPixmap());
// set data for local source
void onAvatarReceived( const QPixmap& avatar );
// set data for other sources
void onAvatarReceived( const QString& from, const QPixmap& avatar );
private:
static SipHandler *s_instance;

View File

@ -58,8 +58,13 @@ signals:
void peerOffline( const QString& );
void msgReceived( const QString& from, const QString& msg );
// new data for own source
void avatarReceived ( const QPixmap& avatar );
// new data for other sources;
void avatarReceived ( const QString& from, const QPixmap& avatar);
void addMenu( QMenu* menu );
void removeMenu( QMenu* menu );
};

View File

@ -111,6 +111,7 @@ JabberPlugin::connectPlugin( bool startup )
QObject::connect( p, SIGNAL( authError( int, QString ) ), SLOT( onAuthError( int, QString ) ) );
QObject::connect( p, SIGNAL( avatarReceived( QString, QPixmap ) ), SIGNAL( avatarReceived( QString, QPixmap ) ) );
QObject::connect( p, SIGNAL( avatarReceived( QPixmap ) ), SIGNAL( avatarReceived( QPixmap) ) );
return true;
}

View File

@ -553,5 +553,10 @@ void Jabber_p::onNewAvatar(const QString& jid)
}
}
emit avatarReceived ( jid, m_avatarManager->avatar( jid ) );
if( jid == m_client->jid().bare() )
// own avatar
emit avatarReceived ( m_avatarManager->avatar( jid ) );
else
// someone else's avatar
emit avatarReceived ( jid, m_avatarManager->avatar( jid ) );
}

View File

@ -65,6 +65,7 @@ signals:
void connected();
void disconnected();
void jidChanged( const QString& );
void avatarReceived( const QPixmap& avatar );
void avatarReceived( const QString&, const QPixmap& avatar );
void authError( int, const QString& );