diff --git a/src/infoplugins/generic/CMakeLists.txt b/src/infoplugins/generic/CMakeLists.txt index 0a9ed2c32..880be9043 100644 --- a/src/infoplugins/generic/CMakeLists.txt +++ b/src/infoplugins/generic/CMakeLists.txt @@ -1 +1,2 @@ ADD_SUBDIRECTORY( echonest ) +ADD_SUBDIRECTORY( hypem ) diff --git a/src/infoplugins/generic/hypem/CMakeLists.txt b/src/infoplugins/generic/hypem/CMakeLists.txt new file mode 100644 index 000000000..074399881 --- /dev/null +++ b/src/infoplugins/generic/hypem/CMakeLists.txt @@ -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} ) + diff --git a/src/libtomahawk/infosystem/infoplugins/generic/hypemPlugin.cpp b/src/infoplugins/generic/hypem/HypemPlugin.cpp similarity index 93% rename from src/libtomahawk/infosystem/infoplugins/generic/hypemPlugin.cpp rename to src/infoplugins/generic/hypem/HypemPlugin.cpp index 074da3595..2624d4baa 100644 --- a/src/libtomahawk/infosystem/infoplugins/generic/hypemPlugin.cpp +++ b/src/infoplugins/generic/hypem/HypemPlugin.cpp @@ -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 ) \ No newline at end of file diff --git a/src/libtomahawk/infosystem/infoplugins/generic/hypemPlugin.h b/src/infoplugins/generic/hypem/HypemPlugin.h similarity index 85% rename from src/libtomahawk/infosystem/infoplugins/generic/hypemPlugin.h rename to src/infoplugins/generic/hypem/HypemPlugin.h index f0b9867ab..1848bd99e 100644 --- a/src/libtomahawk/infosystem/infoplugins/generic/hypemPlugin.h +++ b/src/infoplugins/generic/hypem/HypemPlugin.h @@ -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 diff --git a/src/libtomahawk/CMakeLists.txt b/src/libtomahawk/CMakeLists.txt index 75290e04b..65cd41960 100644 --- a/src/libtomahawk/CMakeLists.txt +++ b/src/libtomahawk/CMakeLists.txt @@ -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 diff --git a/src/libtomahawk/infosystem/InfoSystemWorker.cpp b/src/libtomahawk/infosystem/InfoSystemWorker.cpp index fa774db64..4f1c01505 100644 --- a/src/libtomahawk/infosystem/InfoSystemWorker.cpp +++ b/src/libtomahawk/infosystem/InfoSystemWorker.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