diff --git a/src/DiagnosticsDialog.cpp b/src/DiagnosticsDialog.cpp index eedf4f191..339f74ebe 100644 --- a/src/DiagnosticsDialog.cpp +++ b/src/DiagnosticsDialog.cpp @@ -30,6 +30,8 @@ #include "sip/SipHandler.h" #include "utils/TomahawkUtilsGui.h" #include "utils/Logger.h" +#include "infosystem/InfoSystem.h" +#include "infosystem/InfoSystemWorker.h" #include #include @@ -81,6 +83,19 @@ DiagnosticsDialog::updateLogView() log.append( " visible: false\n" ); } + log.append( "\n\nINFOPLUGINS:\n" ); + QThread* infoSystemWorkerThreadSuperClass = Tomahawk::InfoSystem::InfoSystem::instance()->workerThread(); + Tomahawk::InfoSystem::InfoSystemWorkerThread* infoSystemWorkerThread = qobject_cast< Tomahawk::InfoSystem::InfoSystemWorkerThread* >(infoSystemWorkerThreadSuperClass); + + foreach(const Tomahawk::InfoSystem::InfoPluginPtr& plugin, infoSystemWorkerThread->worker()->plugins()) + { + log.append(" "); + log.append( plugin->friendlyName() ); + log.append("\n"); + } + + log.append( "\n\n" ); + log.append( "ACCOUNTS:\n" ); const QList< Tomahawk::source_ptr > sources = SourceList::instance()->sources( true ); diff --git a/src/libtomahawk/accounts/lastfm/LastFmInfoPlugin.h b/src/libtomahawk/accounts/lastfm/LastFmInfoPlugin.h index 3df617da6..6e202b216 100644 --- a/src/libtomahawk/accounts/lastfm/LastFmInfoPlugin.h +++ b/src/libtomahawk/accounts/lastfm/LastFmInfoPlugin.h @@ -51,6 +51,8 @@ public: LastFmInfoPlugin( Accounts::LastFmAccount* account ); virtual ~LastFmInfoPlugin(); + const QString friendlyName() const { return "LastFM"; }; + public slots: void settingsChanged(); diff --git a/src/libtomahawk/accounts/spotify/SpotifyInfoPlugin.h b/src/libtomahawk/accounts/spotify/SpotifyInfoPlugin.h index 4383df5b1..e74cb5877 100644 --- a/src/libtomahawk/accounts/spotify/SpotifyInfoPlugin.h +++ b/src/libtomahawk/accounts/spotify/SpotifyInfoPlugin.h @@ -45,6 +45,8 @@ public: explicit SpotifyInfoPlugin( Accounts::SpotifyAccount* account ); virtual ~SpotifyInfoPlugin(); + const QString friendlyName() const { return "Spotify"; }; + public slots: void albumListingResult( const QString& msgType, const QVariantMap& msg, const QVariant& extraData ); diff --git a/src/libtomahawk/infosystem/InfoSystem.cpp b/src/libtomahawk/infosystem/InfoSystem.cpp index dcfd8aa2f..f1cae7698 100644 --- a/src/libtomahawk/infosystem/InfoSystem.cpp +++ b/src/libtomahawk/infosystem/InfoSystem.cpp @@ -68,10 +68,25 @@ InfoPlugin::InfoPlugin() { } + InfoPlugin::~InfoPlugin() { } + +void +InfoPlugin::setFriendlyName( const QString& friendlyName ) +{ + m_friendlyName = friendlyName; +} + +const QString +InfoPlugin::friendlyName() const +{ + return m_friendlyName; +} + + InfoSystem* InfoSystem::s_instance = 0; InfoSystem* diff --git a/src/libtomahawk/infosystem/InfoSystem.h b/src/libtomahawk/infosystem/InfoSystem.h index 523fd3a8d..2ef407880 100644 --- a/src/libtomahawk/infosystem/InfoSystem.h +++ b/src/libtomahawk/infosystem/InfoSystem.h @@ -109,6 +109,9 @@ public: virtual ~InfoPlugin(); + void setFriendlyName( const QString& friendlyName ); + virtual const QString friendlyName() const; + QSet< InfoType > supportedGetTypes() const { return m_supportedGetTypes; } QSet< InfoType > supportedPushTypes() const { return m_supportedPushTypes; } @@ -133,6 +136,7 @@ protected slots: protected: InfoType m_type; + QString m_friendlyName; QSet< InfoType > m_supportedGetTypes; QSet< InfoType > m_supportedPushTypes; @@ -141,7 +145,7 @@ private: }; -class InfoSystemCacheThread : public QThread +class DLLEXPORT InfoSystemCacheThread : public QThread { Q_OBJECT @@ -157,7 +161,7 @@ private: }; -class InfoSystemWorkerThread : public QThread +class DLLEXPORT InfoSystemWorkerThread : public QThread { Q_OBJECT diff --git a/src/libtomahawk/infosystem/InfoSystemWorker.cpp b/src/libtomahawk/infosystem/InfoSystemWorker.cpp index 86b3f1af0..4bceb6efe 100644 --- a/src/libtomahawk/infosystem/InfoSystemWorker.cpp +++ b/src/libtomahawk/infosystem/InfoSystemWorker.cpp @@ -65,6 +65,13 @@ InfoSystemWorker::~InfoSystemWorker() } +const QList< InfoPluginPtr > +InfoSystemWorker::plugins() const +{ + return m_plugins; +} + + void InfoSystemWorker::init( Tomahawk::InfoSystem::InfoSystemCache* cache ) { @@ -221,6 +228,7 @@ InfoSystemWorker::loadInfoPlugins( const QStringList& pluginPaths ) if ( infoPlugin ) { tDebug() << Q_FUNC_INFO << "Loaded info plugin:" << loader.fileName(); + infoPlugin->setFriendlyName( loader.fileName() ); addInfoPlugin( InfoPluginPtr( infoPlugin ) ); } else diff --git a/src/libtomahawk/infosystem/InfoSystemWorker.h b/src/libtomahawk/infosystem/InfoSystemWorker.h index e19bd0179..9b977571b 100644 --- a/src/libtomahawk/infosystem/InfoSystemWorker.h +++ b/src/libtomahawk/infosystem/InfoSystemWorker.h @@ -48,6 +48,8 @@ public: InfoSystemWorker(); ~InfoSystemWorker(); + const QList< InfoPluginPtr > plugins() const; + signals: void info( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output ); void finished( QString target );