1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-25 02:09:48 +01:00

Add some methods for pushing supported info types out of infosystem; untested currently, but compiles

This commit is contained in:
Jeff Mitchell 2013-01-14 14:39:30 -05:00
parent e5f207f0f5
commit cd3d42dc61
5 changed files with 47 additions and 8 deletions

View File

@ -208,6 +208,7 @@ namespace Tomahawk
class InfoPlugin;
typedef QSet< InfoType > InfoTypeSet;
typedef QMap< InfoType, QVariant > InfoTypeMap;
typedef QMap< InfoType, uint > InfoTimeoutMap;
typedef QHash< QString, QString > InfoStringHash;

View File

@ -309,6 +309,22 @@ InfoSystem::removeInfoPlugin( Tomahawk::InfoSystem::InfoPluginPtr plugin )
}
void
InfoSystem::receiveUpdatedSupportedGetTypes( InfoTypeSet supportedTypes )
{
m_supportedGetTypes = supportedTypes;
emit updatedSupportedGetTypes( m_supportedGetTypes );
}
void
InfoSystem::receiveUpdatedSupportedPushTypes( InfoTypeSet supportedTypes )
{
m_supportedPushTypes = supportedTypes;
emit updatedSupportedPushTypes( m_supportedPushTypes );
}
QPointer< QThread >
InfoSystem::workerThread() const
{

View File

@ -155,9 +155,11 @@ public:
virtual ~InfoSystemCacheThread();
void run();
InfoSystemCache* cache() const;
private:
friend class InfoSystem;
InfoSystemCache* cache() const;
QPointer< InfoSystemCache > m_cache;
};
@ -171,9 +173,12 @@ public:
virtual ~InfoSystemWorkerThread();
void run();
InfoSystemWorker* worker() const;
private:
friend class DiagnosticsDialog;
friend class InfoSystem;
InfoSystemWorker* worker() const;
QPointer< InfoSystemWorker > m_worker;
};
@ -185,14 +190,17 @@ class DLLEXPORT InfoSystem : public QObject
public:
static InfoSystem* instance();
InfoSystem( QObject *parent );
InfoSystem( QObject* parent );
~InfoSystem();
bool getInfo( const InfoRequestData &requestData );
bool getInfo( const InfoRequestData& requestData );
//WARNING: if changing timeoutMillis above, also change in below function in .cpp file
bool getInfo( const QString &caller, const QVariantMap &customData, const InfoTypeMap &inputMap, const InfoTimeoutMap &timeoutMap = InfoTimeoutMap(), bool allSources = false );
bool getInfo( const QString &caller, const QVariantMap& customData, const InfoTypeMap& inputMap, const InfoTimeoutMap& timeoutMap = InfoTimeoutMap(), bool allSources = false );
bool pushInfo( InfoPushData pushData );
bool pushInfo( const QString &caller, const InfoTypeMap &input, const PushInfoFlags pushFlags );
bool pushInfo( const QString& caller, const InfoTypeMap& input, const PushInfoFlags pushFlags );
const InfoTypeSet& supportedGetTypes() const { return m_supportedGetTypes; }
const InfoTypeSet& supportedPushTypes() const { return m_supportedPushTypes; }
QPointer< QThread > workerThread() const;
@ -206,14 +214,22 @@ signals:
void finished( QString target );
void finished( QString target, Tomahawk::InfoSystem::InfoType type );
void updatedSupportedGetTypes( Tomahawk::InfoSystem::InfoTypeSet supportedTypes );
void updatedSupportedPushTypes( Tomahawk::InfoSystem::InfoTypeSet supportedTypes );
private slots:
void init();
void receiveUpdatedSupportedGetTypes( Tomahawk::InfoSystem::InfoTypeSet supportedTypes );
void receiveUpdatedSupportedPushTypes( Tomahawk::InfoSystem::InfoTypeSet supportedTypes );
private:
bool m_inited;
InfoSystemCacheThread* m_infoSystemCacheThreadController;
InfoSystemWorkerThread* m_infoSystemWorkerThreadController;
InfoTypeSet m_supportedGetTypes;
InfoTypeSet m_supportedPushTypes;
static InfoSystem* s_instance;
};

View File

@ -29,10 +29,10 @@
#include <QCoreApplication>
#include <QNetworkConfiguration>
#include <QNetworkProxy>
#include <QDir>
#include <QLibrary>
#include <QNetworkConfiguration>
#include <QNetworkProxy>
#include <QPluginLoader>
namespace Tomahawk
@ -130,6 +130,9 @@ InfoSystemWorker::addInfoPlugin( Tomahawk::InfoSystem::InfoPluginPtr plugin )
);
QMetaObject::invokeMethod( plugin.data(), "init", Qt::QueuedConnection );
emit updatedSupportedGetTypes( QSet< InfoType >::fromList( m_infoGetMap.keys() ) );
emit updatedSupportedPushTypes( QSet< InfoType >::fromList( m_infoPushMap.keys() ) );
}

View File

@ -55,6 +55,9 @@ signals:
void finished( QString target );
void finished( QString target, Tomahawk::InfoSystem::InfoType type );
void updatedSupportedGetTypes( Tomahawk::InfoSystem::InfoTypeSet supportedTypes );
void updatedSupportedPushTypes( Tomahawk::InfoSystem::InfoTypeSet supportedTypes );
public slots:
void init( Tomahawk::InfoSystem::InfoSystemCache* cache );
void getInfo( Tomahawk::InfoSystem::InfoRequestData requestData );