mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-02-16 22:04:59 +01:00
Add friendlyNames to InfoPlugins and show them in the diagnostics dialog
This commit is contained in:
parent
fc4acddaae
commit
61c347d21b
src
@ -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 <QLabel>
|
||||
#include <QTextEdit>
|
||||
@ -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 );
|
||||
|
@ -51,6 +51,8 @@ public:
|
||||
LastFmInfoPlugin( Accounts::LastFmAccount* account );
|
||||
virtual ~LastFmInfoPlugin();
|
||||
|
||||
const QString friendlyName() const { return "LastFM"; };
|
||||
|
||||
public slots:
|
||||
void settingsChanged();
|
||||
|
||||
|
@ -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 );
|
||||
|
||||
|
@ -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*
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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 );
|
||||
|
Loading…
x
Reference in New Issue
Block a user