1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-21 08:19:42 +01:00

Add peersOnline() to SipPlugin

This commit is contained in:
Dominik Schmidt 2011-05-06 00:25:06 +02:00
parent 5a9425a930
commit fcb9eb33e4
2 changed files with 31 additions and 0 deletions

View File

@ -34,6 +34,8 @@ SipPlugin::SipPlugin( const QString& pluginId, QObject* parent )
{
connect( this, SIGNAL( error( int, QString ) ), this, SLOT( onError( int,QString ) ) );
connect( this, SIGNAL( stateChanged( SipPlugin::ConnectionState ) ), this, SLOT( onStateChange( SipPlugin::ConnectionState ) ) );
connect( this, SIGNAL( peerOnline( QString ) ), this, SLOT( onPeerOnline( QString ) ) );
connect( this, SIGNAL( peerOffline( QString ) ), this, SLOT( onPeerOffline( QString ) ) );
}
QString SipPlugin::pluginId() const
@ -67,6 +69,13 @@ SipPlugin::icon() const
return QIcon();
}
const QStringList
SipPlugin::peersOnline() const
{
return m_peersOnline;
}
void
SipPlugin::setProxy( const QNetworkProxy& proxy )
{
@ -85,3 +94,18 @@ SipPlugin::onStateChange( SipPlugin::ConnectionState state )
m_cachedError.clear();
}
void
SipPlugin::onPeerOnline(const QString& peerId)
{
if( !m_peersOnline.contains( peerId ) )
{
m_peersOnline.append( peerId );
}
}
void
SipPlugin::onPeerOffline(const QString& peerId)
{
m_peersOnline.removeAll( peerId );
}

View File

@ -76,6 +76,9 @@ public:
virtual void saveConfig() {} // called when the widget has been edited
virtual QIcon icon() const;
// peer infos
virtual const QStringList peersOnline() const;
public slots:
virtual bool connectPlugin( bool startup = false ) = 0;
virtual void disconnectPlugin() = 0;
@ -108,9 +111,13 @@ private slots:
void onError( int, const QString& );
void onStateChange( SipPlugin::ConnectionState state );
void onPeerOnline( const QString &peerId );
void onPeerOffline( const QString &peerId );
private:
QString m_pluginId;
QString m_cachedError;
QStringList m_peersOnline;
};
Q_DECLARE_INTERFACE( SipPluginFactory, "tomahawk.SipFactory/1.0" )