void Source::reportSocialAttributesChanged( DatabaseCommand_SocialAction* action ) { emit socialAttributesChanged(); if ( action->action() == "latchOn" ) { const source_ptr to = SourceList::instance()->get( action->comment() ); if ( !to.isNull() ) emit latchedOn( to ); } else if ( action->action() == "latchOff" ) { const source_ptr from = SourceList::instance()->get( action->comment() ); if ( !from.isNull() ) emit latchedOff( from ); } }
unsigned int Artist::playbackCount( const source_ptr& source ) { unsigned int count = 0; foreach ( const PlaybackLog& log, m_playbackHistory ) { if ( source.isNull() || log.source == source ) count++; } return count; }
unsigned int TrackData::playbackCount( const source_ptr& source ) { QMutexLocker locker( &s_memberMutex ); unsigned int count = 0; foreach ( const PlaybackLog& log, m_playbackHistory ) { if ( source.isNull() || log.source == source ) count++; } return count; }
RecentlyAddedModel::RecentlyAddedModel( const source_ptr& source, QObject* parent ) : TrackModel( parent ) , m_source( source ) , m_limit( LATEST_TRACK_ITEMS ) { if ( source.isNull() ) { connect( SourceList::instance(), SIGNAL( ready() ), SLOT( onSourcesReady() ) ); connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ), SLOT( onSourceAdded( Tomahawk::source_ptr ) ) ); } else { onSourceAdded( source ); loadHistory(); } }
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 }