mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-17 11:30:49 +02:00
Switch some calls from InfoCustomData to InfoCriteriaHash, much simplifying
This commit is contained in:
@@ -213,13 +213,13 @@ AudioControls::onPlaybackStarted( const Tomahawk::result_ptr& result )
|
|||||||
|
|
||||||
onPlaybackLoading( result );
|
onPlaybackLoading( result );
|
||||||
|
|
||||||
Tomahawk::InfoSystem::InfoCustomData trackInfo;
|
Tomahawk::InfoSystem::InfoCriteriaHash trackInfo;
|
||||||
trackInfo["artist"] = QVariant::fromValue< QString >( result->artist()->name() );
|
trackInfo["artist"] = result->artist()->name();
|
||||||
trackInfo["album"] = QVariant::fromValue< QString >( result->album()->name() );
|
trackInfo["album"] = result->album()->name();
|
||||||
|
|
||||||
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo(
|
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo(
|
||||||
s_acInfoIdentifier, Tomahawk::InfoSystem::InfoAlbumCoverArt,
|
s_acInfoIdentifier, Tomahawk::InfoSystem::InfoAlbumCoverArt,
|
||||||
QVariant::fromValue< Tomahawk::InfoSystem::InfoCustomData >( trackInfo ), Tomahawk::InfoSystem::InfoCustomData() );
|
QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( trackInfo ), Tomahawk::InfoSystem::InfoCustomData() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -134,12 +134,12 @@ LastFmPlugin::getInfo( const QString &caller, const InfoType type, const QVarian
|
|||||||
void
|
void
|
||||||
LastFmPlugin::nowPlaying( const QString &caller, const InfoType type, const QVariant& data, Tomahawk::InfoSystem::InfoCustomData &customData )
|
LastFmPlugin::nowPlaying( const QString &caller, const InfoType type, const QVariant& data, Tomahawk::InfoSystem::InfoCustomData &customData )
|
||||||
{
|
{
|
||||||
if ( !data.canConvert< Tomahawk::InfoSystem::InfoCustomData >() || !m_scrobbler )
|
if ( !data.canConvert< Tomahawk::InfoSystem::InfoCriteriaHash >() || !m_scrobbler )
|
||||||
{
|
{
|
||||||
dataError( caller, type, data, customData );
|
dataError( caller, type, data, customData );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
InfoCustomData hash = data.value< Tomahawk::InfoSystem::InfoCustomData >();
|
InfoCriteriaHash hash = data.value< Tomahawk::InfoSystem::InfoCriteriaHash >();
|
||||||
if ( !hash.contains( "title" ) || !hash.contains( "artist" ) || !hash.contains( "album" ) || !hash.contains( "duration" ) )
|
if ( !hash.contains( "title" ) || !hash.contains( "artist" ) || !hash.contains( "album" ) || !hash.contains( "duration" ) )
|
||||||
{
|
{
|
||||||
dataError( caller, type, data, customData );
|
dataError( caller, type, data, customData );
|
||||||
@@ -149,10 +149,11 @@ LastFmPlugin::nowPlaying( const QString &caller, const InfoType type, const QVar
|
|||||||
m_track = lastfm::MutableTrack();
|
m_track = lastfm::MutableTrack();
|
||||||
m_track.stamp();
|
m_track.stamp();
|
||||||
|
|
||||||
m_track.setTitle( hash["title"].toString() );
|
m_track.setTitle( hash["title"] );
|
||||||
m_track.setArtist( hash["artist"].toString() );
|
m_track.setArtist( hash["artist"] );
|
||||||
m_track.setAlbum( hash["album"].toString() );
|
m_track.setAlbum( hash["album"] );
|
||||||
m_track.setDuration( hash["duration"].toUInt() );
|
bool ok;
|
||||||
|
m_track.setDuration( hash["duration"].toUInt( &ok ) );
|
||||||
m_track.setSource( lastfm::Track::Player );
|
m_track.setSource( lastfm::Track::Player );
|
||||||
|
|
||||||
m_scrobbler->nowPlaying( m_track );
|
m_scrobbler->nowPlaying( m_track );
|
||||||
@@ -183,12 +184,12 @@ void
|
|||||||
LastFmPlugin::fetchCoverArt( const QString &caller, const InfoType type, const QVariant& data, Tomahawk::InfoSystem::InfoCustomData &customData )
|
LastFmPlugin::fetchCoverArt( const QString &caller, const InfoType type, const QVariant& data, Tomahawk::InfoSystem::InfoCustomData &customData )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
if ( !data.canConvert< Tomahawk::InfoSystem::InfoCustomData >() )
|
if ( !data.canConvert< Tomahawk::InfoSystem::InfoCriteriaHash >() )
|
||||||
{
|
{
|
||||||
dataError( caller, type, data, customData );
|
dataError( caller, type, data, customData );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
InfoCustomData hash = data.value< Tomahawk::InfoSystem::InfoCustomData >();
|
InfoCriteriaHash hash = data.value< Tomahawk::InfoSystem::InfoCriteriaHash >();
|
||||||
if ( !hash.contains( "artist" ) || !hash.contains( "album" ) )
|
if ( !hash.contains( "artist" ) || !hash.contains( "album" ) )
|
||||||
{
|
{
|
||||||
dataError( caller, type, data, customData );
|
dataError( caller, type, data, customData );
|
||||||
@@ -196,8 +197,8 @@ LastFmPlugin::fetchCoverArt( const QString &caller, const InfoType type, const Q
|
|||||||
}
|
}
|
||||||
|
|
||||||
Tomahawk::InfoSystem::InfoCriteriaHash criteria;
|
Tomahawk::InfoSystem::InfoCriteriaHash criteria;
|
||||||
criteria["artist"] = hash["artist"].toString();
|
criteria["artist"] = hash["artist"];
|
||||||
criteria["album"] = hash["album"].toString();
|
criteria["album"] = hash["album"];
|
||||||
|
|
||||||
emit getCachedInfo( criteria, 2419200000, caller, type, data, customData );
|
emit getCachedInfo( criteria, 2419200000, caller, type, data, customData );
|
||||||
}
|
}
|
||||||
@@ -207,12 +208,12 @@ void
|
|||||||
LastFmPlugin::fetchArtistImages( const QString &caller, const InfoType type, const QVariant& data, Tomahawk::InfoSystem::InfoCustomData &customData )
|
LastFmPlugin::fetchArtistImages( const QString &caller, const InfoType type, const QVariant& data, Tomahawk::InfoSystem::InfoCustomData &customData )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
if ( !data.canConvert< Tomahawk::InfoSystem::InfoCustomData >() )
|
if ( !data.canConvert< Tomahawk::InfoSystem::InfoCriteriaHash >() )
|
||||||
{
|
{
|
||||||
dataError( caller, type, data, customData );
|
dataError( caller, type, data, customData );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
InfoCustomData hash = data.value< Tomahawk::InfoSystem::InfoCustomData >();
|
InfoCriteriaHash hash = data.value< Tomahawk::InfoSystem::InfoCriteriaHash >();
|
||||||
if ( !hash.contains( "artist" ) )
|
if ( !hash.contains( "artist" ) )
|
||||||
{
|
{
|
||||||
dataError( caller, type, data, customData );
|
dataError( caller, type, data, customData );
|
||||||
@@ -220,7 +221,7 @@ LastFmPlugin::fetchArtistImages( const QString &caller, const InfoType type, con
|
|||||||
}
|
}
|
||||||
|
|
||||||
Tomahawk::InfoSystem::InfoCriteriaHash criteria;
|
Tomahawk::InfoSystem::InfoCriteriaHash criteria;
|
||||||
criteria["artist"] = hash["artist"].toString();
|
criteria["artist"] = hash["artist"];
|
||||||
|
|
||||||
emit getCachedInfo( criteria, 2419200000, caller, type, data, customData );
|
emit getCachedInfo( criteria, 2419200000, caller, type, data, customData );
|
||||||
}
|
}
|
||||||
@@ -301,10 +302,10 @@ LastFmPlugin::coverArtReturned()
|
|||||||
customData
|
customData
|
||||||
);
|
);
|
||||||
|
|
||||||
InfoCustomData origData = reply->property( "origData" ).value< Tomahawk::InfoSystem::InfoCustomData >();
|
InfoCriteriaHash origData = reply->property( "origData" ).value< Tomahawk::InfoSystem::InfoCriteriaHash >();
|
||||||
Tomahawk::InfoSystem::InfoCriteriaHash criteria;
|
Tomahawk::InfoSystem::InfoCriteriaHash criteria;
|
||||||
criteria["artist"] = origData["artist"].toString();
|
criteria["artist"] = origData["artist"];
|
||||||
criteria["album"] = origData["album"].toString();
|
criteria["album"] = origData["album"];
|
||||||
emit updateCache( criteria, 2419200000, type, returnedData );
|
emit updateCache( criteria, 2419200000, type, returnedData );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -352,9 +353,9 @@ LastFmPlugin::artistImagesReturned()
|
|||||||
customData
|
customData
|
||||||
);
|
);
|
||||||
|
|
||||||
InfoCustomData origData = reply->property( "origData" ).value< Tomahawk::InfoSystem::InfoCustomData >();
|
InfoCriteriaHash origData = reply->property( "origData" ).value< Tomahawk::InfoSystem::InfoCriteriaHash >();
|
||||||
Tomahawk::InfoSystem::InfoCriteriaHash criteria;
|
Tomahawk::InfoSystem::InfoCriteriaHash criteria;
|
||||||
criteria["artist"] = origData["artist"].toString();
|
criteria["artist"] = origData["artist"];
|
||||||
emit updateCache( criteria, 2419200000, type, returnedData );
|
emit updateCache( criteria, 2419200000, type, returnedData );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -223,12 +223,12 @@ ArtistView::onScrollTimeout()
|
|||||||
{
|
{
|
||||||
TreeModelItem* item = m_model->itemFromIndex( m_proxyModel->mapToSource( m_proxyModel->index( i, 0 ) ) );
|
TreeModelItem* item = m_model->itemFromIndex( m_proxyModel->mapToSource( m_proxyModel->index( i, 0 ) ) );
|
||||||
|
|
||||||
Tomahawk::InfoSystem::InfoCustomData trackInfo;
|
Tomahawk::InfoSystem::InfoCriteriaHash trackInfo;
|
||||||
trackInfo["artist"] = QVariant::fromValue< QString >( item->artist()->name() );
|
trackInfo["artist"] = item->artist()->name();
|
||||||
trackInfo["pptr"] = QVariant::fromValue< qlonglong >( (qlonglong)item );
|
trackInfo["pptr"] = QString::number( (qlonglong)item );
|
||||||
|
|
||||||
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo(
|
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo(
|
||||||
s_tmInfoIdentifier, Tomahawk::InfoSystem::InfoArtistImages,
|
s_tmInfoIdentifier, Tomahawk::InfoSystem::InfoArtistImages,
|
||||||
QVariant::fromValue< Tomahawk::InfoSystem::InfoCustomData >( trackInfo ), Tomahawk::InfoSystem::InfoCustomData() );
|
QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( trackInfo ), Tomahawk::InfoSystem::InfoCustomData() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -476,14 +476,14 @@ TreeModel::onAlbumsAdded( const QList<Tomahawk::album_ptr>& albums, const QVaria
|
|||||||
albumitem->index = createIndex( parentItem->children.count() - 1, 0, albumitem );
|
albumitem->index = createIndex( parentItem->children.count() - 1, 0, albumitem );
|
||||||
connect( albumitem, SIGNAL( dataChanged() ), SLOT( onDataChanged() ) );
|
connect( albumitem, SIGNAL( dataChanged() ), SLOT( onDataChanged() ) );
|
||||||
|
|
||||||
Tomahawk::InfoSystem::InfoCustomData trackInfo;
|
Tomahawk::InfoSystem::InfoCriteriaHash trackInfo;
|
||||||
trackInfo["artist"] = QVariant::fromValue< QString >( album->artist()->name() );
|
trackInfo["artist"] = album->artist()->name();
|
||||||
trackInfo["album"] = QVariant::fromValue< QString >( album->name() );
|
trackInfo["album"] = album->name();
|
||||||
trackInfo["pptr"] = QVariant::fromValue< qlonglong >( (qlonglong)albumitem );
|
trackInfo["pptr"] = QString::number( (qlonglong)albumitem );
|
||||||
|
|
||||||
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo(
|
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo(
|
||||||
s_tmInfoIdentifier, Tomahawk::InfoSystem::InfoAlbumCoverArt,
|
s_tmInfoIdentifier, Tomahawk::InfoSystem::InfoAlbumCoverArt,
|
||||||
QVariant::fromValue< Tomahawk::InfoSystem::InfoCustomData >( trackInfo ), Tomahawk::InfoSystem::InfoCustomData() );
|
QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( trackInfo ), Tomahawk::InfoSystem::InfoCustomData() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( crows.second > 0 )
|
if ( crows.second > 0 )
|
||||||
@@ -555,7 +555,7 @@ TreeModel::infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Tomahawk::InfoSystem::InfoCustomData pptr = input.value< Tomahawk::InfoSystem::InfoCustomData >();
|
Tomahawk::InfoSystem::InfoCriteriaHash pptr = input.value< Tomahawk::InfoSystem::InfoCriteriaHash >();
|
||||||
Tomahawk::InfoSystem::InfoCustomData returnedData = output.value< Tomahawk::InfoSystem::InfoCustomData >();
|
Tomahawk::InfoSystem::InfoCustomData returnedData = output.value< Tomahawk::InfoSystem::InfoCustomData >();
|
||||||
const QByteArray ba = returnedData["imgbytes"].toByteArray();
|
const QByteArray ba = returnedData["imgbytes"].toByteArray();
|
||||||
if ( ba.length() )
|
if ( ba.length() )
|
||||||
@@ -563,7 +563,8 @@ TreeModel::infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type,
|
|||||||
QPixmap pm;
|
QPixmap pm;
|
||||||
pm.loadFromData( ba );
|
pm.loadFromData( ba );
|
||||||
|
|
||||||
qlonglong p = pptr["pptr"].toLongLong();
|
bool ok;
|
||||||
|
qlonglong p = pptr["pptr"].toLongLong( &ok );
|
||||||
TreeModelItem* ai = reinterpret_cast<TreeModelItem*>(p);
|
TreeModelItem* ai = reinterpret_cast<TreeModelItem*>(p);
|
||||||
|
|
||||||
if ( pm.isNull() )
|
if ( pm.isNull() )
|
||||||
|
@@ -74,15 +74,15 @@ Scrobbler::trackStarted( const Tomahawk::result_ptr& track )
|
|||||||
scrobble();
|
scrobble();
|
||||||
}
|
}
|
||||||
|
|
||||||
Tomahawk::InfoSystem::InfoCustomData trackInfo;
|
Tomahawk::InfoSystem::InfoCriteriaHash trackInfo;
|
||||||
|
|
||||||
trackInfo["title"] = QVariant::fromValue< QString >( track->track() );
|
trackInfo["title"] = track->track();
|
||||||
trackInfo["artist"] = QVariant::fromValue< QString >( track->artist()->name() );
|
trackInfo["artist"] = track->artist()->name();
|
||||||
trackInfo["album"] = QVariant::fromValue< QString >( track->album()->name() );
|
trackInfo["album"] = track->album()->name();
|
||||||
trackInfo["duration"] = QVariant::fromValue< uint >( track->duration() );
|
trackInfo["duration"] = QString::number( track->duration() );
|
||||||
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo(
|
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo(
|
||||||
s_scInfoIdentifier, Tomahawk::InfoSystem::InfoMiscSubmitNowPlaying,
|
s_scInfoIdentifier, Tomahawk::InfoSystem::InfoMiscSubmitNowPlaying,
|
||||||
QVariant::fromValue< Tomahawk::InfoSystem::InfoCustomData >( trackInfo ), Tomahawk::InfoSystem::InfoCustomData() );
|
QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( trackInfo ), Tomahawk::InfoSystem::InfoCustomData() );
|
||||||
|
|
||||||
m_scrobblePoint = ScrobblePoint( track->duration() / 2 );
|
m_scrobblePoint = ScrobblePoint( track->duration() / 2 );
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user