本文整理汇总了C++中tomahawk::query_ptr::results方法的典型用法代码示例。如果您正苦于以下问题:C++ query_ptr::results方法的具体用法?C++ query_ptr::results怎么用?C++ query_ptr::results使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tomahawk::query_ptr
的用法示例。
在下文中一共展示了query_ptr::results方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ErrorStatusMessage
void
AudioEngine::playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk::query_ptr& query )
{
if ( query->resolvingFinished() )
{
if ( query->numResults() && query->results().first()->isOnline() )
{
playItem( playlist, query->results().first() );
return;
}
JobStatusView::instance()->model()->addJob(
new ErrorStatusMessage( tr( "Sorry, Tomahawk couldn't find the track '%1' by %2" ).arg( query->track() ).arg( query->artist() ), 15 ) );
if ( isStopped() )
emit stopped(); // we do this so the original caller knows we couldn't find this track
}
else
{
Pipeline::instance()->resolve( query );
NewClosure( query.data(), SIGNAL( resolvingFinished( bool ) ),
const_cast<AudioEngine*>(this), SLOT( playItem( Tomahawk::playlistinterface_ptr, Tomahawk::query_ptr ) ), playlist, query );
}
}
示例2: disconnect
void
ColumnViewPreviewWidget::setQuery( const Tomahawk::query_ptr& query )
{
if ( !m_query.isNull() )
{
disconnect( m_query->track().data(), SIGNAL( updated() ), this, SLOT( onCoverUpdated() ) );
}
m_query = query;
connect( m_query->track().data(), SIGNAL( updated() ), SLOT( onCoverUpdated() ) );
onCoverUpdated();
m_cover->setQuery( query );
setVisible( true );
m_trackLabel->setText( query->track()->track() );
m_artistLabel->setArtist( query->track()->artistPtr() );
m_artistLabel->setMinimumWidth( qMin( m_artistLabel->fontMetrics().width( query->track()->artist() ) +
m_artistLabel->contentsMargins().left() +
m_artistLabel->contentsMargins().right() +
2 * m_artistLabel->lineWidth(),
width() ) );
m_artistLabel->setElideMode( Qt::ElideRight );
m_composerValue->setText( query->track()->composer() );
m_composerValue->setVisible( !query->track()->composerPtr().isNull() );
m_composerLabel->setVisible( !query->track()->composerPtr().isNull() );
if ( query->numResults() )
{
m_yearValue->setText( QString::number( query->track()->year() ) );
m_bitrateValue->setText( tr( "%1 kbps" ).arg( query->results().first()->bitrate() ) );
m_durationValue->setText( TomahawkUtils::timeToString( query->track()->duration() ) );
m_ageValue->setText( TomahawkUtils::ageToString( QDateTime::fromTime_t( query->results().first()->modificationTime() ) ) );
m_yearValue->setVisible( query->track()->year() > 0 );
m_yearLabel->setVisible( query->track()->year() > 0 );
m_bitrateLabel->setVisible( query->results().first()->bitrate() > 0 );
m_bitrateValue->setVisible( query->results().first()->bitrate() > 0 );
m_durationLabel->setVisible( query->track()->duration() > 0 );
m_durationValue->setVisible( query->track()->duration() > 0 );
m_ageLabel->setVisible( query->results().first()->modificationTime() > 0 );
m_ageValue->setVisible( query->results().first()->modificationTime() > 0 );
}
else
{
m_yearLabel->setVisible( false );
m_yearValue->setVisible( false );
m_bitrateLabel->setVisible( false );
m_bitrateValue->setVisible( false );
m_durationLabel->setVisible( false );
m_durationValue->setVisible( false );
m_ageLabel->setVisible( false );
m_ageValue->setVisible( false );
}
setMinimumHeight( sizeHint().height() );
}
示例3: result_ptr
Tomahawk::result_ptr
PlaylistInterface::siblingResult( int itemsAway, qint64 rootIndex ) const
{
qint64 idx = siblingIndex( itemsAway, rootIndex );
QList< qint64 > safetyCheck;
// If safetyCheck contains idx, this means the interface keeps returning the same items and we won't discover anything new - abort
// This can happen in repeat / random mode e.g.
while ( idx >= 0 && !safetyCheck.contains( idx ) )
{
safetyCheck << idx;
Tomahawk::query_ptr query = queryAt( idx );
if ( query && query->playable() )
{
return query->results().first();
}
idx = siblingIndex( itemsAway < 0 ? -1 : 1, idx );
}
return Tomahawk::result_ptr();
}
示例4: loadResult
void
MetadataEditor::loadQuery( const Tomahawk::query_ptr& query )
{
if ( query.isNull() )
return;
if ( query->numResults() )
{
loadResult( query->results().first() );
return;
}
m_result = Tomahawk::result_ptr();
m_query = query;
setEditable( false );
setTitle( query->track()->track() );
setArtist( query->track()->artist() );
setAlbum( query->track()->album() );
setAlbumPos( query->track()->albumpos() );
setDuration( query->track()->duration() );
setYear( 0 );
setBitrate( 0 );
setFileName( QString() );
setFileSize( 0 );
setWindowTitle( query->track()->track() );
if ( m_interface )
{
m_index = m_interface->indexOfQuery( query );
if ( m_index >= 0 )
enablePushButtons();
}
}
示例5: localeAwareCompare
bool
PlayableProxyModel::lessThan( int column, const Tomahawk::query_ptr& q1, const Tomahawk::query_ptr& q2 ) const
{
// Attention: This function may be called very often!
// So be aware of its performance.
const Tomahawk::track_ptr& t1 = q1->track();
const Tomahawk::track_ptr& t2 = q2->track();
const QString& artist1 = t1->artistSortname();
const QString& artist2 = t2->artistSortname();
const QString& album1 = t1->albumSortname();
const QString& album2 = t2->albumSortname();
const unsigned int albumpos1 = t1->albumpos();
const unsigned int albumpos2 = t2->albumpos();
const unsigned int discnumber1 = t1->discnumber();
const unsigned int discnumber2 = t2->discnumber();
const qint64 id1 = (qint64)&q1;
const qint64 id2 = (qint64)&q2;
if ( column == PlayableModel::Artist ) // sort by artist
{
if ( artist1 == artist2 )
{
if ( album1 == album2 )
{
if ( discnumber1 == discnumber2 )
{
if ( albumpos1 == albumpos2 )
return id1 < id2;
return albumpos1 < albumpos2;
}
return discnumber1 < discnumber2;
}
return QString::localeAwareCompare( album1, album2 ) < 0;
}
return QString::localeAwareCompare( artist1, artist2 ) < 0;
}
// Sort by Composer
const QString& composer1 = t1->composerSortname();
const QString& composer2 = t2->composerSortname();
if ( column == PlayableModel::Composer )
{
if ( composer1 == composer2 )
{
if ( album1 == album2 )
{
if ( discnumber1 == discnumber2 )
{
if ( albumpos1 == albumpos2 )
return id1 < id2;
return albumpos1 < albumpos2;
}
return discnumber1 < discnumber2;
}
return QString::localeAwareCompare( album1, album2 ) < 0;
}
return QString::localeAwareCompare( composer1, composer2 ) < 0;
}
// Sort by Album
if ( column == PlayableModel::Album ) // sort by album
{
if ( album1 == album2 )
{
if ( discnumber1 == discnumber2 )
{
if ( albumpos1 == albumpos2 )
return id1 < id2;
return albumpos1 < albumpos2;
}
return discnumber1 < discnumber2;
}
return QString::localeAwareCompare( album1, album2 ) < 0;
}
// Lazy load these variables, they are not used before.
unsigned int bitrate1 = 0, bitrate2 = 0;
unsigned int mtime1 = 0, mtime2 = 0;
unsigned int size1 = 0, size2 = 0;
unsigned int year1 = 0, year2 = 0;
float score1 = 0, score2 = 0;
QString origin1;
QString origin2;
if ( !q1->results().isEmpty() )
{
Tomahawk::result_ptr r = q1->results().first();
bitrate1 = r->bitrate();
mtime1 = r->modificationTime();
size1 = r->size();
//.........这里部分代码省略.........