本文整理汇总了C++中tomahawk::result_ptr::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ result_ptr::isNull方法的具体用法?C++ result_ptr::isNull怎么用?C++ result_ptr::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tomahawk::result_ptr
的用法示例。
在下文中一共展示了result_ptr::isNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
}
示例2: 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() ) )
{
boost::function< void ( QSharedPointer< QIODevice >& ) > callback =
boost::bind( &AudioEngine::performLoadTrack, this, result, _1 );
Servent::instance()->getIODeviceForUrl( d->currentTrack, callback );
}
else
{
QSharedPointer< QIODevice > io;
performLoadTrack( result, io );
}
}
示例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.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 );
}
}
示例4: 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();
}
}
示例5: tDebug
void
AudioEngine::loadNextTrack()
{
tDebug( LOGEXTRA ) << Q_FUNC_INFO;
Tomahawk::result_ptr result;
if ( !m_stopAfterTrack.isNull() && !m_currentTrack.isNull() )
{
if ( m_stopAfterTrack->equals( m_currentTrack->toQuery() ) )
{
m_stopAfterTrack.clear();
stop();
return;
}
}
if ( m_queue && m_queue->trackCount() )
{
query_ptr query = m_queue->tracks().first();
if ( query && query->numResults() )
result = query->results().first();
}
if ( !m_playlist.isNull() && result.isNull() )
{
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Loading playlist's next item" << m_playlist.data() << m_playlist->shuffled();
if ( m_playlist.data()->nextResult() )
{
result = m_playlist.data()->nextResult();
m_currentTrackPlaylist = m_playlist;
}
}
if ( !result.isNull() )
{
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Got next item, loading track";
loadTrack( result );
}
else
{
if ( !m_playlist.isNull() && m_playlist.data()->retryMode() == Tomahawk::PlaylistModes::Retry )
m_waitingOnNewTrack = true;
stop();
}
}
示例6: 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;
}
示例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 );
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 );
}
}
示例8: updated
void
StreamConnection::startSending( const Tomahawk::result_ptr& result )
{
if ( result.isNull() )
{
qDebug() << "Can't handle invalid result!";
shutdown();
return;
}
m_result = result;
qDebug() << "Starting to transmit" << m_result->url();
QSharedPointer<QIODevice> io = Servent::instance()->getIODeviceForUrl( m_result );
if( !io )
{
qDebug() << "Couldn't read from source:" << m_result->url();
shutdown();
return;
}
m_readdev = QSharedPointer<QIODevice>( io );
sendSome();
emit updated();
}
示例9: 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();
}
示例10: 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 );
}
}
示例11: 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 );
}
示例12: 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 );
}
示例13: itemFromIndex
bool
TrackProxyModel::filterAcceptsRow( int sourceRow, const QModelIndex& sourceParent ) const
{
TrackModelItem* pi = itemFromIndex( sourceModel()->index( sourceRow, 0, sourceParent ) );
if ( !pi )
return false;
const Tomahawk::query_ptr& q = pi->query();
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->collection()->source()->isOnline() )
return false;
if ( filterRegExp().isEmpty() )
return true;
QStringList sl = filterRegExp().pattern().split( " ", QString::SkipEmptyParts );
foreach( QString s, sl )
{
s = s.toLower();
if ( !r.isNull() )
{
if ( !r->artist()->name().toLower().contains( s ) &&
!r->album()->name().toLower().contains( s ) &&
!r->track().toLower().contains( s ) )
{
return false;
}
}
else
{
if ( !q->artist().toLower().contains( s ) &&
!q->album().toLower().contains( s ) &&
!q->track().toLower().contains( s ) )
{
return false;
}
}
}
示例14: if
void
AudioEngine::playItem( Tomahawk::PlaylistInterface* playlist, const Tomahawk::result_ptr& result )
{
tDebug( LOGEXTRA ) << Q_FUNC_INFO << ( result.isNull() ? QString() : result->url() );
if ( !m_playlist.isNull() )
m_playlist.data()->reset();
setPlaylist( playlist );
m_currentTrackPlaylist = playlist->getSharedPointer();
if ( !result.isNull() )
loadTrack( result );
else if ( !m_playlist.isNull() && m_playlist.data()->retryMode() == PlaylistInterface::Retry )
{
m_waitingOnNewTrack = true;
stop();
}
}
示例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;
}
}
}