void Result::setResolvedByCollection( const Tomahawk::collection_ptr& collection , bool emitOnlineEvents ) { m_collection = collection; if ( emitOnlineEvents ) { Q_ASSERT( !collection.isNull() ); connect( collection.data(), SIGNAL( destroyed( QObject * ) ), SLOT( onOffline() ), Qt::QueuedConnection ); connect( collection.data(), SIGNAL( online() ), SLOT( onOnline() ), Qt::QueuedConnection ); connect( collection.data(), SIGNAL( offline() ), SLOT( onOffline() ), Qt::QueuedConnection ); } }
AlbumPlaylistInterface::AlbumPlaylistInterface( Tomahawk::Album* album, Tomahawk::ModelMode mode, const Tomahawk::collection_ptr& collection ) : Tomahawk::PlaylistInterface() , m_currentItem( 0 ) , m_infoSystemLoaded( false ) , m_databaseLoaded( false ) , m_mode( mode ) , m_collection( collection ) , m_album( QPointer< Tomahawk::Album >( album ) ) , m_lastQueryTimestamp( 0 ) { if ( m_collection ) { connect( collection.data(), SIGNAL( changed() ), SLOT( onCollectionChanged() ), Qt::UniqueConnection ); } }
QModelIndex SourcesModel::collectionToIndex( const Tomahawk::collection_ptr& collection ) { for ( int i = 0; i < rowCount(); i++ ) { QModelIndex idx = index( i, 0 ); SourcesModel::SourceType type = SourcesModel::indexType( idx ); if ( type == SourcesModel::CollectionSource ) { SourceTreeItem* sti = SourcesModel::indexToTreeItem( idx ); if ( sti && !sti->source().isNull() && sti->source()->collection().data() == collection.data() ) return idx; } } return QModelIndex(); }