mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-21 08:19:42 +01:00
DiagnosticsDialog: Add more details on peers. Ugly caching in SipHandler, wanna avoid ugly-back-and-forth-json-parsing until we have a proper SipInfo class
This commit is contained in:
parent
6e06e36573
commit
31c3c50292
@ -21,6 +21,7 @@
|
||||
|
||||
#include <sip/SipHandler.h>
|
||||
#include <network/servent.h>
|
||||
#include <sourcelist.h>
|
||||
|
||||
#include <QTextEdit>
|
||||
#include <QDebug>
|
||||
@ -79,6 +80,7 @@ void DiagnosticsDialog::updateLogView()
|
||||
|
||||
// Peers
|
||||
log.append("SIP PLUGINS:\n");
|
||||
QList< Tomahawk::source_ptr > sources = SourceList::instance()->sources( true );
|
||||
Q_FOREACH(SipPlugin *sip, SipHandler::instance()->allPlugins())
|
||||
{
|
||||
Q_ASSERT(sip);
|
||||
@ -105,12 +107,33 @@ void DiagnosticsDialog::updateLogView()
|
||||
.arg(stateString)
|
||||
);
|
||||
|
||||
Q_FOREACH(const QString &peerId, sip->peersOnline())
|
||||
Q_FOREACH( const QString &peerId, sip->peersOnline() )
|
||||
{
|
||||
log.append(
|
||||
QString(" %1\n")
|
||||
.arg(peerId)
|
||||
);
|
||||
bool connected = false;
|
||||
Q_FOREACH( const Tomahawk::source_ptr &source, sources )
|
||||
{
|
||||
if( source->controlConnection() )
|
||||
{
|
||||
connected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
QVariantMap sipInfo = SipHandler::instance()->sipInfo( peerId );
|
||||
if( sipInfo.value( "visible").toBool() )
|
||||
log.append(
|
||||
QString(" %1: %2:%3 (%4)\n")
|
||||
.arg( peerId )
|
||||
.arg( sipInfo.value( "ip" ).toString() )
|
||||
.arg( sipInfo.value( "port" ).toString() )
|
||||
.arg( connected ? "connected" : "not connected")
|
||||
);
|
||||
else
|
||||
log.append(
|
||||
QString(" %1: visible: false (%2)\n")
|
||||
.arg( peerId )
|
||||
.arg( connected ? "connected" : "not connected")
|
||||
);
|
||||
}
|
||||
log.append("\n");
|
||||
}
|
||||
|
@ -80,7 +80,11 @@ const QPixmap SipHandler::avatar( const QString& name ) const
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const QVariantMap
|
||||
SipHandler::sipInfo(const QString& peerId) const
|
||||
{
|
||||
return m_peersSipInfos.value( peerId );
|
||||
}
|
||||
|
||||
void
|
||||
SipHandler::onSettingsChanged()
|
||||
@ -510,6 +514,8 @@ SipHandler::onMessage( const QString& from, const QString& msg )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << "They are not visible, doing nothing atm";
|
||||
}
|
||||
|
||||
m_peersSipInfos.insert( from, m );
|
||||
}
|
||||
|
||||
|
||||
|
@ -51,6 +51,8 @@ public:
|
||||
SipPluginFactory* factoryFromPlugin( SipPlugin* p ) const;
|
||||
|
||||
const QPixmap avatar( const QString& name ) const;
|
||||
//TODO: implement a proper SipInfo class and maybe attach it to the source
|
||||
const QVariantMap sipInfo( const QString& peerId ) const;
|
||||
|
||||
public slots:
|
||||
void checkSettings();
|
||||
@ -115,7 +117,8 @@ private:
|
||||
QList< SipPlugin* > m_connectedPlugins;
|
||||
bool m_connected;
|
||||
|
||||
|
||||
//TODO: move this to source
|
||||
QHash<QString, QVariantMap> m_peersSipInfos;
|
||||
QHash<QString, QPixmap> m_usernameAvatars;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user