mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-24 09:49:42 +01:00
Move HypemPlugin over to new plugin paradigm
This commit is contained in:
parent
3e60adfe37
commit
50fbe986d7
src
infoplugins/generic
libtomahawk
@ -1 +1,2 @@
|
||||
ADD_SUBDIRECTORY( echonest )
|
||||
ADD_SUBDIRECTORY( hypem )
|
||||
|
43
src/infoplugins/generic/hypem/CMakeLists.txt
Normal file
43
src/infoplugins/generic/hypem/CMakeLists.txt
Normal file
@ -0,0 +1,43 @@
|
||||
project( tomahawk )
|
||||
|
||||
include( ${QT_USE_FILE} )
|
||||
add_definitions( ${QT_DEFINITIONS} )
|
||||
add_definitions( -DQT_PLUGIN )
|
||||
add_definitions( -DQT_SHARED )
|
||||
add_definitions( -DINFOPLUGINDLLEXPORT_PRO )
|
||||
|
||||
set( hypemInfoPluginSources
|
||||
HypemPlugin.cpp
|
||||
)
|
||||
|
||||
set( hypemInfoPluginHeaders
|
||||
HypemPlugin.h
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${QT_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
qt4_wrap_cpp( hypemInfoPluginMoc ${hypemInfoPluginHeaders} )
|
||||
add_library( tomahawk_infoplugin_hypem SHARED ${hypemInfoPluginSources} ${hypemInfoPluginMoc} ${RC_SRCS} )
|
||||
|
||||
IF( WIN32 )
|
||||
SET( OS_SPECIFIC_LINK_LIBRARIES
|
||||
${OS_SPECIFIC_LINK_LIBRARIES}
|
||||
"winmm.dll"
|
||||
"iphlpapi.a"
|
||||
)
|
||||
ENDIF( WIN32 )
|
||||
|
||||
target_link_libraries( tomahawk_infoplugin_hypem
|
||||
${TOMAHAWK_LIBRARIES}
|
||||
${QT_LIBRARIES}
|
||||
${OS_SPECIFIC_LINK_LIBRARIES}
|
||||
)
|
||||
|
||||
IF( APPLE )
|
||||
# SET( CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} "-undefined dynamic_lookup" )
|
||||
ENDIF( APPLE )
|
||||
|
||||
install( TARGETS tomahawk_infoplugin_hypem DESTINATION ${CMAKE_INSTALL_LIBDIR} )
|
||||
|
@ -17,13 +17,14 @@
|
||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "hypemPlugin.h"
|
||||
#include "HypemPlugin.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QSettings>
|
||||
#include <QCryptographicHash>
|
||||
#include <QNetworkConfiguration>
|
||||
#include <QNetworkReply>
|
||||
#include <QtPlugin>
|
||||
|
||||
#include "Album.h"
|
||||
#include "Typedefs.h"
|
||||
@ -36,10 +37,14 @@
|
||||
#include <qjson/parser.h>
|
||||
#include <qjson/serializer.h>
|
||||
|
||||
using namespace Tomahawk::InfoSystem;
|
||||
namespace Tomahawk
|
||||
{
|
||||
|
||||
namespace InfoSystem
|
||||
{
|
||||
|
||||
|
||||
hypemPlugin::hypemPlugin()
|
||||
HypemPlugin::HypemPlugin()
|
||||
: InfoPlugin()
|
||||
, m_chartsFetchJobs( 0 )
|
||||
{
|
||||
@ -95,14 +100,14 @@ hypemPlugin::hypemPlugin()
|
||||
|
||||
|
||||
|
||||
hypemPlugin::~hypemPlugin()
|
||||
HypemPlugin::~HypemPlugin()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
hypemPlugin::dataError( Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
HypemPlugin::dataError( Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
{
|
||||
emit info( requestData, QVariant() );
|
||||
return;
|
||||
@ -110,7 +115,7 @@ hypemPlugin::dataError( Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
|
||||
|
||||
void
|
||||
hypemPlugin::getInfo( Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
HypemPlugin::getInfo( Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << requestData.caller;
|
||||
qDebug() << Q_FUNC_INFO << requestData.customData;
|
||||
@ -140,7 +145,7 @@ hypemPlugin::getInfo( Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
}
|
||||
|
||||
void
|
||||
hypemPlugin::fetchChart( Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
HypemPlugin::fetchChart( Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
{
|
||||
|
||||
if ( !requestData.input.canConvert< Tomahawk::InfoSystem::InfoStringHash >() )
|
||||
@ -168,7 +173,7 @@ hypemPlugin::fetchChart( Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
}
|
||||
|
||||
void
|
||||
hypemPlugin::fetchChartCapabilities( Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
HypemPlugin::fetchChartCapabilities( Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
{
|
||||
if ( !requestData.input.canConvert< Tomahawk::InfoSystem::InfoStringHash >() )
|
||||
{
|
||||
@ -181,7 +186,7 @@ hypemPlugin::fetchChartCapabilities( Tomahawk::InfoSystem::InfoRequestData reque
|
||||
}
|
||||
|
||||
void
|
||||
hypemPlugin::notInCacheSlot( QHash<QString, QString> criteria, Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
HypemPlugin::notInCacheSlot( QHash<QString, QString> criteria, Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
{
|
||||
switch ( requestData.type )
|
||||
{
|
||||
@ -225,9 +230,9 @@ hypemPlugin::notInCacheSlot( QHash<QString, QString> criteria, Tomahawk::InfoSys
|
||||
|
||||
|
||||
void
|
||||
hypemPlugin::chartTypes()
|
||||
HypemPlugin::chartTypes()
|
||||
{
|
||||
/// Get possible chart type for specifichypemPlugin: InfoChart types returned chart source
|
||||
/// Get possible chart type for specificHypemPlugin: InfoChart types returned chart source
|
||||
tDebug() << Q_FUNC_INFO << "Got hypem types";
|
||||
|
||||
QVariantMap charts;
|
||||
@ -295,13 +300,13 @@ hypemPlugin::chartTypes()
|
||||
|
||||
|
||||
m_allChartsMap.insert( "Hype Machine", QVariant::fromValue<QVariantMap>( charts ) );
|
||||
qDebug() << "hypemPlugin:Chartstype: " << m_allChartsMap;
|
||||
qDebug() << "HypemPlugin:Chartstype: " << m_allChartsMap;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
hypemPlugin::chartReturned()
|
||||
HypemPlugin::chartReturned()
|
||||
{
|
||||
|
||||
/// Chart request returned something! Woho
|
||||
@ -387,3 +392,9 @@ hypemPlugin::chartReturned()
|
||||
qDebug() << "Network error in fetching chart:" << reply->url().toString();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN2( Tomahawk::InfoSystem::InfoPlugin, Tomahawk::InfoSystem::HypemPlugin )
|
@ -17,9 +17,10 @@
|
||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef hypemPlugin_H
|
||||
#define hypemPlugin_H
|
||||
#ifndef HYPEMPLUGIN_H
|
||||
#define HYPEMPLUGIN_H
|
||||
|
||||
#include "infoplugins/InfoPluginDllMacro.h"
|
||||
#include "infosystem/InfoSystem.h"
|
||||
#include "infosystem/InfoSystemWorker.h"
|
||||
#include <QNetworkReply>
|
||||
@ -33,13 +34,14 @@ namespace Tomahawk
|
||||
namespace InfoSystem
|
||||
{
|
||||
|
||||
class hypemPlugin : public InfoPlugin
|
||||
class INFOPLUGINDLLEXPORT HypemPlugin : public InfoPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES( Tomahawk::InfoSystem::InfoPlugin )
|
||||
|
||||
public:
|
||||
hypemPlugin();
|
||||
virtual ~hypemPlugin();
|
||||
HypemPlugin();
|
||||
virtual ~HypemPlugin();
|
||||
|
||||
enum ChartType {
|
||||
None = 0x00,
|
||||
@ -48,8 +50,8 @@ public:
|
||||
Artist = 0x04
|
||||
|
||||
};
|
||||
void setChartType( ChartType type ) { m_chartType = type; }
|
||||
ChartType chartType() const { return m_chartType; }
|
||||
void setChartType( ChartType type ) { m_chartType = type; }
|
||||
ChartType chartType() const { return m_chartType; }
|
||||
|
||||
public slots:
|
||||
void chartReturned();
|
||||
@ -91,4 +93,4 @@ private:
|
||||
|
||||
}
|
||||
|
||||
#endif // hypemPlugin_H
|
||||
#endif // HYPEMPLUGIN_H
|
@ -257,7 +257,6 @@ set( libSources
|
||||
infosystem/infoplugins/generic/ChartsPlugin.cpp
|
||||
infosystem/infoplugins/generic/NewReleasesPlugin.cpp
|
||||
infosystem/infoplugins/generic/spotifyPlugin.cpp
|
||||
infosystem/infoplugins/generic/hypemPlugin.cpp
|
||||
infosystem/infoplugins/generic/MusixMatchPlugin.cpp
|
||||
infosystem/infoplugins/generic/musicbrainzPlugin.cpp
|
||||
infosystem/infoplugins/generic/RoviPlugin.cpp
|
||||
|
@ -35,7 +35,6 @@
|
||||
#include "infoplugins/generic/NewReleasesPlugin.h"
|
||||
#include "infoplugins/generic/spotifyPlugin.h"
|
||||
#include "infoplugins/generic/musicbrainzPlugin.h"
|
||||
#include "infoplugins/generic/hypemPlugin.h"
|
||||
#include "GlobalActionManager.h"
|
||||
#include "utils/TomahawkUtils.h"
|
||||
#include "utils/Logger.h"
|
||||
@ -96,7 +95,6 @@ InfoSystemWorker::init( Tomahawk::InfoSystem::InfoSystemCache* cache )
|
||||
addInfoPlugin( InfoPluginPtr( new NewReleasesPlugin() ) );
|
||||
addInfoPlugin( InfoPluginPtr( new RoviPlugin() ) );
|
||||
addInfoPlugin( InfoPluginPtr( new SpotifyPlugin() ) );
|
||||
addInfoPlugin( InfoPluginPtr( new hypemPlugin() ) );
|
||||
#endif
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
|
Loading…
x
Reference in New Issue
Block a user