1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-08 07:07:05 +02:00

Replace InfoCustomData with QVariantMap

This commit is contained in:
Jeff Mitchell
2011-07-06 11:22:20 -04:00
parent 7c9c046b17
commit ce7040d1fd
33 changed files with 163 additions and 166 deletions

View File

@@ -167,8 +167,8 @@ AudioControls::AudioControls( QWidget* parent )
.scaled( ui->coverImage->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation ); .scaled( ui->coverImage->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
connect( Tomahawk::InfoSystem::InfoSystem::instance(), connect( Tomahawk::InfoSystem::InfoSystem::instance(),
SIGNAL( info( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ), SIGNAL( info( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, QVariantMap ) ),
SLOT( infoSystemInfo( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ) ); SLOT( infoSystemInfo( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, QVariantMap ) ) );
connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( finished( QString ) ), SLOT( infoSystemFinished( QString ) ) ); connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( finished( QString ) ), SLOT( infoSystemFinished( QString ) ) );
@@ -220,12 +220,12 @@ AudioControls::onPlaybackStarted( const Tomahawk::result_ptr& result )
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( Tomahawk::InfoSystem::InfoSystem::instance()->getInfo(
s_acInfoIdentifier, Tomahawk::InfoSystem::InfoAlbumCoverArt, s_acInfoIdentifier, Tomahawk::InfoSystem::InfoAlbumCoverArt,
QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( trackInfo ), Tomahawk::InfoSystem::InfoCustomData() ); QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( trackInfo ), QVariantMap() );
} }
void void
AudioControls::infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomData customData ) AudioControls::infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, QVariantMap customData )
{ {
Q_UNUSED( input ); Q_UNUSED( input );
Q_UNUSED( customData ); Q_UNUSED( customData );
@@ -243,13 +243,13 @@ AudioControls::infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType ty
return; return;
} }
if ( !output.canConvert< Tomahawk::InfoSystem::InfoCustomData >() ) if ( !output.canConvert< QVariantMap >() )
{ {
qDebug() << "Cannot convert fetched art from a QByteArray"; qDebug() << "Cannot convert fetched art from a QByteArray";
return; return;
} }
Tomahawk::InfoSystem::InfoCustomData returnedData = output.value< Tomahawk::InfoSystem::InfoCustomData >(); QVariantMap returnedData = output.value< QVariantMap >();
const QByteArray ba = returnedData["imgbytes"].toByteArray(); const QByteArray ba = returnedData["imgbytes"].toByteArray();
if ( ba.length() ) if ( ba.length() )
{ {

View File

@@ -67,7 +67,7 @@ private slots:
void onTrackClicked(); void onTrackClicked();
void onLoveButtonClicked( bool ); void onLoveButtonClicked( bool );
void infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomData customData ); void infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, QVariantMap customData );
void infoSystemFinished( QString target ); void infoSystemFinished( QString target );
private: private:

View File

@@ -154,9 +154,9 @@ AudioEngine::stop()
sendWaitingNotification(); sendWaitingNotification();
else if ( TomahawkSettings::instance()->verboseNotifications() ) else if ( TomahawkSettings::instance()->verboseNotifications() )
{ {
Tomahawk::InfoSystem::InfoCustomData stopInfo; QVariantMap stopInfo;
stopInfo["message"] = QString( "Tomahawk is stopped." ); stopInfo["message"] = QString( "Tomahawk is stopped." );
map[ Tomahawk::InfoSystem::InfoNotifyUser ] = QVariant::fromValue< Tomahawk::InfoSystem::InfoCustomData >( stopInfo ); map[ Tomahawk::InfoSystem::InfoNotifyUser ] = QVariant::fromValue< QVariantMap >( stopInfo );
} }
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( s_aeInfoIdentifier, map ); Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( s_aeInfoIdentifier, map );
@@ -240,11 +240,11 @@ AudioEngine::mute()
void void
AudioEngine::sendWaitingNotification() const AudioEngine::sendWaitingNotification() const
{ {
Tomahawk::InfoSystem::InfoCustomData retryInfo; QVariantMap retryInfo;
retryInfo["message"] = QString( "The current track could not be resolved. Tomahawk will pick back up with the next resolvable track from this source." ); retryInfo["message"] = QString( "The current track could not be resolved. Tomahawk will pick back up with the next resolvable track from this source." );
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo(
s_aeInfoIdentifier, Tomahawk::InfoSystem::InfoNotifyUser, s_aeInfoIdentifier, Tomahawk::InfoSystem::InfoNotifyUser,
QVariant::fromValue< Tomahawk::InfoSystem::InfoCustomData >( retryInfo ) ); QVariant::fromValue< QVariantMap >( retryInfo ) );
} }
@@ -256,8 +256,8 @@ AudioEngine::sendNowPlayingNotification()
if ( ! m_infoSystemConnected ) if ( ! m_infoSystemConnected )
{ {
connect( Tomahawk::InfoSystem::InfoSystem::instance(), connect( Tomahawk::InfoSystem::InfoSystem::instance(),
SIGNAL( info( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ), SIGNAL( info( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, QVariantMap ) ),
SLOT( infoSystemInfo( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ) ); SLOT( infoSystemInfo( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, QVariantMap ) ) );
connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( finished( QString ) ), SLOT( infoSystemFinished( QString ) ) ); connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( finished( QString ) ), SLOT( infoSystemFinished( QString ) ) );
@@ -270,12 +270,12 @@ AudioEngine::sendNowPlayingNotification()
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( Tomahawk::InfoSystem::InfoSystem::instance()->getInfo(
s_aeInfoIdentifier, Tomahawk::InfoSystem::InfoAlbumCoverArt, s_aeInfoIdentifier, Tomahawk::InfoSystem::InfoAlbumCoverArt,
QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( trackInfo ), Tomahawk::InfoSystem::InfoCustomData() ); QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( trackInfo ), QVariantMap() );
} }
void void
AudioEngine::infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomData customData ) AudioEngine::infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, QVariantMap customData )
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
Q_UNUSED( input ); Q_UNUSED( input );
@@ -288,7 +288,7 @@ AudioEngine::infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type
return; return;
} }
Tomahawk::InfoSystem::InfoCustomData playInfo; QVariantMap playInfo;
playInfo["message"] = QString( "Tomahawk is playing \"%1\" by %2 on album %3." ) playInfo["message"] = QString( "Tomahawk is playing \"%1\" by %2 on album %3." )
.arg( m_currentTrack->track() ) .arg( m_currentTrack->track() )
.arg( m_currentTrack->artist()->name() ) .arg( m_currentTrack->artist()->name() )
@@ -296,7 +296,7 @@ AudioEngine::infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type
if ( !output.isNull() && output.isValid() ) if ( !output.isNull() && output.isValid() )
{ {
qDebug() << Q_FUNC_INFO << " output is valid"; qDebug() << Q_FUNC_INFO << " output is valid";
Tomahawk::InfoSystem::InfoCustomData returnedData = output.value< Tomahawk::InfoSystem::InfoCustomData >(); QVariantMap returnedData = output.value< QVariantMap >();
const QByteArray ba = returnedData["imgbytes"].toByteArray(); const QByteArray ba = returnedData["imgbytes"].toByteArray();
qDebug() << "ba.length = " << ba.length(); qDebug() << "ba.length = " << ba.length();
if ( ba.length() ) if ( ba.length() )
@@ -309,7 +309,7 @@ AudioEngine::infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo(
s_aeInfoIdentifier, Tomahawk::InfoSystem::InfoNotifyUser, s_aeInfoIdentifier, Tomahawk::InfoSystem::InfoNotifyUser,
QVariant::fromValue< Tomahawk::InfoSystem::InfoCustomData >( playInfo ) ); QVariant::fromValue< QVariantMap >( playInfo ) );
} }

View File

@@ -87,7 +87,7 @@ public slots:
void playlistNextTrackReady(); void playlistNextTrackReady();
void infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomData customData ); void infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, QVariantMap customData );
void infoSystemFinished( QString caller ); void infoSystemFinished( QString caller );
signals: signals:

View File

@@ -66,7 +66,7 @@ EchoNestPlugin::namChangedSlot( QNetworkAccessManager *nam )
} }
void void
EchoNestPlugin::getInfo(const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData) EchoNestPlugin::getInfo(const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData)
{ {
switch (type) switch (type)
{ {
@@ -91,7 +91,7 @@ EchoNestPlugin::getInfo(const QString caller, const Tomahawk::InfoSystem::InfoTy
} }
void void
EchoNestPlugin::getSongProfile(const QString &caller, const QVariant &input, const InfoCustomData &customData, const QString &item) EchoNestPlugin::getSongProfile(const QString &caller, const QVariant &input, const QVariantMap &customData, const QString &item)
{ {
//WARNING: Totally not implemented yet //WARNING: Totally not implemented yet
Q_UNUSED( item ); Q_UNUSED( item );
@@ -108,7 +108,7 @@ EchoNestPlugin::getSongProfile(const QString &caller, const QVariant &input, con
} }
void void
EchoNestPlugin::getArtistBiography(const QString &caller, const QVariant &input, const InfoCustomData &customData) EchoNestPlugin::getArtistBiography(const QString &caller, const QVariant &input, const QVariantMap &customData)
{ {
if( !isValidArtistData( caller, input, customData ) ) if( !isValidArtistData( caller, input, customData ) )
return; return;
@@ -123,7 +123,7 @@ EchoNestPlugin::getArtistBiography(const QString &caller, const QVariant &input,
} }
void void
EchoNestPlugin::getArtistFamiliarity(const QString &caller, const QVariant &input, const InfoCustomData &customData) EchoNestPlugin::getArtistFamiliarity(const QString &caller, const QVariant &input, const QVariantMap &customData)
{ {
if( !isValidArtistData( caller, input, customData ) ) if( !isValidArtistData( caller, input, customData ) )
return; return;
@@ -139,7 +139,7 @@ EchoNestPlugin::getArtistFamiliarity(const QString &caller, const QVariant &inpu
} }
void void
EchoNestPlugin::getArtistHotttnesss(const QString &caller, const QVariant &input, const InfoCustomData &customData) EchoNestPlugin::getArtistHotttnesss(const QString &caller, const QVariant &input, const QVariantMap &customData)
{ {
if( !isValidArtistData( caller, input, customData ) ) if( !isValidArtistData( caller, input, customData ) )
return; return;
@@ -154,7 +154,7 @@ EchoNestPlugin::getArtistHotttnesss(const QString &caller, const QVariant &input
} }
void void
EchoNestPlugin::getArtistTerms(const QString &caller, const QVariant &input, const InfoCustomData &customData) EchoNestPlugin::getArtistTerms(const QString &caller, const QVariant &input, const QVariantMap &customData)
{ {
if( !isValidArtistData( caller, input, customData ) ) if( !isValidArtistData( caller, input, customData ) )
return; return;
@@ -169,7 +169,7 @@ EchoNestPlugin::getArtistTerms(const QString &caller, const QVariant &input, con
} }
void void
EchoNestPlugin::getMiscTopTerms(const QString &caller, const QVariant &input, const InfoCustomData& customData) EchoNestPlugin::getMiscTopTerms(const QString &caller, const QVariant &input, const QVariantMap& customData)
{ {
Q_UNUSED( input ); Q_UNUSED( input );
QNetworkReply* reply = Echonest::Artist::topTerms( 20 ); QNetworkReply* reply = Echonest::Artist::topTerms( 20 );
@@ -200,7 +200,7 @@ EchoNestPlugin::getArtistBiographySlot()
Tomahawk::InfoSystem::InfoArtistBiography, Tomahawk::InfoSystem::InfoArtistBiography,
reply->property( "input" ), reply->property( "input" ),
QVariant::fromValue< Tomahawk::InfoSystem::InfoGenericMap >( biographyMap ), QVariant::fromValue< Tomahawk::InfoSystem::InfoGenericMap >( biographyMap ),
reply->property( "customData" ).value< Tomahawk::InfoSystem::InfoCustomData >() ); reply->property( "customData" ).value< QVariantMap >() );
reply->deleteLater(); reply->deleteLater();
} }
@@ -214,7 +214,7 @@ EchoNestPlugin::getArtistFamiliaritySlot()
Tomahawk::InfoSystem::InfoArtistFamiliarity, Tomahawk::InfoSystem::InfoArtistFamiliarity,
reply->property( "input" ), reply->property( "input" ),
familiarity, familiarity,
reply->property( "customData" ).value< Tomahawk::InfoSystem::InfoCustomData >() ); reply->property( "customData" ).value< QVariantMap >() );
reply->deleteLater(); reply->deleteLater();
} }
@@ -228,7 +228,7 @@ EchoNestPlugin::getArtistHotttnesssSlot()
Tomahawk::InfoSystem::InfoArtistHotttness, Tomahawk::InfoSystem::InfoArtistHotttness,
reply->property( "input" ), reply->property( "input" ),
hotttnesss, hotttnesss,
reply->property( "customData" ).value< Tomahawk::InfoSystem::InfoCustomData >() ); reply->property( "customData" ).value< QVariantMap >() );
reply->deleteLater(); reply->deleteLater();
} }
@@ -249,7 +249,7 @@ EchoNestPlugin::getArtistTermsSlot()
Tomahawk::InfoSystem::InfoArtistTerms, Tomahawk::InfoSystem::InfoArtistTerms,
reply->property( "input" ), reply->property( "input" ),
QVariant::fromValue< Tomahawk::InfoSystem::InfoGenericMap >( termsMap ), QVariant::fromValue< Tomahawk::InfoSystem::InfoGenericMap >( termsMap ),
reply->property( "customData" ).value< Tomahawk::InfoSystem::InfoCustomData >() ); reply->property( "customData" ).value< QVariantMap >() );
reply->deleteLater(); reply->deleteLater();
} }
@@ -269,12 +269,12 @@ EchoNestPlugin::getMiscTopSlot()
Tomahawk::InfoSystem::InfoMiscTopTerms, Tomahawk::InfoSystem::InfoMiscTopTerms,
QVariant(), QVariant(),
QVariant::fromValue< Tomahawk::InfoSystem::InfoGenericMap >( termsMap ), QVariant::fromValue< Tomahawk::InfoSystem::InfoGenericMap >( termsMap ),
reply->property( "customData" ).value< Tomahawk::InfoSystem::InfoCustomData >() ); reply->property( "customData" ).value< QVariantMap >() );
reply->deleteLater(); reply->deleteLater();
} }
bool bool
EchoNestPlugin::isValidArtistData(const QString &caller, const QVariant &input, const InfoCustomData &customData) EchoNestPlugin::isValidArtistData(const QString &caller, const QVariant &input, const QVariantMap &customData)
{ {
if (input.isNull() || !input.isValid() || !input.canConvert<QString>()) if (input.isNull() || !input.isValid() || !input.canConvert<QString>())
{ {
@@ -291,7 +291,7 @@ EchoNestPlugin::isValidArtistData(const QString &caller, const QVariant &input,
} }
bool bool
EchoNestPlugin::isValidTrackData(const QString &caller, const QVariant &input, const InfoCustomData &customData) EchoNestPlugin::isValidTrackData(const QString &caller, const QVariant &input, const QVariantMap &customData)
{ {
if (input.isNull() || !input.isValid() || !input.canConvert<QString>()) if (input.isNull() || !input.isValid() || !input.canConvert<QString>())
{ {

View File

@@ -44,7 +44,7 @@ public:
virtual ~EchoNestPlugin(); virtual ~EchoNestPlugin();
protected slots: protected slots:
virtual void getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData ); virtual void getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData );
virtual void pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant data ) virtual void pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant data )
{ {
@@ -53,7 +53,7 @@ protected slots:
Q_UNUSED( data ); Q_UNUSED( data );
} }
virtual void notInCacheSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData ) virtual void notInCacheSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData )
{ {
Q_UNUSED( criteria ); Q_UNUSED( criteria );
Q_UNUSED( caller ); Q_UNUSED( caller );
@@ -66,15 +66,15 @@ public slots:
void namChangedSlot( QNetworkAccessManager *nam ); void namChangedSlot( QNetworkAccessManager *nam );
private: private:
void getSongProfile( const QString &caller, const QVariant &input, const InfoCustomData &customData, const QString &item = QString() ); void getSongProfile( const QString &caller, const QVariant &input, const QVariantMap &customData, const QString &item = QString() );
void getArtistBiography ( const QString &caller, const QVariant &input, const InfoCustomData &customData ); void getArtistBiography ( const QString &caller, const QVariant &input, const QVariantMap &customData );
void getArtistFamiliarity( const QString &caller, const QVariant &input, const InfoCustomData &customData ); void getArtistFamiliarity( const QString &caller, const QVariant &input, const QVariantMap &customData );
void getArtistHotttnesss( const QString &caller, const QVariant &input, const InfoCustomData &customData ); void getArtistHotttnesss( const QString &caller, const QVariant &input, const QVariantMap &customData );
void getArtistTerms( const QString &caller, const QVariant &input, const InfoCustomData &customData ); void getArtistTerms( const QString &caller, const QVariant &input, const QVariantMap &customData );
void getMiscTopTerms( const QString &caller, const QVariant &input, const InfoCustomData &customData ); void getMiscTopTerms( const QString &caller, const QVariant &input, const QVariantMap &customData );
bool isValidArtistData( const QString &caller, const QVariant &input, const InfoCustomData& customData ); bool isValidArtistData( const QString &caller, const QVariant &input, const QVariantMap& customData );
bool isValidTrackData( const QString &caller, const QVariant &input, const InfoCustomData& customData ); bool isValidTrackData( const QString &caller, const QVariant &input, const QVariantMap& customData );
Echonest::Artist artistFromReply( QNetworkReply* ); Echonest::Artist artistFromReply( QNetworkReply* );
private slots: private slots:

View File

@@ -120,7 +120,7 @@ LastFmPlugin::namChangedSlot( QNetworkAccessManager *nam )
void void
LastFmPlugin::dataError( const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const Tomahawk::InfoSystem::InfoCustomData &customData ) LastFmPlugin::dataError( const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const QVariantMap &customData )
{ {
emit info( caller, type, input, QVariant(), customData ); emit info( caller, type, input, QVariant(), customData );
return; return;
@@ -128,7 +128,7 @@ LastFmPlugin::dataError( const QString &caller, const Tomahawk::InfoSystem::Info
void void
LastFmPlugin::getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData ) LastFmPlugin::getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData )
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
@@ -263,7 +263,7 @@ LastFmPlugin::sendLoveSong( const InfoType type, QVariant input )
void void
LastFmPlugin::fetchSimilarArtists( const QString &caller, const InfoType type, const QVariant &input, const Tomahawk::InfoSystem::InfoCustomData &customData ) LastFmPlugin::fetchSimilarArtists( const QString &caller, const InfoType type, const QVariant &input, const QVariantMap &customData )
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
if ( !input.canConvert< Tomahawk::InfoSystem::InfoCriteriaHash >() ) if ( !input.canConvert< Tomahawk::InfoSystem::InfoCriteriaHash >() )
@@ -286,7 +286,7 @@ LastFmPlugin::fetchSimilarArtists( const QString &caller, const InfoType type, c
void void
LastFmPlugin::fetchTopTracks( const QString &caller, const InfoType type, const QVariant &input, const Tomahawk::InfoSystem::InfoCustomData &customData ) LastFmPlugin::fetchTopTracks( const QString &caller, const InfoType type, const QVariant &input, const QVariantMap &customData )
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
if ( !input.canConvert< Tomahawk::InfoSystem::InfoCriteriaHash >() ) if ( !input.canConvert< Tomahawk::InfoSystem::InfoCriteriaHash >() )
@@ -309,7 +309,7 @@ LastFmPlugin::fetchTopTracks( const QString &caller, const InfoType type, const
void void
LastFmPlugin::fetchCoverArt( const QString &caller, const InfoType type, const QVariant &input, const Tomahawk::InfoSystem::InfoCustomData &customData ) LastFmPlugin::fetchCoverArt( const QString &caller, const InfoType type, const QVariant &input, const QVariantMap &customData )
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
if ( !input.canConvert< Tomahawk::InfoSystem::InfoCriteriaHash >() ) if ( !input.canConvert< Tomahawk::InfoSystem::InfoCriteriaHash >() )
@@ -333,7 +333,7 @@ LastFmPlugin::fetchCoverArt( const QString &caller, const InfoType type, const Q
void void
LastFmPlugin::fetchArtistImages( const QString &caller, const InfoType type, const QVariant &input, const Tomahawk::InfoSystem::InfoCustomData &customData ) LastFmPlugin::fetchArtistImages( const QString &caller, const InfoType type, const QVariant &input, const QVariantMap &customData )
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
if ( !input.canConvert< Tomahawk::InfoSystem::InfoCriteriaHash >() ) if ( !input.canConvert< Tomahawk::InfoSystem::InfoCriteriaHash >() )
@@ -356,7 +356,7 @@ LastFmPlugin::fetchArtistImages( const QString &caller, const InfoType type, con
void void
LastFmPlugin::notInCacheSlot( const QHash<QString, QString> criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData ) LastFmPlugin::notInCacheSlot( const QHash<QString, QString> criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData )
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
@@ -373,7 +373,7 @@ LastFmPlugin::notInCacheSlot( const QHash<QString, QString> criteria, const QStr
{ {
lastfm::Artist a( criteria["artist"] ); lastfm::Artist a( criteria["artist"] );
QNetworkReply* reply = a.getSimilar(); QNetworkReply* reply = a.getSimilar();
reply->setProperty( "customData", QVariant::fromValue<Tomahawk::InfoSystem::InfoCustomData>( customData ) ); reply->setProperty( "customData", QVariant::fromValue<QVariantMap>( customData ) );
reply->setProperty( "origData", input ); reply->setProperty( "origData", input );
reply->setProperty( "caller", caller ); reply->setProperty( "caller", caller );
reply->setProperty( "type", (uint)(type) ); reply->setProperty( "type", (uint)(type) );
@@ -386,7 +386,7 @@ LastFmPlugin::notInCacheSlot( const QHash<QString, QString> criteria, const QStr
{ {
lastfm::Artist a( criteria["artist"] ); lastfm::Artist a( criteria["artist"] );
QNetworkReply* reply = a.getTopTracks(); QNetworkReply* reply = a.getTopTracks();
reply->setProperty( "customData", QVariant::fromValue<Tomahawk::InfoSystem::InfoCustomData>( customData ) ); reply->setProperty( "customData", QVariant::fromValue<QVariantMap>( customData ) );
reply->setProperty( "origData", input ); reply->setProperty( "origData", input );
reply->setProperty( "caller", caller ); reply->setProperty( "caller", caller );
reply->setProperty( "type", (uint)(type) ); reply->setProperty( "type", (uint)(type) );
@@ -403,7 +403,7 @@ LastFmPlugin::notInCacheSlot( const QHash<QString, QString> criteria, const QStr
QString imgurl = "http://ws.audioscrobbler.com/2.0/?method=album.imageredirect&artist=%1&album=%2&autocorrect=1&size=large&api_key=7a90f6672a04b809ee309af169f34b8b"; QString imgurl = "http://ws.audioscrobbler.com/2.0/?method=album.imageredirect&artist=%1&album=%2&autocorrect=1&size=large&api_key=7a90f6672a04b809ee309af169f34b8b";
QNetworkRequest req( imgurl.arg( artistName ).arg( albumName ) ); QNetworkRequest req( imgurl.arg( artistName ).arg( albumName ) );
QNetworkReply* reply = lastfm::nam()->get( req ); QNetworkReply* reply = lastfm::nam()->get( req );
reply->setProperty( "customData", QVariant::fromValue<Tomahawk::InfoSystem::InfoCustomData>( customData ) ); reply->setProperty( "customData", QVariant::fromValue<QVariantMap>( customData ) );
reply->setProperty( "origData", input ); reply->setProperty( "origData", input );
reply->setProperty( "caller", caller ); reply->setProperty( "caller", caller );
reply->setProperty( "type", (uint)(type) ); reply->setProperty( "type", (uint)(type) );
@@ -419,7 +419,7 @@ LastFmPlugin::notInCacheSlot( const QHash<QString, QString> criteria, const QStr
QString imgurl = "http://ws.audioscrobbler.com/2.0/?method=artist.imageredirect&artist=%1&autocorrect=1&size=large&api_key=7a90f6672a04b809ee309af169f34b8b"; QString imgurl = "http://ws.audioscrobbler.com/2.0/?method=artist.imageredirect&artist=%1&autocorrect=1&size=large&api_key=7a90f6672a04b809ee309af169f34b8b";
QNetworkRequest req( imgurl.arg( artistName ) ); QNetworkRequest req( imgurl.arg( artistName ) );
QNetworkReply* reply = lastfm::nam()->get( req ); QNetworkReply* reply = lastfm::nam()->get( req );
reply->setProperty( "customData", QVariant::fromValue<Tomahawk::InfoSystem::InfoCustomData>( customData ) ); reply->setProperty( "customData", QVariant::fromValue<QVariantMap>( customData ) );
reply->setProperty( "origData", input ); reply->setProperty( "origData", input );
reply->setProperty( "caller", caller ); reply->setProperty( "caller", caller );
reply->setProperty( "type", (uint)(type) ); reply->setProperty( "type", (uint)(type) );
@@ -454,11 +454,11 @@ LastFmPlugin::similarArtistsReturned()
al << a; al << a;
} }
InfoCustomData returnedData; QVariantMap returnedData;
returnedData["artists"] = al; returnedData["artists"] = al;
returnedData["score"] = sl; returnedData["score"] = sl;
InfoCustomData customData = reply->property( "customData" ).value< Tomahawk::InfoSystem::InfoCustomData >(); QVariantMap customData = reply->property( "customData" ).value< QVariantMap >();
InfoType type = (Tomahawk::InfoSystem::InfoType)(reply->property( "type" ).toUInt()); InfoType type = (Tomahawk::InfoSystem::InfoType)(reply->property( "type" ).toUInt());
emit info( emit info(
reply->property( "caller" ).toString(), reply->property( "caller" ).toString(),
@@ -487,10 +487,10 @@ LastFmPlugin::topTracksReturned()
qDebug() << "Got top-track:" << t; qDebug() << "Got top-track:" << t;
} }
InfoCustomData returnedData; QVariantMap returnedData;
returnedData["tracks"] = topTracks; returnedData["tracks"] = topTracks;
InfoCustomData customData = reply->property( "customData" ).value< Tomahawk::InfoSystem::InfoCustomData >(); QVariantMap customData = reply->property( "customData" ).value< QVariantMap >();
InfoType type = (Tomahawk::InfoSystem::InfoType)(reply->property( "type" ).toUInt()); InfoType type = (Tomahawk::InfoSystem::InfoType)(reply->property( "type" ).toUInt());
emit info( emit info(
reply->property( "caller" ).toString(), reply->property( "caller" ).toString(),
@@ -520,7 +520,7 @@ LastFmPlugin::coverArtReturned()
{ {
qDebug() << "Uh oh, null byte array"; qDebug() << "Uh oh, null byte array";
InfoType type = (Tomahawk::InfoSystem::InfoType)(reply->property( "type" ).toUInt()); InfoType type = (Tomahawk::InfoSystem::InfoType)(reply->property( "type" ).toUInt());
InfoCustomData customData = reply->property( "customData" ).value< Tomahawk::InfoSystem::InfoCustomData >(); QVariantMap customData = reply->property( "customData" ).value< QVariantMap >();
emit info( reply->property( "caller" ).toString(), type, reply->property( "origData" ), QVariant(), customData ); emit info( reply->property( "caller" ).toString(), type, reply->property( "origData" ), QVariant(), customData );
return; return;
} }
@@ -530,11 +530,11 @@ LastFmPlugin::coverArtReturned()
ba = QByteArray(); ba = QByteArray();
} }
InfoCustomData returnedData; QVariantMap returnedData;
returnedData["imgbytes"] = ba; returnedData["imgbytes"] = ba;
returnedData["url"] = reply->url().toString(); returnedData["url"] = reply->url().toString();
InfoCustomData customData = reply->property( "customData" ).value< Tomahawk::InfoSystem::InfoCustomData >(); QVariantMap customData = reply->property( "customData" ).value< QVariantMap >();
InfoType type = (Tomahawk::InfoSystem::InfoType)(reply->property( "type" ).toUInt()); InfoType type = (Tomahawk::InfoSystem::InfoType)(reply->property( "type" ).toUInt());
emit info( emit info(
reply->property( "caller" ).toString(), reply->property( "caller" ).toString(),
@@ -556,7 +556,7 @@ LastFmPlugin::coverArtReturned()
{ {
qDebug() << "Uh oh, nam is null"; qDebug() << "Uh oh, nam is null";
InfoType type = (Tomahawk::InfoSystem::InfoType)(reply->property( "type" ).toUInt()); InfoType type = (Tomahawk::InfoSystem::InfoType)(reply->property( "type" ).toUInt());
InfoCustomData customData = reply->property( "customData" ).value< Tomahawk::InfoSystem::InfoCustomData >(); QVariantMap customData = reply->property( "customData" ).value< QVariantMap >();
emit info( reply->property( "caller" ).toString(), type, reply->property( "origData" ), QVariant(), customData ); emit info( reply->property( "caller" ).toString(), type, reply->property( "origData" ), QVariant(), customData );
return; return;
} }
@@ -587,7 +587,7 @@ LastFmPlugin::artistImagesReturned()
{ {
qDebug() << "Uh oh, null byte array"; qDebug() << "Uh oh, null byte array";
InfoType type = (Tomahawk::InfoSystem::InfoType)(reply->property( "type" ).toUInt()); InfoType type = (Tomahawk::InfoSystem::InfoType)(reply->property( "type" ).toUInt());
InfoCustomData customData = reply->property( "customData" ).value< Tomahawk::InfoSystem::InfoCustomData >(); QVariantMap customData = reply->property( "customData" ).value< QVariantMap >();
emit info( reply->property( "caller" ).toString(), type, reply->property( "origData" ), QVariant(), customData ); emit info( reply->property( "caller" ).toString(), type, reply->property( "origData" ), QVariant(), customData );
return; return;
} }
@@ -596,12 +596,12 @@ LastFmPlugin::artistImagesReturned()
if ( reply->url().toString().startsWith( url.toString() ) ) if ( reply->url().toString().startsWith( url.toString() ) )
ba = QByteArray(); ba = QByteArray();
} }
InfoCustomData returnedData; QVariantMap returnedData;
returnedData["imgbytes"] = ba; returnedData["imgbytes"] = ba;
returnedData["url"] = reply->url().toString(); returnedData["url"] = reply->url().toString();
InfoType type = (Tomahawk::InfoSystem::InfoType)(reply->property( "type" ).toUInt()); InfoType type = (Tomahawk::InfoSystem::InfoType)(reply->property( "type" ).toUInt());
InfoCustomData customData = reply->property( "customData" ).value< Tomahawk::InfoSystem::InfoCustomData >(); QVariantMap customData = reply->property( "customData" ).value< QVariantMap >();
emit info( reply->property( "caller" ).toString(), type, reply->property( "origData" ), returnedData, customData ); emit info( reply->property( "caller" ).toString(), type, reply->property( "origData" ), returnedData, customData );
InfoCriteriaHash origData = reply->property( "origData" ).value< Tomahawk::InfoSystem::InfoCriteriaHash >(); InfoCriteriaHash origData = reply->property( "origData" ).value< Tomahawk::InfoSystem::InfoCriteriaHash >();
@@ -615,7 +615,7 @@ LastFmPlugin::artistImagesReturned()
{ {
qDebug() << "Uh oh, nam is null"; qDebug() << "Uh oh, nam is null";
InfoType type = (Tomahawk::InfoSystem::InfoType)(reply->property( "type" ).toUInt()); InfoType type = (Tomahawk::InfoSystem::InfoType)(reply->property( "type" ).toUInt());
InfoCustomData customData = reply->property( "customData" ).value< Tomahawk::InfoSystem::InfoCustomData >(); QVariantMap customData = reply->property( "customData" ).value< QVariantMap >();
emit info( reply->property( "caller" ).toString(), type, reply->property( "origData" ), QVariant(), customData ); emit info( reply->property( "caller" ).toString(), type, reply->property( "origData" ), QVariant(), customData );
return; return;
} }

View File

@@ -55,23 +55,23 @@ public slots:
void namChangedSlot( QNetworkAccessManager *nam ); void namChangedSlot( QNetworkAccessManager *nam );
protected slots: protected slots:
virtual void getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData ); virtual void getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData );
virtual void notInCacheSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData ); virtual void notInCacheSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData );
virtual void pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant data ); virtual void pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant data );
private: private:
void fetchCoverArt( const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const Tomahawk::InfoSystem::InfoCustomData &customData ); void fetchCoverArt( const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const QVariantMap &customData );
void fetchArtistImages( const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const Tomahawk::InfoSystem::InfoCustomData &customData ); void fetchArtistImages( const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const QVariantMap &customData );
void fetchSimilarArtists( const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const Tomahawk::InfoSystem::InfoCustomData &customData ); void fetchSimilarArtists( const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const QVariantMap &customData );
void fetchTopTracks( const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const Tomahawk::InfoSystem::InfoCustomData &customData ); void fetchTopTracks( const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const QVariantMap &customData );
void createScrobbler(); void createScrobbler();
void nowPlaying( const QVariant &input ); void nowPlaying( const QVariant &input );
void scrobble(); void scrobble();
void sendLoveSong( const InfoType type, QVariant input ); void sendLoveSong( const InfoType type, QVariant input );
void dataError( const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const Tomahawk::InfoSystem::InfoCustomData &customData ); void dataError( const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const QVariantMap &customData );
lastfm::MutableTrack m_track; lastfm::MutableTrack m_track;
lastfm::Audioscrobbler* m_scrobbler; lastfm::Audioscrobbler* m_scrobbler;

View File

@@ -51,12 +51,12 @@ MusixMatchPlugin::namChangedSlot( QNetworkAccessManager *nam )
} }
void void
MusixMatchPlugin::getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData ) MusixMatchPlugin::getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData )
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
if( !isValidTrackData(caller, input, customData) || !input.canConvert<Tomahawk::InfoSystem::InfoCustomData>() || m_nam.isNull() || type != Tomahawk::InfoSystem::InfoTrackLyrics ) if( !isValidTrackData(caller, input, customData) || !input.canConvert<QVariantMap>() || m_nam.isNull() || type != Tomahawk::InfoSystem::InfoTrackLyrics )
return; return;
Tomahawk::InfoSystem::InfoCustomData hash = input.value<Tomahawk::InfoSystem::InfoCustomData>(); QVariantMap hash = input.value<QVariantMap>();
QString artist = hash["artistName"].toString(); QString artist = hash["artistName"].toString();
QString track = hash["trackName"].toString(); QString track = hash["trackName"].toString();
if( artist.isEmpty() || track.isEmpty() ) if( artist.isEmpty() || track.isEmpty() )
@@ -71,7 +71,7 @@ MusixMatchPlugin::getInfo( const QString caller, const Tomahawk::InfoSystem::Inf
url.addQueryItem("q_artist", artist); url.addQueryItem("q_artist", artist);
url.addQueryItem("q_track", track); url.addQueryItem("q_track", track);
QNetworkReply* reply = m_nam.data()->get(QNetworkRequest(url)); QNetworkReply* reply = m_nam.data()->get(QNetworkRequest(url));
reply->setProperty("customData", QVariant::fromValue<Tomahawk::InfoSystem::InfoCustomData>(customData)); reply->setProperty("customData", QVariant::fromValue<QVariantMap>(customData));
reply->setProperty("origData", input); reply->setProperty("origData", input);
reply->setProperty("caller", caller); reply->setProperty("caller", caller);
@@ -79,16 +79,16 @@ MusixMatchPlugin::getInfo( const QString caller, const Tomahawk::InfoSystem::Inf
} }
bool bool
MusixMatchPlugin::isValidTrackData( const QString &caller, const QVariant &input, const Tomahawk::InfoSystem::InfoCustomData &customData ) MusixMatchPlugin::isValidTrackData( const QString &caller, const QVariant &input, const QVariantMap &customData )
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
if (input.isNull() || !input.isValid() || !input.canConvert<Tomahawk::InfoSystem::InfoCustomData>()) if (input.isNull() || !input.isValid() || !input.canConvert<QVariantMap>())
{ {
emit info(caller, Tomahawk::InfoSystem::InfoTrackLyrics, input, QVariant(), customData); emit info(caller, Tomahawk::InfoSystem::InfoTrackLyrics, input, QVariant(), customData);
qDebug() << "MusixMatchPlugin::isValidTrackData: Data null, invalid, or can't convert"; qDebug() << "MusixMatchPlugin::isValidTrackData: Data null, invalid, or can't convert";
return false; return false;
} }
InfoCustomData hash = input.value<Tomahawk::InfoSystem::InfoCustomData>(); QVariantMap hash = input.value<QVariantMap>();
if (hash["trackName"].toString().isEmpty() ) if (hash["trackName"].toString().isEmpty() )
{ {
emit info(caller, Tomahawk::InfoSystem::InfoTrackLyrics, input, QVariant(), customData); emit info(caller, Tomahawk::InfoSystem::InfoTrackLyrics, input, QVariant(), customData);
@@ -111,7 +111,7 @@ MusixMatchPlugin::trackSearchSlot()
QNetworkReply* oldReply = qobject_cast<QNetworkReply*>( sender() ); QNetworkReply* oldReply = qobject_cast<QNetworkReply*>( sender() );
if ( !oldReply || m_nam.isNull() ) if ( !oldReply || m_nam.isNull() )
{ {
emit info(QString(), Tomahawk::InfoSystem::InfoTrackLyrics, QVariant(), QVariant(), Tomahawk::InfoSystem::InfoCustomData()); emit info(QString(), Tomahawk::InfoSystem::InfoTrackLyrics, QVariant(), QVariant(), QVariantMap());
return; return;
} }
QDomDocument doc; QDomDocument doc;
@@ -120,7 +120,7 @@ MusixMatchPlugin::trackSearchSlot()
QDomNodeList domNodeList = doc.elementsByTagName("track_id"); QDomNodeList domNodeList = doc.elementsByTagName("track_id");
if (domNodeList.isEmpty()) if (domNodeList.isEmpty())
{ {
emit info(oldReply->property("caller").toString(), Tomahawk::InfoSystem::InfoTrackLyrics, oldReply->property("origData"), QVariant(), oldReply->property("customData").value<Tomahawk::InfoSystem::InfoCustomData>()); emit info(oldReply->property("caller").toString(), Tomahawk::InfoSystem::InfoTrackLyrics, oldReply->property("origData"), QVariant(), oldReply->property("customData").value<QVariantMap>());
return; return;
} }
QString track_id = domNodeList.at(0).toElement().text(); QString track_id = domNodeList.at(0).toElement().text();
@@ -142,7 +142,7 @@ MusixMatchPlugin::trackLyricsSlot()
QNetworkReply* reply = qobject_cast<QNetworkReply*>( sender() ); QNetworkReply* reply = qobject_cast<QNetworkReply*>( sender() );
if (!reply) if (!reply)
{ {
emit info(QString(), Tomahawk::InfoSystem::InfoTrackLyrics, QVariant(), QVariant(), Tomahawk::InfoSystem::InfoCustomData()); emit info(QString(), Tomahawk::InfoSystem::InfoTrackLyrics, QVariant(), QVariant(), QVariantMap());
return; return;
} }
QDomDocument doc; QDomDocument doc;
@@ -150,10 +150,10 @@ MusixMatchPlugin::trackLyricsSlot()
QDomNodeList domNodeList = doc.elementsByTagName("lyrics_body"); QDomNodeList domNodeList = doc.elementsByTagName("lyrics_body");
if (domNodeList.isEmpty()) if (domNodeList.isEmpty())
{ {
emit info(reply->property("caller").toString(), Tomahawk::InfoSystem::InfoTrackLyrics, reply->property("origData"), QVariant(), reply->property("customData").value<Tomahawk::InfoSystem::InfoCustomData>()); emit info(reply->property("caller").toString(), Tomahawk::InfoSystem::InfoTrackLyrics, reply->property("origData"), QVariant(), reply->property("customData").value<QVariantMap>());
return; return;
} }
QString lyrics = domNodeList.at(0).toElement().text(); QString lyrics = domNodeList.at(0).toElement().text();
qDebug() << "Emitting lyrics: " << lyrics; qDebug() << "Emitting lyrics: " << lyrics;
emit info(reply->property("caller").toString(), Tomahawk::InfoSystem::InfoTrackLyrics, reply->property("origData"), QVariant(lyrics), reply->property("customData").value<Tomahawk::InfoSystem::InfoCustomData>()); emit info(reply->property("caller").toString(), Tomahawk::InfoSystem::InfoTrackLyrics, reply->property("origData"), QVariant(lyrics), reply->property("customData").value<QVariantMap>());
} }

View File

@@ -45,7 +45,7 @@ public slots:
void namChangedSlot( QNetworkAccessManager *nam ); void namChangedSlot( QNetworkAccessManager *nam );
protected slots: protected slots:
virtual void getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData ); virtual void getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData );
virtual void pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant data ) virtual void pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant data )
{ {
@@ -54,7 +54,7 @@ protected slots:
Q_UNUSED( data ); Q_UNUSED( data );
} }
virtual void notInCacheSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData ) virtual void notInCacheSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData )
{ {
Q_UNUSED( criteria ); Q_UNUSED( criteria );
Q_UNUSED( caller ); Q_UNUSED( caller );
@@ -64,7 +64,7 @@ protected slots:
} }
private: private:
bool isValidTrackData( const QString &caller, const QVariant &input, const InfoCustomData &customData ); bool isValidTrackData( const QString &caller, const QVariant &input, const QVariantMap &customData );
QString m_apiKey; QString m_apiKey;

View File

@@ -97,7 +97,7 @@ AdiumPlugin::settingsChanged()
} }
void void
AdiumPlugin::getInfo( const QString caller, const InfoType type, const QVariant data, InfoCustomData customData ) AdiumPlugin::getInfo( const QString caller, const InfoType type, const QVariant data, QVariantMap customData )
{ {
switch (type) switch (type)
{ {

View File

@@ -39,12 +39,12 @@ public:
virtual ~AdiumPlugin(); virtual ~AdiumPlugin();
protected slots: protected slots:
void getInfo( const QString caller, const InfoType type, const QVariant data, InfoCustomData customData ); void getInfo( const QString caller, const InfoType type, const QVariant data, QVariantMap customData );
void pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input ); void pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input );
public slots: public slots:
void namChangedSlot( QNetworkAccessManager* /*nam*/ ) {} // unused void namChangedSlot( QNetworkAccessManager* /*nam*/ ) {} // unused
void notInCacheSlot( const Tomahawk::InfoSystem::InfoCriteriaHash /*criteria*/, const QString /*caller*/, const Tomahawk::InfoSystem::InfoType /*type*/, const QVariant /*input*/, const Tomahawk::InfoSystem::InfoCustomData /*customData*/ ) {} // unused void notInCacheSlot( const Tomahawk::InfoSystem::InfoCriteriaHash /*criteria*/, const QString /*caller*/, const Tomahawk::InfoSystem::InfoType /*type*/, const QVariant /*input*/, const QVariantMap /*customData*/ ) {} // unused
private slots: private slots:
void clearStatus(); void clearStatus();

View File

@@ -63,12 +63,12 @@ FdoNotifyPlugin::pushInfo( const QString caller, const Tomahawk::InfoSystem::Inf
{ {
Q_UNUSED( caller ); Q_UNUSED( caller );
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
if ( type != Tomahawk::InfoSystem::InfoNotifyUser || !pushData.canConvert< Tomahawk::InfoSystem::InfoCustomData >() ) if ( type != Tomahawk::InfoSystem::InfoNotifyUser || !pushData.canConvert< QVariantMap >() )
{ {
qDebug() << Q_FUNC_INFO << " not the right type or could not convert the hash"; qDebug() << Q_FUNC_INFO << " not the right type or could not convert the hash";
return; return;
} }
Tomahawk::InfoSystem::InfoCustomData hash = pushData.value< Tomahawk::InfoSystem::InfoCustomData >(); QVariantMap hash = pushData.value< QVariantMap >();
if ( !hash.contains( "message" ) ) if ( !hash.contains( "message" ) )
{ {
qDebug() << Q_FUNC_INFO << " hash did not contain a message"; qDebug() << Q_FUNC_INFO << " hash did not contain a message";

View File

@@ -38,7 +38,7 @@ public:
virtual void namChangedSlot( QNetworkAccessManager* ) {} virtual void namChangedSlot( QNetworkAccessManager* ) {}
protected slots: protected slots:
virtual void getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData ) virtual void getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData )
{ {
Q_UNUSED( caller ); Q_UNUSED( caller );
Q_UNUSED( type ); Q_UNUSED( type );
@@ -48,7 +48,7 @@ protected slots:
virtual void pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant pushData ); virtual void pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant pushData );
virtual void notInCacheSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData ) virtual void notInCacheSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData )
{ {
Q_UNUSED( criteria ); Q_UNUSED( criteria );
Q_UNUSED( caller ); Q_UNUSED( caller );

View File

@@ -71,11 +71,11 @@ InfoSystem::InfoSystem(QObject *parent)
connect( TomahawkSettings::instance(), SIGNAL( changed() ), SLOT( newNam() ) ); connect( TomahawkSettings::instance(), SIGNAL( changed() ), SLOT( newNam() ) );
connect( m_cache.data(), SIGNAL( info( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ), connect( m_cache.data(), SIGNAL( info( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, QVariantMap ) ),
this, SLOT( infoSlot( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ), Qt::UniqueConnection ); this, SLOT( infoSlot( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, QVariantMap ) ), Qt::UniqueConnection );
connect( m_worker.data(), SIGNAL( info( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ), connect( m_worker.data(), SIGNAL( info( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, QVariantMap ) ),
this, SLOT( infoSlot( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ), Qt::UniqueConnection ); this, SLOT( infoSlot( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, QVariantMap ) ), Qt::UniqueConnection );
} }
InfoSystem::~InfoSystem() InfoSystem::~InfoSystem()
@@ -116,18 +116,18 @@ InfoSystem::newNam() const
void void
InfoSystem::getInfo( const QString &caller, const InfoType type, const QVariant& input, InfoCustomData customData ) InfoSystem::getInfo( const QString &caller, const InfoType type, const QVariant& input, QVariantMap customData )
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
m_dataTracker[caller][type] = m_dataTracker[caller][type] + 1; m_dataTracker[caller][type] = m_dataTracker[caller][type] + 1;
qDebug() << "current count in dataTracker for type" << type << "is" << m_dataTracker[caller][type]; qDebug() << "current count in dataTracker for type" << type << "is" << m_dataTracker[caller][type];
QMetaObject::invokeMethod( m_worker.data(), "getInfo", Qt::QueuedConnection, Q_ARG( QString, caller ), Q_ARG( Tomahawk::InfoSystem::InfoType, type ), Q_ARG( QVariant, input ), Q_ARG( Tomahawk::InfoSystem::InfoCustomData, customData ) ); QMetaObject::invokeMethod( m_worker.data(), "getInfo", Qt::QueuedConnection, Q_ARG( QString, caller ), Q_ARG( Tomahawk::InfoSystem::InfoType, type ), Q_ARG( QVariant, input ), Q_ARG( QVariantMap, customData ) );
} }
void void
InfoSystem::getInfo( const QString &caller, const InfoTypeMap &input, InfoCustomData customData ) InfoSystem::getInfo( const QString &caller, const InfoTypeMap &input, QVariantMap customData )
{ {
Q_FOREACH( InfoType type, input.keys() ) Q_FOREACH( InfoType type, input.keys() )
getInfo( caller, type, input[type], customData ); getInfo( caller, type, input[type], customData );
@@ -152,7 +152,7 @@ InfoSystem::pushInfo( const QString &caller, const InfoTypeMap &input )
void void
InfoSystem::infoSlot( QString target, InfoType type, QVariant input, QVariant output, InfoCustomData customData ) InfoSystem::infoSlot( QString target, InfoType type, QVariant input, QVariant output, QVariantMap customData )
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
qDebug() << "current count in dataTracker is " << m_dataTracker[target][type]; qDebug() << "current count in dataTracker is " << m_dataTracker[target][type];

View File

@@ -109,7 +109,6 @@ enum InfoType { // as items are saved in cache, mark them here to not change the
typedef QMap< InfoType, QVariant > InfoTypeMap; typedef QMap< InfoType, QVariant > InfoTypeMap;
typedef QMap< QString, QMap< QString, QString > > InfoGenericMap; typedef QMap< QString, QMap< QString, QString > > InfoGenericMap;
typedef QHash< QString, QVariant > InfoCustomData;
typedef QHash< QString, QString > InfoCriteriaHash; typedef QHash< QString, QString > InfoCriteriaHash;
class DLLEXPORT InfoPlugin : public QObject class DLLEXPORT InfoPlugin : public QObject
@@ -125,15 +124,15 @@ public:
QSet< InfoType > supportedPushTypes() const { return m_supportedPushTypes; } QSet< InfoType > supportedPushTypes() const { return m_supportedPushTypes; }
signals: signals:
void getCachedInfo( Tomahawk::InfoSystem::InfoCriteriaHash criteria, qint64 newMaxAge, QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, Tomahawk::InfoSystem::InfoCustomData customData ); void getCachedInfo( Tomahawk::InfoSystem::InfoCriteriaHash criteria, qint64 newMaxAge, QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariantMap customData );
void updateCache( Tomahawk::InfoSystem::InfoCriteriaHash criteria, qint64, Tomahawk::InfoSystem::InfoType type, QVariant output ); void updateCache( Tomahawk::InfoSystem::InfoCriteriaHash criteria, qint64, Tomahawk::InfoSystem::InfoType type, QVariant output );
void info( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomData customData ); void info( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, QVariantMap customData );
void finished( QString, Tomahawk::InfoSystem::InfoType ); void finished( QString, Tomahawk::InfoSystem::InfoType );
protected slots: protected slots:
virtual void getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant data, const Tomahawk::InfoSystem::InfoCustomData customData ) = 0; virtual void getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant data, const QVariantMap customData ) = 0;
virtual void pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant data ) = 0; virtual void pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant data ) = 0;
virtual void notInCacheSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData ) = 0; virtual void notInCacheSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData ) = 0;
virtual void namChangedSlot( QNetworkAccessManager *nam ) = 0; virtual void namChangedSlot( QNetworkAccessManager *nam ) = 0;
@@ -158,17 +157,17 @@ public:
InfoSystem( QObject *parent ); InfoSystem( QObject *parent );
~InfoSystem(); ~InfoSystem();
void getInfo( const QString &caller, const InfoType type, const QVariant &input, InfoCustomData customData ); void getInfo( const QString &caller, const InfoType type, const QVariant &input, QVariantMap customData );
void getInfo( const QString &caller, const InfoTypeMap &input, InfoCustomData customData ); void getInfo( const QString &caller, const InfoTypeMap &input, QVariantMap customData );
void pushInfo( const QString &caller, const InfoType type, const QVariant &input ); void pushInfo( const QString &caller, const InfoType type, const QVariant &input );
void pushInfo( const QString &caller, const InfoTypeMap &input ); void pushInfo( const QString &caller, const InfoTypeMap &input );
signals: signals:
void info( QString caller, Tomahawk::InfoSystem::InfoType, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomData customData ); void info( QString caller, Tomahawk::InfoSystem::InfoType, QVariant input, QVariant output, QVariantMap customData );
void finished( QString target ); void finished( QString target );
public slots: public slots:
void infoSlot( const QString target, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariant output, const Tomahawk::InfoSystem::InfoCustomData customData ); void infoSlot( const QString target, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariant output, const QVariantMap customData );
void newNam() const; void newNam() const;
@@ -206,7 +205,6 @@ inline uint qHash( Tomahawk::InfoSystem::InfoCriteriaHash hash )
} }
Q_DECLARE_METATYPE( Tomahawk::InfoSystem::InfoGenericMap ); Q_DECLARE_METATYPE( Tomahawk::InfoSystem::InfoGenericMap );
Q_DECLARE_METATYPE( Tomahawk::InfoSystem::InfoCustomData );
Q_DECLARE_METATYPE( Tomahawk::InfoSystem::InfoCriteriaHash ); Q_DECLARE_METATYPE( Tomahawk::InfoSystem::InfoCriteriaHash );
Q_DECLARE_METATYPE( QWeakPointer< Tomahawk::InfoSystem::InfoSystemCache > ); Q_DECLARE_METATYPE( QWeakPointer< Tomahawk::InfoSystem::InfoSystemCache > );

View File

@@ -84,7 +84,7 @@ InfoSystemCache::pruneTimerFired()
void void
InfoSystemCache::getCachedInfoSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const qint64 newMaxAge, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData ) InfoSystemCache::getCachedInfoSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const qint64 newMaxAge, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData )
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
const QString criteriaHashVal = criteriaMd5( criteria ); const QString criteriaHashVal = criteriaMd5( criteria );

View File

@@ -43,11 +43,11 @@ public:
virtual ~InfoSystemCache(); virtual ~InfoSystemCache();
signals: signals:
void notInCache( Tomahawk::InfoSystem::InfoCriteriaHash criteria, QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, Tomahawk::InfoSystem::InfoCustomData customData ); void notInCache( Tomahawk::InfoSystem::InfoCriteriaHash criteria, QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariantMap customData );
void info( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomData customData ); void info( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, QVariantMap customData );
public slots: public slots:
void getCachedInfoSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const qint64 newMaxAge, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData ); void getCachedInfoSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const qint64 newMaxAge, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData );
void updateCacheSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const qint64 maxAge, const Tomahawk::InfoSystem::InfoType type, const QVariant output ); void updateCacheSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const qint64 maxAge, const Tomahawk::InfoSystem::InfoType type, const QVariant output );
private slots: private slots:

View File

@@ -87,23 +87,23 @@ InfoSystemWorker::init( QWeakPointer< Tomahawk::InfoSystem::InfoSystemCache> cac
{ {
connect( connect(
plugin.data(), plugin.data(),
SIGNAL( info( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ), SIGNAL( info( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, QVariantMap ) ),
InfoSystem::instance(), InfoSystem::instance(),
SLOT( infoSlot( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ), SLOT( infoSlot( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, QVariantMap ) ),
Qt::UniqueConnection Qt::UniqueConnection
); );
connect( connect(
plugin.data(), plugin.data(),
SIGNAL( getCachedInfo( Tomahawk::InfoSystem::InfoCriteriaHash, qint64, QString, Tomahawk::InfoSystem::InfoType, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ), SIGNAL( getCachedInfo( Tomahawk::InfoSystem::InfoCriteriaHash, qint64, QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariantMap ) ),
cache.data(), cache.data(),
SLOT( getCachedInfoSlot( Tomahawk::InfoSystem::InfoCriteriaHash, qint64, QString, Tomahawk::InfoSystem::InfoType, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ) SLOT( getCachedInfoSlot( Tomahawk::InfoSystem::InfoCriteriaHash, qint64, QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariantMap ) )
); );
connect( connect(
cache.data(), cache.data(),
SIGNAL( notInCache( Tomahawk::InfoSystem::InfoCriteriaHash, QString, Tomahawk::InfoSystem::InfoType, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ), SIGNAL( notInCache( Tomahawk::InfoSystem::InfoCriteriaHash, QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariantMap ) ),
plugin.data(), plugin.data(),
SLOT( notInCacheSlot( Tomahawk::InfoSystem::InfoCriteriaHash, QString, Tomahawk::InfoSystem::InfoType, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ) SLOT( notInCacheSlot( Tomahawk::InfoSystem::InfoCriteriaHash, QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariantMap ) )
); );
connect( connect(
plugin.data(), plugin.data(),
@@ -147,7 +147,7 @@ InfoSystemWorker::determineOrderedMatches( const InfoType type ) const
void void
InfoSystemWorker::getInfo( QString caller, InfoType type, QVariant input, InfoCustomData customData ) InfoSystemWorker::getInfo( QString caller, InfoType type, QVariant input, QVariantMap customData )
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
QLinkedList< InfoPluginPtr > providers = determineOrderedMatches(type); QLinkedList< InfoPluginPtr > providers = determineOrderedMatches(type);
@@ -164,7 +164,7 @@ InfoSystemWorker::getInfo( QString caller, InfoType type, QVariant input, InfoCu
return; return;
} }
QMetaObject::invokeMethod( ptr.data(), "getInfo", Qt::QueuedConnection, Q_ARG( QString, caller ), Q_ARG( Tomahawk::InfoSystem::InfoType, type ), Q_ARG( QVariant, input ), Q_ARG( Tomahawk::InfoSystem::InfoCustomData, customData ) ); QMetaObject::invokeMethod( ptr.data(), "getInfo", Qt::QueuedConnection, Q_ARG( QString, caller ), Q_ARG( Tomahawk::InfoSystem::InfoType, type ), Q_ARG( QVariant, input ), Q_ARG( QVariantMap, customData ) );
} }

View File

@@ -48,12 +48,12 @@ public:
QNetworkAccessManager* nam() const; QNetworkAccessManager* nam() const;
signals: signals:
void info( QString target, Tomahawk::InfoSystem::InfoType, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomData customData ); void info( QString target, Tomahawk::InfoSystem::InfoType, QVariant input, QVariant output, QVariantMap customData );
void namChanged( QNetworkAccessManager* ); void namChanged( QNetworkAccessManager* );
public slots: public slots:
void init( QWeakPointer< Tomahawk::InfoSystem::InfoSystemCache > cache ); void init( QWeakPointer< Tomahawk::InfoSystem::InfoSystemCache > cache );
void getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData ); void getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData );
void pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input ); void pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input );
void newNam(); void newNam();

View File

@@ -44,8 +44,8 @@ AlbumModel::AlbumModel( QObject* parent )
.scaled( QSize( 120, 120 ), Qt::IgnoreAspectRatio, Qt::SmoothTransformation ); .scaled( QSize( 120, 120 ), Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
connect( Tomahawk::InfoSystem::InfoSystem::instance(), connect( Tomahawk::InfoSystem::InfoSystem::instance(),
SIGNAL( info( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ), SIGNAL( info( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, QVariantMap ) ),
SLOT( infoSystemInfo( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ) ); SLOT( infoSystemInfo( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, QVariantMap ) ) );
connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( finished( QString ) ), SLOT( infoSystemFinished( QString ) ) ); connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( finished( QString ) ), SLOT( infoSystemFinished( QString ) ) );
} }
@@ -311,7 +311,7 @@ AlbumModel::onAlbumsAdded( const QList<Tomahawk::album_ptr>& albums )
void void
AlbumModel::infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomData customData ) AlbumModel::infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, QVariantMap customData )
{ {
Q_UNUSED( customData ); Q_UNUSED( customData );
qDebug() << Q_FUNC_INFO << " with caller " << caller; qDebug() << Q_FUNC_INFO << " with caller " << caller;
@@ -323,14 +323,14 @@ AlbumModel::infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type,
return; return;
} }
if ( !output.canConvert< Tomahawk::InfoSystem::InfoCustomData >() ) if ( !output.canConvert< QVariantMap >() )
{ {
qDebug() << "Cannot convert fetched art from a QByteArray"; qDebug() << "Cannot convert fetched art from a QByteArray";
return; return;
} }
Tomahawk::InfoSystem::InfoCriteriaHash pptr = input.value< Tomahawk::InfoSystem::InfoCriteriaHash >(); Tomahawk::InfoSystem::InfoCriteriaHash pptr = input.value< Tomahawk::InfoSystem::InfoCriteriaHash >();
Tomahawk::InfoSystem::InfoCustomData returnedData = output.value< Tomahawk::InfoSystem::InfoCustomData >(); QVariantMap returnedData = output.value< QVariantMap >();
const QByteArray ba = returnedData["imgbytes"].toByteArray(); const QByteArray ba = returnedData["imgbytes"].toByteArray();
if ( ba.length() ) if ( ba.length() )
{ {

View File

@@ -97,7 +97,7 @@ private slots:
void onAlbumsAdded( const QList<Tomahawk::album_ptr>& albums ); void onAlbumsAdded( const QList<Tomahawk::album_ptr>& albums );
void onDataChanged(); void onDataChanged();
void infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomData customData ); void infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, QVariantMap customData );
void infoSystemFinished( QString target ); void infoSystemFinished( QString target );
private: private:

View File

@@ -164,7 +164,7 @@ AlbumView::onScrollTimeout()
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( Tomahawk::InfoSystem::InfoSystem::instance()->getInfo(
s_tmInfoIdentifier, Tomahawk::InfoSystem::InfoAlbumCoverArt, s_tmInfoIdentifier, Tomahawk::InfoSystem::InfoAlbumCoverArt,
QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( trackInfo ), Tomahawk::InfoSystem::InfoCustomData() ); QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( trackInfo ), QVariantMap() );
} }
} }
} }

View File

@@ -251,7 +251,7 @@ ArtistView::onScrollTimeout()
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( Tomahawk::InfoSystem::InfoSystem::instance()->getInfo(
s_tmInfoIdentifier, Tomahawk::InfoSystem::InfoArtistImages, s_tmInfoIdentifier, Tomahawk::InfoSystem::InfoArtistImages,
QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( trackInfo ), Tomahawk::InfoSystem::InfoCustomData() ); QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( trackInfo ), QVariantMap() );
} }
} }

View File

@@ -47,8 +47,8 @@ TreeModel::TreeModel( QObject* parent )
connect( AudioEngine::instance(), SIGNAL( stopped() ), SLOT( onPlaybackStopped() ), Qt::DirectConnection ); connect( AudioEngine::instance(), SIGNAL( stopped() ), SLOT( onPlaybackStopped() ), Qt::DirectConnection );
connect( Tomahawk::InfoSystem::InfoSystem::instance(), connect( Tomahawk::InfoSystem::InfoSystem::instance(),
SIGNAL( info( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ), SIGNAL( info( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, QVariantMap ) ),
SLOT( infoSystemInfo( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ) ); SLOT( infoSystemInfo( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, QVariantMap ) ) );
connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( finished( QString ) ), SLOT( infoSystemFinished( QString ) ) ); connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( finished( QString ) ), SLOT( infoSystemFinished( QString ) ) );
} }
@@ -544,7 +544,7 @@ TreeModel::onAlbumsAdded( const QList<Tomahawk::album_ptr>& albums, const QVaria
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( Tomahawk::InfoSystem::InfoSystem::instance()->getInfo(
s_tmInfoIdentifier, Tomahawk::InfoSystem::InfoAlbumCoverArt, s_tmInfoIdentifier, Tomahawk::InfoSystem::InfoAlbumCoverArt,
QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( trackInfo ), Tomahawk::InfoSystem::InfoCustomData() ); QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( trackInfo ), QVariantMap() );
} }
if ( !parent.isValid() || crows.second > 0 ) if ( !parent.isValid() || crows.second > 0 )
@@ -600,7 +600,7 @@ TreeModel::onTracksAdded( const QList<Tomahawk::query_ptr>& tracks, const QVaria
void void
TreeModel::infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomData customData ) TreeModel::infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, QVariantMap customData )
{ {
Q_UNUSED( customData ); Q_UNUSED( customData );
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
@@ -612,14 +612,14 @@ TreeModel::infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type,
return; return;
} }
if ( !output.canConvert< Tomahawk::InfoSystem::InfoCustomData >() ) if ( !output.canConvert< QVariantMap >() )
{ {
qDebug() << "Cannot convert fetched art from a QByteArray"; qDebug() << "Cannot convert fetched art from a QByteArray";
return; return;
} }
Tomahawk::InfoSystem::InfoCriteriaHash pptr = input.value< Tomahawk::InfoSystem::InfoCriteriaHash >(); Tomahawk::InfoSystem::InfoCriteriaHash pptr = input.value< Tomahawk::InfoSystem::InfoCriteriaHash >();
Tomahawk::InfoSystem::InfoCustomData returnedData = output.value< Tomahawk::InfoSystem::InfoCustomData >(); QVariantMap returnedData = output.value< QVariantMap >();
const QByteArray ba = returnedData["imgbytes"].toByteArray(); const QByteArray ba = returnedData["imgbytes"].toByteArray();
qDebug() << "ba.length = " << ba.length(); qDebug() << "ba.length = " << ba.length();
if ( ba.length() ) if ( ba.length() )

View File

@@ -125,7 +125,7 @@ private slots:
void onAlbumsAdded( const QList<Tomahawk::album_ptr>& albums, const QVariant& data ); void onAlbumsAdded( const QList<Tomahawk::album_ptr>& albums, const QVariant& data );
void onTracksAdded( const QList<Tomahawk::query_ptr>& tracks, const QVariant& data ); void onTracksAdded( const QList<Tomahawk::query_ptr>& tracks, const QVariant& data );
void infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomData customData ); void infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, QVariantMap customData );
void infoSystemFinished( QString target ); void infoSystemFinished( QString target );
void onPlaybackFinished( const Tomahawk::result_ptr& result ); void onPlaybackFinished( const Tomahawk::result_ptr& result );

View File

@@ -64,8 +64,8 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget*
m_pixmap = QPixmap( RESPATH "images/no-album-art-placeholder.png" ).scaledToWidth( 48, Qt::SmoothTransformation ); m_pixmap = QPixmap( RESPATH "images/no-album-art-placeholder.png" ).scaledToWidth( 48, Qt::SmoothTransformation );
connect( Tomahawk::InfoSystem::InfoSystem::instance(), connect( Tomahawk::InfoSystem::InfoSystem::instance(),
SIGNAL( info( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ), SIGNAL( info( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, QVariantMap ) ),
SLOT( infoSystemInfo( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ) ); SLOT( infoSystemInfo( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, QVariantMap ) ) );
connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( finished( QString ) ), SLOT( infoSystemFinished( QString ) ) ); connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( finished( QString ) ), SLOT( infoSystemFinished( QString ) ) );
@@ -89,7 +89,7 @@ ArtistInfoWidget::load( const artist_ptr& artist )
artistInfo["artist"] = artist->name(); artistInfo["artist"] = artist->name();
InfoSystem::InfoTypeMap infoMap; InfoSystem::InfoTypeMap infoMap;
InfoSystem::InfoCustomData hash; QVariantMap hash;
infoMap[InfoSystem::InfoArtistBiography] = artist->name(); infoMap[InfoSystem::InfoArtistBiography] = artist->name();
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( Tomahawk::InfoSystem::InfoSystem::instance()->getInfo(
@@ -97,20 +97,20 @@ ArtistInfoWidget::load( const artist_ptr& artist )
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( Tomahawk::InfoSystem::InfoSystem::instance()->getInfo(
s_aiInfoIdentifier, Tomahawk::InfoSystem::InfoArtistImages, s_aiInfoIdentifier, Tomahawk::InfoSystem::InfoArtistImages,
QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( artistInfo ), Tomahawk::InfoSystem::InfoCustomData() ); QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( artistInfo ), QVariantMap() );
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( Tomahawk::InfoSystem::InfoSystem::instance()->getInfo(
s_aiInfoIdentifier, Tomahawk::InfoSystem::InfoArtistSimilars, s_aiInfoIdentifier, Tomahawk::InfoSystem::InfoArtistSimilars,
QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( artistInfo ), Tomahawk::InfoSystem::InfoCustomData() ); QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( artistInfo ), QVariantMap() );
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( Tomahawk::InfoSystem::InfoSystem::instance()->getInfo(
s_aiInfoIdentifier, Tomahawk::InfoSystem::InfoArtistSongs, s_aiInfoIdentifier, Tomahawk::InfoSystem::InfoArtistSongs,
QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( artistInfo ), Tomahawk::InfoSystem::InfoCustomData() ); QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( artistInfo ), QVariantMap() );
} }
void void
ArtistInfoWidget::infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomData customData ) ArtistInfoWidget::infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, QVariantMap customData )
{ {
Q_UNUSED( input ); Q_UNUSED( input );
Q_UNUSED( customData ); Q_UNUSED( customData );
@@ -125,7 +125,7 @@ ArtistInfoWidget::infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType
InfoSystem::InfoCriteriaHash trackInfo; InfoSystem::InfoCriteriaHash trackInfo;
trackInfo = input.value< InfoSystem::InfoCriteriaHash >(); trackInfo = input.value< InfoSystem::InfoCriteriaHash >();
if ( output.canConvert< Tomahawk::InfoSystem::InfoCustomData >() ) if ( output.canConvert< QVariantMap >() )
{ {
if ( trackInfo["artist"] != m_artist->name() ) if ( trackInfo["artist"] != m_artist->name() )
{ {
@@ -134,7 +134,7 @@ ArtistInfoWidget::infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType
} }
} }
InfoSystem::InfoCustomData returnedData = output.value< Tomahawk::InfoSystem::InfoCustomData >(); QVariantMap returnedData = output.value< QVariantMap >();
switch ( type ) switch ( type )
{ {
case InfoSystem::InfoArtistBiography: case InfoSystem::InfoArtistBiography:

View File

@@ -86,7 +86,7 @@ protected:
void changeEvent( QEvent* e ); void changeEvent( QEvent* e );
private slots: private slots:
void infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomData customData ); void infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, QVariantMap customData );
void infoSystemFinished( QString target ); void infoSystemFinished( QString target );
private: private:

View File

@@ -38,8 +38,8 @@ Scrobbler::Scrobbler( QObject* parent )
SLOT( engineTick( unsigned int ) ), Qt::QueuedConnection ); SLOT( engineTick( unsigned int ) ), Qt::QueuedConnection );
connect( Tomahawk::InfoSystem::InfoSystem::instance(), connect( Tomahawk::InfoSystem::InfoSystem::instance(),
SIGNAL( info( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ), SIGNAL( info( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, QVariantMap ) ),
SLOT( infoSystemInfo( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ) ); SLOT( infoSystemInfo( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, QVariantMap ) ) );
connect( AudioEngine::instance(), SIGNAL( started( const Tomahawk::result_ptr& ) ), connect( AudioEngine::instance(), SIGNAL( started( const Tomahawk::result_ptr& ) ),
SLOT( trackStarted( const Tomahawk::result_ptr& ) ), Qt::QueuedConnection ); SLOT( trackStarted( const Tomahawk::result_ptr& ) ), Qt::QueuedConnection );
@@ -135,7 +135,7 @@ Scrobbler::scrobble()
void void
Scrobbler::infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomData customData ) Scrobbler::infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, QVariantMap customData )
{ {
Q_UNUSED( type ); Q_UNUSED( type );
Q_UNUSED( input ); Q_UNUSED( input );

View File

@@ -45,7 +45,7 @@ public slots:
void trackStopped(); void trackStopped();
void engineTick( unsigned int secondsElapsed ); void engineTick( unsigned int secondsElapsed );
void infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomData customData ); void infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, QVariantMap customData );
void infoSystemFinished( QString target ); void infoSystemFinished( QString target );
private: private:

View File

@@ -418,7 +418,6 @@ TomahawkApp::registerMetaTypes()
qRegisterMetaType< AudioErrorCode >("AudioErrorCode"); qRegisterMetaType< AudioErrorCode >("AudioErrorCode");
qRegisterMetaType< QMap< QString, QMap< QString, QString > > >( "Tomahawk::InfoSystem::InfoGenericMap" ); qRegisterMetaType< QMap< QString, QMap< QString, QString > > >( "Tomahawk::InfoSystem::InfoGenericMap" );
qRegisterMetaType< QHash< QString, QVariant > >( "Tomahawk::InfoSystem::InfoCustomData" );
qRegisterMetaType< QHash< QString, QString > >( "Tomahawk::InfoSystem::InfoCriteriaHash" ); qRegisterMetaType< QHash< QString, QString > >( "Tomahawk::InfoSystem::InfoCriteriaHash" );
qRegisterMetaType< Tomahawk::InfoSystem::InfoType >( "Tomahawk::InfoSystem::InfoType" ); qRegisterMetaType< Tomahawk::InfoSystem::InfoType >( "Tomahawk::InfoSystem::InfoType" );
qRegisterMetaType< QWeakPointer< Tomahawk::InfoSystem::InfoSystemCache > >( "QWeakPointer< Tomahawk::InfoSystem::InfoSystemCache >" ); qRegisterMetaType< QWeakPointer< Tomahawk::InfoSystem::InfoSystemCache > >( "QWeakPointer< Tomahawk::InfoSystem::InfoSystemCache >" );

View File

@@ -66,8 +66,8 @@ XMPPBot::XMPPBot(QObject *parent)
SLOT(newTrackSlot(const Tomahawk::result_ptr &))); SLOT(newTrackSlot(const Tomahawk::result_ptr &)));
connect(InfoSystem::instance(), connect(InfoSystem::instance(),
SIGNAL(info(QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomData)), SIGNAL(info(QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, QVariantMap)),
SLOT(infoReturnedSlot(QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomData))); SLOT(infoReturnedSlot(QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, QVariantMap)));
connect(InfoSystem::instance(), SIGNAL(finished(QString)), SLOT(infoFinishedSlot(QString))); connect(InfoSystem::instance(), SIGNAL(finished(QString)), SLOT(infoFinishedSlot(QString)));
@@ -214,10 +214,10 @@ void XMPPBot::handleMessage(const Message& msg, MessageSession* session)
infoMap[InfoArtistFamiliarity] = m_currTrack.data()->artist()->name(); infoMap[InfoArtistFamiliarity] = m_currTrack.data()->artist()->name();
if (token == "lyrics") if (token == "lyrics")
{ {
InfoCustomData myhash; QVariantMap myhash;
myhash["trackName"] = QVariant::fromValue<QString>(m_currTrack.data()->track()); myhash["trackName"] = QVariant::fromValue<QString>(m_currTrack.data()->track());
myhash["artistName"] = QVariant::fromValue<QString>(m_currTrack.data()->artist()->name()); myhash["artistName"] = QVariant::fromValue<QString>(m_currTrack.data()->artist()->name());
infoMap[InfoTrackLyrics] = QVariant::fromValue<Tomahawk::InfoSystem::InfoCustomData>(myhash); infoMap[InfoTrackLyrics] = QVariant::fromValue<QVariantMap>(myhash);
} }
} }
@@ -234,12 +234,12 @@ void XMPPBot::handleMessage(const Message& msg, MessageSession* session)
QString waitMsg("Please wait..."); QString waitMsg("Please wait...");
Message retMsg(Message::Chat, JID(originatingJid.toStdString()), waitMsg.toStdString()); Message retMsg(Message::Chat, JID(originatingJid.toStdString()), waitMsg.toStdString());
m_client.data()->send(retMsg); m_client.data()->send(retMsg);
Tomahawk::InfoSystem::InfoCustomData hash; QVariantMap hash;
hash["XMPPBotSendToJID"] = originatingJid; hash["XMPPBotSendToJID"] = originatingJid;
InfoSystem::instance()->getInfo(s_botInfoIdentifier, infoMap, hash); InfoSystem::instance()->getInfo(s_botInfoIdentifier, infoMap, hash);
} }
void XMPPBot::infoReturnedSlot(QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomData customData) void XMPPBot::infoReturnedSlot(QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, QVariantMap customData)
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
@@ -363,13 +363,13 @@ void XMPPBot::infoReturnedSlot(QString caller, Tomahawk::InfoSystem::InfoType ty
{ {
qDebug() << "Lyrics requested"; qDebug() << "Lyrics requested";
if (!output.canConvert<QString>() || if (!output.canConvert<QString>() ||
!input.canConvert<Tomahawk::InfoSystem::InfoCustomData>() !input.canConvert<QVariantMap>()
) )
{ {
qDebug() << "Variants failed to be valid"; qDebug() << "Variants failed to be valid";
break; break;
} }
InfoCustomData inHash = input.value<InfoCustomData>(); QVariantMap inHash = input.value<QVariantMap>();
QString artist = inHash["artistName"].toString(); QString artist = inHash["artistName"].toString();
QString track = inHash["trackName"].toString(); QString track = inHash["trackName"].toString();
QString lyrics = output.toString(); QString lyrics = output.toString();

View File

@@ -66,7 +66,7 @@ public:
public slots: public slots:
virtual void newTrackSlot(const Tomahawk::result_ptr &track); virtual void newTrackSlot(const Tomahawk::result_ptr &track);
virtual void infoReturnedSlot(QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomData customData); virtual void infoReturnedSlot(QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, QVariantMap customData);
virtual void infoFinishedSlot(QString caller); virtual void infoFinishedSlot(QString caller);
protected: protected: