本文整理汇总了C++中QueryBuilder::sortBy方法的典型用法代码示例。如果您正苦于以下问题:C++ QueryBuilder::sortBy方法的具体用法?C++ QueryBuilder::sortBy怎么用?C++ QueryBuilder::sortBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryBuilder
的用法示例。
在下文中一共展示了QueryBuilder::sortBy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: values
void K3bExporter::exportAlbum( const QString &artist, const QString &album, int openmode )
{
QString albumId = QString::number( CollectionDB::instance()->albumID( album, false, false, true ) );
QString artistId;
if( !artist.isNull() )
artistId = QString::number( CollectionDB::instance()->artistID( artist, false, false, true ) );
QueryBuilder qb;
qb.addReturnValue( QueryBuilder::tabSong, QueryBuilder::valURL );
qb.addMatch( QueryBuilder::tabSong, QueryBuilder::valAlbumID, albumId );
if( !artist.isNull() )
qb.addMatch( QueryBuilder::tabSong, QueryBuilder::valArtistID, artistId );
qb.sortBy( QueryBuilder::tabSong, QueryBuilder::valDiscNumber );
qb.sortBy( QueryBuilder::tabSong, QueryBuilder::valTrack );
QStringList values( qb.run() );
if( !values.isEmpty() )
{
KURL::List urls;
foreach( values )
urls << KURL( *it );
exportTracks( urls, openmode );
}
}
示例2: statisticsData
const QStringList TagDialog::statisticsData() {
QStringList data, values;
const uint artist_id = CollectionDB::instance()->artistID( m_bundle.artist() );
const uint album_id = CollectionDB::instance()->albumID ( m_bundle.album() );
QueryBuilder qb;
if ( !m_bundle.artist().isEmpty() ) {
// tracks by this artist
qb.clear();
qb.addReturnFunctionValue( QueryBuilder::funcCount, QueryBuilder::tabSong, QueryBuilder::valTitle );
qb.addMatch( QueryBuilder::tabSong, QueryBuilder::valArtistID, QString::number( artist_id ) );
values = qb.run();
data += i18n( "Tracks by this Artist" );
data += values[0];
// albums by this artist
qb.clear();
qb.addReturnFunctionValue( QueryBuilder::funcCount, QueryBuilder::tabAlbum, QueryBuilder::valID );
qb.addMatch( QueryBuilder::tabSong, QueryBuilder::valArtistID, QString::number( artist_id ) );
qb.groupBy( QueryBuilder::tabSong, QueryBuilder::valAlbumID );
qb.excludeMatch( QueryBuilder::tabAlbum, i18n( "Unknown" ) );
qb.setOptions( QueryBuilder::optNoCompilations );
values = qb.run();
data += i18n( "Albums by this Artist" );
data += QString::number( values.count() );
// Favorite track by this artist
qb.clear();
qb.addReturnValue( QueryBuilder::tabSong, QueryBuilder::valTitle );
qb.addReturnValue( QueryBuilder::tabStats, QueryBuilder::valScore );
qb.addMatch( QueryBuilder::tabSong, QueryBuilder::valArtistID, QString::number( artist_id ) );
qb.sortBy( QueryBuilder::tabStats, QueryBuilder::valPercentage, true );
qb.setLimit( 0, 1 );
values = qb.run();
data += i18n( "Favorite by this Artist" );
data += values[0];
if ( !m_bundle.album().isEmpty() ) {
// Favorite track on this album
qb.clear();
qb.addReturnValue( QueryBuilder::tabSong, QueryBuilder::valTitle );
qb.addReturnValue( QueryBuilder::tabStats, QueryBuilder::valScore );
qb.addMatch( QueryBuilder::tabSong, QueryBuilder::valAlbumID, QString::number( album_id ) );
qb.sortBy( QueryBuilder::tabStats, QueryBuilder::valPercentage, true );
qb.setLimit( 0, 1 );
values = qb.run();
data += i18n( "Favorite on this Album" );
data += values[0];
}
// Related Artists
const QString sArtists = CollectionDB::instance()->similarArtists( m_bundle.artist(), 4 ).join(", ");
if ( !sArtists.isEmpty() ) {
data += i18n( "Related Artists" );
data += sArtists;
}
}
return data;
}