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

Return QPointer instead of casting around

This commit is contained in:
Uwe L. Korn
2014-05-22 01:33:58 +01:00
parent 402ade3322
commit f4f37e5dfc
4 changed files with 5 additions and 8 deletions

View File

@@ -97,7 +97,7 @@ Api_v1_5::playback( QxtWebRequestEvent* event, const QString& command )
QVariantMap trackInfo;
trackInfo.insert( "playing", true );
trackInfo.insert( "bitrate", currentTrack->bitrate() );
if ( currentTrack->resolvedBy() != NULL ) {
if ( !currentTrack->resolvedBy().isNull() ) {
QString resolverName = currentTrack->resolvedBy()->name();
trackInfo.insert( "resolvedBy", resolverName );
} else {

View File

@@ -334,7 +334,7 @@ Pipeline::reportResults( QID qid, const QList< result_ptr >& results )
return;
if ( !d->qids.contains( qid ) )
{
if ( results.length() > 0 && results[0]->resolvedBy() != NULL )
if ( results.length() > 0 && !results[0]->resolvedBy().isNull() )
{
tDebug() << "Result arrived too late for:" << qid << "by" << results[0]->resolvedBy()->name();
}

View File

@@ -464,13 +464,10 @@ Result::setFileId( unsigned int id )
}
Tomahawk::Resolver*
QPointer<Tomahawk::Resolver>
Result::resolvedBy() const
{
if ( m_resolvedBy.isNull() )
return 0;
return m_resolvedBy.data();
return m_resolvedBy;
}

View File

@@ -62,7 +62,7 @@ public:
QString toString() const;
Tomahawk::query_ptr toQuery();
Tomahawk::Resolver* resolvedBy() const;
QPointer<Tomahawk::Resolver> resolvedBy() const;
void setResolvedBy( Tomahawk::Resolver* resolver );
float score() const;