本文整理汇总了C++中tomahawk::result_ptr::isOnline方法的典型用法代码示例。如果您正苦于以下问题:C++ result_ptr::isOnline方法的具体用法?C++ result_ptr::isOnline怎么用?C++ result_ptr::isOnline使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tomahawk::result_ptr
的用法示例。
在下文中一共展示了result_ptr::isOnline方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
}
}
示例2: 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->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;
}
}
}
示例3: siblingResult
bool
PlaylistInterface::hasPreviousResult() const
{
Tomahawk::result_ptr r = siblingResult( -1 );
return ( r && r->isOnline() );
}
示例4: filterRegExp
bool
PlayableProxyModel::nameFilterAcceptsRow( int sourceRow, PlayableItem* pi, const QModelIndex& sourceParent ) const
{
if ( m_hideEmptyParents && pi->source() )
{
if ( !sourceModel()->rowCount( sourceModel()->index( sourceRow, 0, sourceParent ) ) )
{
return false;
}
}
const Tomahawk::query_ptr& query = pi->query();
if ( query )
{
Tomahawk::result_ptr r;
if ( query->numResults() )
r = query->results().first();
if ( !m_showOfflineResults && ( r.isNull() || !r->isOnline() ) )
return false;
const QRegExp regexp = filterRegExp();
if ( regexp.isEmpty() )
return true;
QStringList sl = regexp.pattern().split( " ", QString::SkipEmptyParts );
foreach( const QString& s, sl )
{
const Tomahawk::track_ptr& track = query->track();
if ( !track->artist().contains( s, Qt::CaseInsensitive ) &&
!track->album().contains( s, Qt::CaseInsensitive ) &&
!track->track().contains( s, Qt::CaseInsensitive ) )
{
return false;
}
}
}
const Tomahawk::album_ptr& al = pi->album();
if ( al )
{
QStringList sl = filterRegExp().pattern().split( " ", QString::SkipEmptyParts );
foreach( const QString& s, sl )
{
if ( !al->name().contains( s, Qt::CaseInsensitive ) &&
!al->artist()->name().contains( s, Qt::CaseInsensitive ) )
{
return false;
}
}
return true;
}
const Tomahawk::artist_ptr& ar = pi->artist();
if ( ar )
{
QStringList sl = filterRegExp().pattern().split( " ", QString::SkipEmptyParts );
foreach( const QString& s, sl )
{
if ( !ar->name().contains( s, Qt::CaseInsensitive ) )
{
return false;
}
}
return true;
}
return true;
}