本文整理汇总了C++中meta::TrackPtr::labels方法的典型用法代码示例。如果您正苦于以下问题:C++ TrackPtr::labels方法的具体用法?C++ TrackPtr::labels怎么用?C++ TrackPtr::labels使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类meta::TrackPtr
的用法示例。
在下文中一共展示了TrackPtr::labels方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QCOMPARE
void
TestSqlTrack::testRemoveLabelFromTrack()
{
Meta::TrackPtr track = m_collection->registry()->getTrack( "/IDoNotExist.mp3" );
Meta::LabelPtr label = m_collection->registry()->getLabel( "A" );
track->addLabel( label );
QCOMPARE( track->labels().count(), 1 );
track->removeLabel( label );
QCOMPARE( track->labels().count(), 0 );
QStringList urlsLabelsCount = m_storage->query( "SELECT COUNT(*) FROM urls_labels;" );
QCOMPARE( urlsLabelsCount.first().toInt(), 0 );
}
示例2: foreach
bool
LabelFilter::filterMatches( Meta::TrackPtr track ) const
{
foreach( const Meta::LabelPtr &label, track->labels() )
{
if( m_expression.indexIn( label->name() ) != -1 )
return true;
}
return false;
}
示例3: foreach
bool
ScrobblerAdapter::isToBeSkipped( const Meta::TrackPtr &track ) const
{
Q_ASSERT( track );
if( !m_config->filterByLabel() )
return false;
foreach( const Meta::LabelPtr &label, track->labels() )
if( label->name() == m_config->filteredLabel() )
return true;
return false;
}
示例4: labels
void
TestSqlTrack::testRemoveLabelFromTrackWhenNotInCache()
{
m_storage->query( "INSERT INTO labels(id,label) VALUES (1,'A');" );
m_storage->query( "INSERT INTO urls_labels(url,label) VALUES (1,1);" );
Meta::TrackPtr track = m_collection->registry()->getTrack( "/IDoNotExist.mp3" );
Meta::LabelPtr label = m_collection->registry()->getLabel( "A" );
track->removeLabel( label );
QCOMPARE( track->labels().count(), 0 );
QStringList urlsLabelsCount = m_storage->query( "SELECT COUNT(*) FROM urls_labels;" );
QCOMPARE( urlsLabelsCount.first().toInt(), 0 );
}
示例5: valueForField
QVariant Meta::valueForField( qint64 field, Meta::TrackPtr track )
{
if( !track )
return QVariant();
switch( field )
{
case 0:
{
// that is the simple search for MetaQueryWidget
QSet<QString> allInfos;
allInfos += track->playableUrl().path()
+= track->name()
+= track->comment();
if( track->artist() )
allInfos += track->artist()->name();
if( track->album() )
allInfos += track->album()->name();
if( track->genre() )
allInfos += track->genre()->name();
return QVariant( allInfos.toList() );
}
case Meta::valUrl: return track->playableUrl().path();
case Meta::valTitle: return track->name();
case Meta::valArtist: return track->artist() ?
QVariant(track->artist()->name()) : QVariant();
case Meta::valAlbum: return track->album() ?
QVariant(track->album()->name()) : QVariant();
case Meta::valGenre: return track->genre() ?
QVariant(track->genre()->name()) : QVariant();
case Meta::valComposer: return track->composer() ?
QVariant(track->composer()->name()) : QVariant();
case Meta::valYear: return track->year() ?
QVariant(track->year()->name().toInt()) : QVariant();
case Meta::valComment: return track->comment();
case Meta::valTrackNr: return track->trackNumber();
case Meta::valDiscNr: return track->discNumber();
case Meta::valBpm: return track->bpm();
case Meta::valLength: return track->length();
case Meta::valBitrate: return track->bitrate();
case Meta::valSamplerate: return track->sampleRate();
case Meta::valFilesize: return track->filesize();
case Meta::valFormat: return int(Amarok::FileTypeSupport::fileType(track->type()));
case Meta::valCreateDate: return track->createDate();
case Meta::valScore: return track->statistics()->score();
case Meta::valRating: return track->statistics()->rating();
case Meta::valFirstPlayed: return track->statistics()->firstPlayed();
case Meta::valLastPlayed: return track->statistics()->lastPlayed();
case Meta::valPlaycount: return track->statistics()->playCount();
case Meta::valUniqueId: return track->uidUrl();
// todo
case Meta::valTrackGain: return "track gain";
case Meta::valTrackGainPeak: return "track gain peak";
case Meta::valAlbumGain: return "album gain";
case Meta::valAlbumGainPeak: return "album gain peak";
case Meta::valAlbumArtist: return (track->album() && track->album()->albumArtist()) ?
QVariant(track->album()->albumArtist()->name()) : QVariant();
case Meta::valLabel:
{
Meta::LabelList labels = track->labels();
QStringList strLabels;
foreach( Meta::LabelPtr label, labels )
strLabels.append( label->name() );
return QVariant( strLabels );
}
case Meta::valModified: return track->modifyDate();
default: return QVariant();
}
}