本文整理汇总了C++中tomahawk::result_ptr类的典型用法代码示例。如果您正苦于以下问题:C++ result_ptr类的具体用法?C++ result_ptr怎么用?C++ result_ptr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了result_ptr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tDebug
void
AudioEngine::loadPreviousTrack()
{
Q_D( AudioEngine );
tDebug( LOGEXTRA ) << Q_FUNC_INFO;
if ( d->playlist.isNull() )
{
stop();
return;
}
Tomahawk::result_ptr result;
if ( d->playlist.data()->previousResult() )
{
result = d->playlist.data()->setSiblingResult( -1 );
setCurrentTrackPlaylist( d->playlist );
}
if ( !result.isNull() )
loadTrack( result );
else
stop();
}
示例2: disconnect
void
AudioControls::onPlaybackLoading( const Tomahawk::result_ptr& result )
{
if ( !m_currentTrack.isNull() )
{
disconnect( m_currentTrack->album().data(), SIGNAL( updated() ), this, SLOT( onAlbumCoverUpdated() ) );
disconnect( m_currentTrack->toQuery().data(), SIGNAL( socialActionsLoaded() ), this, SLOT( onSocialActionsLoaded() ) );
}
m_currentTrack = result;
connect( m_currentTrack->album().data(), SIGNAL( updated() ), SLOT( onAlbumCoverUpdated() ) );
connect( m_currentTrack->toQuery().data(), SIGNAL( socialActionsLoaded() ), SLOT( onSocialActionsLoaded() ) );
ui->artistTrackLabel->setResult( result );
ui->albumLabel->setResult( result );
ui->ownerLabel->setText( result->friendlySource() );
const QString duration = TomahawkUtils::timeToString( result.data()->duration() );
ui->timeLabel->setFixedWidth( ui->timeLabel->fontMetrics().width( QString( duration.length(), QChar( '0' ) ) ) );
ui->timeLabel->setText( TomahawkUtils::timeToString( 0 ) );
ui->timeLeftLabel->setFixedWidth( ui->timeLeftLabel->fontMetrics().width( QString( duration.length() + 1, QChar( '0' ) ) ) );
ui->timeLeftLabel->setText( "-" + duration );
ui->stackedLayout->setCurrentWidget( ui->pauseButton );
ui->loveButton->setEnabled( true );
ui->loveButton->setVisible( true );
setAlbumCover();
setSocialActions();
}
示例3: tDebug
void
AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
{
Q_D( AudioEngine );
tDebug( LOGEXTRA ) << Q_FUNC_INFO << ( result.isNull() ? QString() : result->url() );
if ( !result )
{
stop();
return;
}
// We do this to stop the audio as soon as a user activated another track
// If we don't block the audioOutput signals, the state change will trigger
// loading yet another track
d->audioOutput->blockSignals( true );
d->audioOutput->stop();
d->audioOutput->blockSignals( false );
setCurrentTrack( result );
if ( !TomahawkUtils::isLocalResult( d->currentTrack->url() ) && !TomahawkUtils::isHttpResult( d->currentTrack->url() )
&& !TomahawkUtils::isRtmpResult( d->currentTrack->url() ) )
{
performLoadIODevice( d->currentTrack, d->currentTrack->url() );
}
else
{
QSharedPointer< QIODevice > io;
performLoadTrack( result, result->url(), io );
}
}
示例4: thread
void
Scrobbler::trackStarted( const Tomahawk::result_ptr& track )
{
Q_ASSERT( QThread::currentThread() == thread() );
// qDebug() << Q_FUNC_INFO;
if( m_reachedScrobblePoint )
{
m_reachedScrobblePoint = false;
scrobble();
}
Tomahawk::InfoSystem::InfoCriteriaHash trackInfo;
trackInfo["title"] = track->track();
trackInfo["artist"] = track->artist()->name();
trackInfo["album"] = track->album()->name();
trackInfo["duration"] = QString::number( track->duration() );
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo(
s_scInfoIdentifier, Tomahawk::InfoSystem::InfoSubmitNowPlaying,
QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( trackInfo ) );
m_scrobblePoint = ScrobblePoint( track->duration() / 2 );
}
示例5: results
void
DatabaseCommand_Resolve::exec( DatabaseImpl* lib )
{
/*
* Resolving is a 2 stage process.
* 1) find list of trk/art/alb IDs that are reasonable matches to the metadata given
* 2) find files in database by permitted sources and calculate score, ignoring
* results that are less than MINSCORE
*/
if ( !m_query->resultHint().isEmpty() )
{
qDebug() << "Using result-hint to speed up resolving:" << m_query->resultHint();
Tomahawk::result_ptr result = lib->resultFromHint( m_query );
if ( !result.isNull() && ( result->collection().isNull() || result->collection()->source()->isOnline() ) )
{
QList<Tomahawk::result_ptr> res;
res << result;
emit results( m_query->id(), res );
return;
}
}
if ( m_query->isFullTextQuery() )
fullTextResolve( lib );
else
resolve( lib );
}
示例6: previousTrackAvailable
void
PlaylistInterface::onItemsChanged()
{
if ( QThread::currentThread() != thread() )
{
QMetaObject::invokeMethod( this, "onItemsChanged", Qt::QueuedConnection );
return;
}
Tomahawk::result_ptr prevResult = siblingResult( -1, m_currentIndex );
Tomahawk::result_ptr nextResult = siblingResult( 1, m_currentIndex );
{
bool avail = prevResult && prevResult->toQuery()->playable();
if ( avail != m_prevAvail )
{
m_prevAvail = avail;
emit previousTrackAvailable( avail );
}
}
{
bool avail = nextResult && nextResult->toQuery()->playable();
if ( avail != m_nextAvail )
{
m_nextAvail = avail;
emit nextTrackAvailable( avail );
}
}
}
示例7: tDebug
void
AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
{
Q_D( AudioEngine );
tDebug( LOGEXTRA ) << Q_FUNC_INFO << ( result.isNull() ? QString() : result->url() );
if ( !result )
{
stop();
return;
}
// We do this to stop the audio as soon as a user activated another track
// If we don't block the audioOutput signals, the state change will trigger
// loading yet another track
d->audioOutput->blockSignals( true );
d->audioOutput->stop();
d->audioOutput->blockSignals( false );
setCurrentTrack( result );
ScriptJob* job = result->resolvedBy()->getStreamUrl( result );
connect( job, SIGNAL( done( QVariantMap ) ), SLOT( gotStreamUrl( QVariantMap ) ) );
job->setProperty( "result", QVariant::fromValue( result ) );
job->start();
}
示例8: onPlaybackLoading
void
AudioControls::onPlaybackStarted( const Tomahawk::result_ptr& result )
{
if ( result.isNull() )
return;
if ( m_currentTrack.isNull() || ( !m_currentTrack.isNull() && m_currentTrack.data()->id() != result.data()->id() ) )
onPlaybackLoading( result );
qint64 duration = AudioEngine::instance()->currentTrackTotalTime();
if ( duration == -1 )
duration = result.data()->duration() * 1000;
ui->seekSlider->setRange( 0, duration );
ui->seekSlider->setValue( 0 );
m_phononTickCheckTimer.stop();
m_sliderTimeLine.stop();
m_sliderTimeLine.setDuration( duration );
m_sliderTimeLine.setFrameRange( 0, duration );
m_sliderTimeLine.setCurrentTime( 0 );
m_seekMsecs = -1;
ui->seekSlider->setVisible( true );
m_noTimeChange = false;
m_lastSliderCheck = 0;
}
示例9: textChanged
void
QueryLabel::setResult( const Tomahawk::result_ptr& result )
{
if ( result.isNull() )
return;
if ( !m_text.isEmpty() && contentsMargins().left() != 0 ) // FIXME: hacky
m_textMargins = contentsMargins();
setContentsMargins( BOXMARGIN * 2, BOXMARGIN / 2, BOXMARGIN * 2, BOXMARGIN / 2);
if ( m_result.isNull() || m_result.data() != result.data() )
{
m_result = result;
m_query = m_result->toQuery();
QList<Tomahawk::result_ptr> rl;
rl << m_result;
m_query->addResults( rl );
updateLabel();
emit textChanged( text() );
emit resultChanged( m_result );
}
}
示例10: tDebug
void
AudioEngine::loadNextTrack()
{
tDebug( LOGEXTRA ) << Q_FUNC_INFO;
Tomahawk::result_ptr result;
if ( m_queue && m_queue->trackCount() )
{
result = m_queue->nextItem();
}
if ( !m_playlist.isNull() && result.isNull() )
{
result = m_playlist.data()->nextItem();
}
if ( !result.isNull() )
loadTrack( result );
else
{
if ( !m_playlist.isNull() && m_playlist.data()->retryMode() == Tomahawk::PlaylistInterface::Retry )
m_waitingOnNewTrack = true;
stop();
}
}
示例11: tDebug
void
AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
{
Q_D( AudioEngine );
tDebug( LOGEXTRA ) << Q_FUNC_INFO << ( result.isNull() ? QString() : result->url() );
if ( result.isNull() )
{
stop();
return;
}
setCurrentTrack( result );
if ( !TomahawkUtils::isLocalResult( d->currentTrack->url() ) && !TomahawkUtils::isHttpResult( d->currentTrack->url() )
&& !TomahawkUtils::isRtmpResult( d->currentTrack->url() ) )
{
performLoadIODevice( d->currentTrack, d->currentTrack->url() );
}
else
{
QSharedPointer< QIODevice > io;
performLoadTrack( result, result->url(), io );
}
}
示例12: if
void
AudioEngine::playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk::result_ptr& result, const Tomahawk::query_ptr& fromQuery )
{
tDebug( LOGEXTRA ) << Q_FUNC_INFO << ( result.isNull() ? QString() : result->url() );
if ( !m_playlist.isNull() )
m_playlist.data()->reset();
setPlaylist( playlist );
if ( playlist.isNull() && !fromQuery.isNull() )
m_currentTrackPlaylist = playlistinterface_ptr( new SingleTrackPlaylistInterface( fromQuery ) );
else
m_currentTrackPlaylist = playlist;
if ( !result.isNull() )
{
loadTrack( result );
}
else if ( !m_playlist.isNull() && m_playlist.data()->retryMode() == PlaylistModes::Retry )
{
m_waitingOnNewTrack = true;
if ( isStopped() )
emit sendWaitingNotification();
else
stop();
}
}
示例13: qDebug
void
AudioControls::onPlaybackLoading( const Tomahawk::result_ptr& result )
{
qDebug() << Q_FUNC_INFO;
m_currentTrack = result;
ui->artistTrackLabel->setResult( result );
ui->albumLabel->setResult( result );
ui->ownerLabel->setText( result->friendlySource() );
ui->coverImage->setPixmap( m_defaultCover );
if ( ui->timeLabel->text().isEmpty() )
ui->timeLabel->setText( TomahawkUtils::timeToString( 0 ) );
if ( ui->timeLeftLabel->text().isEmpty() )
ui->timeLeftLabel->setText( "-" + TomahawkUtils::timeToString( result->duration() ) );
ui->seekSlider->setRange( 0, m_currentTrack->duration() );
ui->seekSlider->setVisible( true );
/* m_playAction->setEnabled( false );
m_pauseAction->setEnabled( true ); */
ui->pauseButton->setEnabled( true );
ui->pauseButton->setVisible( true );
ui->playPauseButton->setVisible( false );
ui->playPauseButton->setEnabled( false );
}
示例14: onPlaybackLoading
void
AudioControls::onPlaybackStarted( const Tomahawk::result_ptr result )
{
if ( result.isNull() )
return;
if ( m_currentTrack.isNull() || ( !m_currentTrack.isNull() && m_currentTrack.data()->id() != result.data()->id() ) )
onPlaybackLoading( result );
qint64 duration = AudioEngine::instance()->currentTrackTotalTime();
if ( duration <= 0 )
duration = result.data()->track()->duration() * 1000;
ui->seekSlider->setRange( 0, duration );
ui->seekSlider->setValue( 0 );
ui->seekSlider->setEnabled( AudioEngine::instance()->canSeek() );
ui->timeLabel->setText( TomahawkUtils::timeToString( 0 ) );
ui->timeLeftLabel->setText( "-" + TomahawkUtils::timeToString( 0 ) );
tLog() << Q_FUNC_INFO << duration;
m_sliderTimeLine.setDuration( duration );
m_sliderTimeLine.setFrameRange( 0, duration );
m_sliderTimeLine.setCurveShape( QTimeLine::LinearCurve );
m_sliderTimeLine.setCurrentTime( 0 );
m_seeked = false;
int updateRate = (double)1000 / ( (double)ui->seekSlider->contentsRect().width() / (double)( duration / 1000 ) );
m_sliderTimeLine.setUpdateInterval( qBound( 40, updateRate, 500 ) );
m_lastSliderCheck = 0;
m_phononTickCheckTimer.start( 500 );
}
示例15: itemFromIndex
bool
PlayableProxyModel::filterAcceptsRow( int sourceRow, const QModelIndex& sourceParent ) const
{
PlayableItem* pi = itemFromIndex( sourceModel()->index( sourceRow, 0, sourceParent ) );
if ( !pi )
return false;
if ( m_maxVisibleItems >= 0 && sourceRow > m_maxVisibleItems - 1 )
return false;
if ( m_hideDupeItems )
{
for ( int i = 0; i < sourceRow; i++ )
{
PlayableItem* di = itemFromIndex( sourceModel()->index( i, 0, sourceParent ) );
if ( !di )
continue;
bool b = ( pi->query() && pi->query()->equals( di->query() ) ) ||
( pi->album() && pi->album() == di->album() ) ||
( pi->artist() && pi->artist()->name() == di->artist()->name() );
if ( b && filterAcceptsRow( i, sourceParent ) )
return false;
}
}
if ( pi->query() )
{
const Tomahawk::query_ptr& q = pi->query()->displayQuery();
if ( q.isNull() ) // uh oh? filter out invalid queries i guess
return false;
Tomahawk::result_ptr r;
if ( q->numResults() )
r = q->results().first();
if ( !m_showOfflineResults && ( r.isNull() || !r->isOnline() ) )
return false;
if ( filterRegExp().isEmpty() )
return true;
QStringList sl = filterRegExp().pattern().split( " ", QString::SkipEmptyParts );
foreach( QString s, sl )
{
s = s.toLower();
if ( !q->artist().toLower().contains( s ) &&
!q->album().toLower().contains( s ) &&
!q->track().toLower().contains( s ) )
{
return false;
}
}
}