bool SourcesModel::appendItem( const source_ptr& source ) { SourceTreeItem* item = new SourceTreeItem( source, this ); connect( item, SIGNAL( clicked( QModelIndex ) ), this, SIGNAL( clicked( QModelIndex ) ) ); // qDebug() << "Appending source item:" << item->source()->username(); invisibleRootItem()->appendRow( item->columns() ); if ( !source.isNull() ) { connect( source.data(), SIGNAL( offline() ), SLOT( onSourceChanged() ) ); connect( source.data(), SIGNAL( online() ), SLOT( onSourceChanged() ) ); connect( source.data(), SIGNAL( stats( QVariantMap ) ), SLOT( onSourceChanged() ) ); connect( source.data(), SIGNAL( playbackStarted( Tomahawk::query_ptr ) ), SLOT( onSourceChanged() ) ); connect( source.data(), SIGNAL( stateChanged() ), SLOT( onSourceChanged() ) ); } return true; // FIXME }
Collection::Collection( const source_ptr& source, const QString& name, QObject* parent ) : QObject( parent ) , m_name( name ) , m_lastmodified( 0 ) , m_changed( false ) , m_source( source ) { qDebug() << Q_FUNC_INFO << name << source->friendlyName(); connect( source.data(), SIGNAL( synced() ), SLOT( onSynced() ) ); }
CustomPlaylistView::CustomPlaylistView( CustomPlaylistView::PlaylistType type, const source_ptr& s, QWidget* parent ) : PlaylistView ( parent ) , m_type( type ) , m_source( s ) , m_model( new PlaylistModel( this ) ) { // Generate the tracks, add them to the playlist m_model->setStyle( PlayableModel::Large ); setPlaylistModel( m_model ); generateTracks(); if ( m_type == SourceLovedTracks ) connect( m_source.data(), SIGNAL( socialAttributesChanged( QString ) ), this, SLOT( socialAttributesChanged( QString ) ) ); else if ( m_type == TopLovedTracks ) { connect( SourceList::instance()->getLocal().data(), SIGNAL( socialAttributesChanged( QString ) ), this, SLOT( socialAttributesChanged( QString ) ) ); foreach ( const source_ptr& s, SourceList::instance()->sources( true ) ) connect( s.data(), SIGNAL( socialAttributesChanged( QString ) ), this, SLOT( socialAttributesChanged( QString ) ) ); connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ), this, SLOT( sourceAdded( Tomahawk::source_ptr ) ) ); }
CustomPlaylistView::CustomPlaylistView( CustomPlaylistView::PlaylistType type, const source_ptr& s, QWidget* parent ) : PlaylistView ( parent ) , m_type( type ) , m_source( s ) , m_model( new PlaylistModel( this ) ) { // Generate the tracks, add them to the playlist setFrameShape( QFrame::NoFrame ); setAttribute( Qt::WA_MacShowFocusRect, 0 ); setPlaylistModel( m_model ); generateTracks(); if ( m_type == SourceLovedTracks ) connect( m_source.data(), SIGNAL( socialAttributesChanged() ), this, SLOT( reload() ) ); else if ( m_type == AllLovedTracks ) { connect( SourceList::instance()->getLocal().data(), SIGNAL( socialAttributesChanged() ), this, SLOT( reload() ) ); foreach ( const source_ptr& s, SourceList::instance()->sources( true ) ) connect( s.data(), SIGNAL( socialAttributesChanged() ), this, SLOT( reload() ) ); connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ), this, SLOT( sourceAdded( Tomahawk::source_ptr ) ) ); }