本文整理汇总了C++中meta::TrackPtr::album方法的典型用法代码示例。如果您正苦于以下问题:C++ TrackPtr::album方法的具体用法?C++ TrackPtr::album怎么用?C++ TrackPtr::album使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类meta::TrackPtr
的用法示例。
在下文中一共展示了TrackPtr::album方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: foreach
bool
ProxyBase::rowMatch( int sourceModelRow, const QString &searchTerms, int searchFields ) const
{
if ( !m_belowModel )
return false;
Meta::TrackPtr track = m_belowModel->trackAt( sourceModelRow );
QStringList searchList = searchTerms.split(" ", QString::SkipEmptyParts);
foreach( const QString& searchTerm, searchList )
{
bool match = false;
if ( searchFields & MatchTrack &&
track->prettyName().contains( searchTerm, Qt::CaseInsensitive )
)
match = true;
if ( searchFields & MatchArtist &&
track->artist() &&
track->artist()->prettyName().contains( searchTerm, Qt::CaseInsensitive )
)
match = true;
if ( searchFields & MatchAlbum &&
track->album() &&
track->album()->prettyName().contains( searchTerm, Qt::CaseInsensitive )
)
match = true;
if ( searchFields & MatchGenre &&
track->genre() &&
track->genre()->prettyName().contains( searchTerm, Qt::CaseInsensitive )
)
match = true;
if ( searchFields & MatchComposer &&
track->composer() &&
track->composer()->prettyName().contains( searchTerm, Qt::CaseInsensitive )
)
match = true;
if ( searchFields & MatchYear &&
track->year() &&
track->year()->prettyName().contains( searchTerm, Qt::CaseInsensitive )
)
match = true;
if( searchFields & MatchRating )
{
bool ok;
int rating = QString( searchTerm ).remove( "rating:" ).toInt( &ok );
if( ok && ( track->statistics()->rating() == rating ) )
match = true;
}
if( !match )
return false;
}
示例2: getInfo
void LastfmInfoParser::getInfo(Meta::TrackPtr track)
{
DEBUG_BLOCK
QMap<QString, QString> query;
query[ "method" ] = "track.getInfo";
query[ "track" ] = track->name();
query[ "album" ] = track->album() ? track->album()->name() : QString();
query[ "artist" ] = track->artist() ? track->artist()->name() : QString();
query[ "apikey" ] = Amarok::lastfmApiKey();
m_jobs[ "getTrackInfo" ] = lastfm::ws::post( query );
connect( m_jobs[ "getTrackInfo" ], SIGNAL( finished() ), SLOT( onGetTrackInfo() ) );
}
示例3: sameTrack
bool
Dynamic::AlbumPlayBias::trackMatches( int position,
const Meta::TrackList& playlist,
int contextCount ) const
{
Q_UNUSED( contextCount );
if( position <= 0 || playlist.count() <= position )
return true;
Meta::TrackPtr track = playlist[position-1];
Meta::AlbumPtr album = track->album();
Meta::TrackPtr currentTrack = playlist[position];
Meta::AlbumPtr currentAlbum = currentTrack->album();
if( !album || album->tracks().isEmpty() )
return false;
Meta::TrackList albumTracks = album->tracks();
if( sameTrack( track, albumTracks.last() ) && m_follow != DontCare )
return false;
// we assume that the album tracks are sorted by cd and track number which
// is at least true for the SqlCollection
if( m_follow == DirectlyFollow )
{
for( int i = 1; i < albumTracks.count(); i++ )
if( sameTrack( albumTracks[i-1], track ) )
return sameTrack( albumTracks[i], currentTrack );
return false;
}
else if( m_follow == Follow )
{
bool found = false;
for( int i = 0; i < albumTracks.count(); i++ )
{
if( found && sameTrack( albumTracks[i], currentTrack ) )
return true;
if( sameTrack( albumTracks[i], track ) )
found = true;
}
return false;
}
else if( m_follow == DontCare )
{
return album == currentAlbum;
}
return false;
}
示例4: connect
void
IpodCopyTracksJob::slotStartDuplicateTrackSearch( const Meta::TrackPtr &track )
{
Collections::QueryMaker *qm = m_coll.data()->queryMaker();
qm->setQueryType( Collections::QueryMaker::Track );
// we cannot qm->addMatch( track ) - it matches by uidUrl()
qm->addFilter( Meta::valTitle, track->name(), true, true );
qm->addMatch( track->album() );
qm->setArtistQueryMode( Collections::QueryMaker::TrackArtists );
qm->addMatch( track->artist() );
qm->addMatch( track->composer() );
qm->addMatch( track->genre() );
qm->addMatch( track->year() );
qm->addNumberFilter( Meta::valTrackNr, track->trackNumber(), Collections::QueryMaker::Equals );
qm->addNumberFilter( Meta::valDiscNr, track->discNumber(), Collections::QueryMaker::Equals );
// we don't want to match by filesize, track length, filetype etc - these change during
// transcoding. We don't match album artist because handling of it is inconsistent
connect( qm, SIGNAL(newResultReady(Meta::TrackList)),
SLOT(slotDuplicateTrackSearchNewResult(Meta::TrackList)) );
connect( qm, SIGNAL(queryDone()), SLOT(slotDuplicateTrackSearchQueryDone()) );
qm->setAutoDelete( true );
m_duplicateTrack = Meta::TrackPtr(); // reset duplicate track from previous query
qm->run();
}
示例5: update
void
CurrentEngine::trackPlaying( Meta::TrackPtr track )
{
DEBUG_BLOCK
m_lastQueryMaker = 0;
if( m_requested.value( QLatin1String("current") ) )
update( track );
if( track && m_requested.value( QLatin1String("albums") ) )
update( track->album() );
}
示例6: TrackSet
Dynamic::TrackSet
Dynamic::AlbumPlayBias::matchingTracks( const Meta::TrackList& playlist,
int contextCount, int finalCount,
Dynamic::TrackCollectionPtr universe ) const
{
Q_UNUSED( contextCount );
Q_UNUSED( finalCount );
if( playlist.isEmpty() ) // no track means we can't find any tracks in the same album
return Dynamic::TrackSet( universe, false );
Meta::TrackPtr track = playlist.last();
Meta::AlbumPtr album = track->album();
if( !album ) // no album means we can't find any tracks in the same album
return Dynamic::TrackSet( universe, false );
Meta::TrackList albumTracks = album->tracks();
if( ( albumTracks.count() <= 1 ) || // the album has only one track (or even less) so there can't be any other tracks in the same album
( m_follow != DontCare && sameTrack( track, albumTracks.last() ) ) ) // track is the last one and we want to find a later one.
return Dynamic::TrackSet( universe, false );
// we assume that the album tracks are sorted by cd and track number which
// is at least true for the SqlCollection
TrackSet result( universe, false );
if( m_follow == DirectlyFollow )
{
for( int i = 1; i < albumTracks.count(); i++ )
if( sameTrack( albumTracks[i-1], track ) )
result.unite( albumTracks[i] );
}
else if( m_follow == Follow )
{
bool found = false;
for( int i = 0; i < albumTracks.count(); i++ )
{
if( found )
result.unite( albumTracks[i] );
if( sameTrack( albumTracks[i], track ) )
found = true;
}
}
else if( m_follow == DontCare )
{
for( int i = 0; i < albumTracks.count(); i++ )
{
if( !sameTrack( albumTracks[i], track ) )
result.unite( albumTracks[i] );
}
}
return result;
}
示例7: if
bool
Dynamic::QuizPlayBias::trackMatches( int position,
const Meta::TrackList& playlist,
int contextCount ) const
{
Q_UNUSED( contextCount );
if( position <= 0 || position >= playlist.count())
return true;
// -- determine the last character we need to quiz
Meta::TrackPtr lastTrack = playlist[position-1];
Meta::DataPtr lastData;
if( m_follow == TitleToTitle )
lastData = Meta::DataPtr::staticCast<Meta::Track>(lastTrack);
else if( m_follow == ArtistToArtist )
lastData = Meta::DataPtr::staticCast<Meta::Artist>(lastTrack->artist());
else if( m_follow == AlbumToAlbum )
lastData = Meta::DataPtr::staticCast<Meta::Album>(lastTrack->album());
if( !lastData || lastData->name().isEmpty() )
return true;
// -- determine the first character
Meta::TrackPtr track = playlist[position];
Meta::DataPtr data;
if( m_follow == TitleToTitle )
data = Meta::DataPtr::staticCast<Meta::Track>(track);
else if( m_follow == ArtistToArtist )
data = Meta::DataPtr::staticCast<Meta::Artist>(track->artist());
else if( m_follow == AlbumToAlbum )
data = Meta::DataPtr::staticCast<Meta::Album>(track->album());
if( !data || data->name().isEmpty() )
return false;
// -- now compare
QString lastName = lastData->name();
QString name = data->name();
return lastChar( lastName ).toLower() == name[0].toLower();
}
示例8: setAlignment
void
Amarok::OSD::show( Meta::TrackPtr track ) //slot
{
setAlignment( static_cast<OSDWidget::Alignment>( AmarokConfig::osdAlignment() ) );
setOffset( AmarokConfig::osdYOffset() );
QString text;
if( !track || track->playableUrl().isEmpty() )
{
text = i18n( "No track playing" );
setRating( 0 ); // otherwise stars from last rating change are visible
}
else
{
setRating( track->rating() );
text = track->prettyName();
if( track->artist() && !track->artist()->prettyName().isEmpty() )
text = track->artist()->prettyName() + " - " + text;
if( track->album() && !track->album()->prettyName().isEmpty() )
text += "\n (" + track->album()->prettyName() + ") ";
else
text += '\n';
if( track->length() > 0 )
text += Meta::msToPrettyTime( track->length() );
}
if( text.isEmpty() )
text = track->playableUrl().fileName();
if( text.startsWith( "- " ) ) //When we only have a title tag, _something_ prepends a fucking hyphen. Remove that.
text = text.mid( 2 );
if( text.isEmpty() ) //still
text = i18n("No information available for this track");
QImage image;
if( track && track->album() )
image = The::svgHandler()->imageWithBorder( track->album(), 100, 5 ).toImage();
OSDWidget::show( text, image );
}
示例9: setData
void
CurrentEngine::metadataChanged( Meta::TrackPtr track )
{
QVariantMap trackInfo = Meta::Field::mapFromTrack( track );
if( m_trackInfo != trackInfo )
{
m_trackInfo = trackInfo;
setData( "current", "current", trackInfo );
if( track && m_requested.value( QLatin1String("albums") ) )
update( track->album() );
}
}
示例10: TrackSet
Dynamic::TrackSet
Dynamic::AlbumPlayBias::matchingTracks( int position,
const Meta::TrackList& playlist, int contextCount,
Dynamic::TrackCollectionPtr universe ) const
{
Q_UNUSED( contextCount );
if( position < 1 || position >= playlist.count() )
return Dynamic::TrackSet( universe, false );
Meta::TrackPtr track = playlist[position-1];
Meta::AlbumPtr album = track->album();
if( !album )
return Dynamic::TrackSet( universe, false );
Meta::TrackList albumTracks = album->tracks();
if( albumTracks.count() == 1 ||
(track == albumTracks.last() && m_follow != DontCare) )
return Dynamic::TrackSet( universe, false );
// we assume that the album tracks are sorted by cd and track number which
// is at least true for the SqlCollection
TrackSet result( universe, false );
if( m_follow == DirectlyFollow )
{
for( int i = 1; i < albumTracks.count(); i++ )
if( albumTracks[i-1] == track )
result.unite( albumTracks[i] );
}
else if( m_follow == Follow )
{
bool found = false;
for( int i = 0; i < albumTracks.count(); i++ )
{
if( found )
result.unite( albumTracks[i] );
if( albumTracks[i] == track )
found = true;
}
}
else if( m_follow == DontCare )
{
for( int i = 0; i < albumTracks.count(); i++ )
{
if( albumTracks[i] != track )
result.unite( albumTracks[i] );
}
}
return result;
}
示例11: switch
Playlist::PlaylistLayout::Part
Playlist::PlaylistLayout::partForItem( const QModelIndex &index ) const
{
switch ( index.data( GroupRole ).toInt() )
{
case Grouping::Head: // GroupMode
case Grouping::Body:
case Grouping::Tail:
{
Meta::TrackPtr track = index.data( TrackRole ).value<Meta::TrackPtr>();
if( !track->artist() || !track->album() || !track->album()->albumArtist() || ( track->artist()->name() != track->album()->albumArtist()->name() ) )
return VariousArtistsBody;
else
return StandardBody;
}
case Grouping::None:
default:
return Single;
}
}
示例12:
void
CurrentTrack::coverDropped( const QPixmap &cover )
{
DEBUG_BLOCK
Meta::TrackPtr track = The::engineController()->currentTrack();
if( !track )
return;
Meta::AlbumPtr album = track->album();
if( !album )
return;
if ( !cover.isNull() )
album->setImage( cover.toImage() );
}
示例13: if
bool
CurrentEngine::sourceRequestEvent( const QString& name )
{
Meta::TrackPtr track = The::engineController()->currentTrack();
m_requested[ name ] = true;
if( !track )
stopped();
if( name == QLatin1String("current") )
update( track );
else if( name == QLatin1String("albums") )
track ? update(track->album()) : setData(name, Plasma::DataEngine::Data());
else
return false;
return true;
}
示例14: TrackSet
Dynamic::TrackSet
Dynamic::QuizPlayBias::matchingTracks( int position,
const Meta::TrackList& playlist, int contextCount,
Dynamic::TrackCollectionPtr universe ) const
{
Q_UNUSED( contextCount );
if( position <= 0 || position > playlist.count())
return Dynamic::TrackSet( universe, true );
// determine the last character we need to quiz
Meta::TrackPtr lastTrack = playlist[position-1];
Meta::DataPtr lastData;
if( m_follow == TitleToTitle )
lastData = Meta::DataPtr::staticCast<Meta::Track>(lastTrack);
else if( m_follow == ArtistToArtist )
lastData = Meta::DataPtr::staticCast<Meta::Artist>(lastTrack->artist());
else if( m_follow == AlbumToAlbum )
lastData = Meta::DataPtr::staticCast<Meta::Album>(lastTrack->album());
if( !lastData || lastData->name().isEmpty() )
{
// debug() << "QuizPlay: no data for"<<lastTrack->name();
return Dynamic::TrackSet( universe, true );
}
m_currentCharacter = lastChar(lastData->name()).toLower();
// debug() << "QuizPlay: data for"<<lastTrack->name()<<"is"<<m_currentCharacter;
// -- look if we already buffered it
if( m_tracksValid && m_characterTrackMap.contains( m_currentCharacter ) )
return m_characterTrackMap.value( m_currentCharacter );
// -- start a new query
m_tracks = Dynamic::TrackSet( universe, false );
QTimer::singleShot(0,
const_cast<QuizPlayBias*>(this),
SLOT(newQuery())); // create the new query from my parent thread
return Dynamic::TrackSet();
}
示例15: if
void
ScrobblerAdapter::copyTrackMetadata( lastfm::MutableTrack &to, const Meta::TrackPtr &track )
{
to.setTitle( track->name() );
QString artistOrComposer;
Meta::ComposerPtr composer = track->composer();
if( m_config->scrobbleComposer() && composer )
artistOrComposer = composer->name();
Meta::ArtistPtr artist = track->artist();
if( artistOrComposer.isEmpty() && artist )
artistOrComposer = artist->name();
to.setArtist( artistOrComposer );
Meta::AlbumPtr album = track->album();
Meta::ArtistPtr albumArtist;
if( album )
{
to.setAlbum( album->name() );
albumArtist = album->hasAlbumArtist() ? album->albumArtist() : Meta::ArtistPtr();
}
if( albumArtist )
to.setAlbumArtist( albumArtist->name() );
to.setDuration( track->length() / 1000 );
if( track->trackNumber() >= 0 )
to.setTrackNumber( track->trackNumber() );
lastfm::Track::Source source = lastfm::Track::Player;
if( track->type() == "stream/lastfm" )
source = lastfm::Track::LastFmRadio;
else if( track->type().startsWith( "stream" ) )
source = lastfm::Track::NonPersonalisedBroadcast;
else if( track->collection() && track->collection()->collectionId() != "localCollection" )
source = lastfm::Track::MediaDevice;
to.setSource( source );
}