本文整理汇总了C++中tomahawk::source_ptr类的典型用法代码示例。如果您正苦于以下问题:C++ source_ptr类的具体用法?C++ source_ptr怎么用?C++ source_ptr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了source_ptr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QWidget
SourceInfoWidget::SourceInfoWidget( const Tomahawk::source_ptr& source, QWidget* parent )
: QWidget( parent )
, ui( new Ui::SourceInfoWidget )
{
ui->setupUi( this );
ui->historyView->overlay()->setEnabled( false );
m_recentCollectionModel = new CollectionFlatModel( ui->recentCollectionView );
ui->recentCollectionView->setModel( m_recentCollectionModel );
m_recentCollectionModel->addFilteredCollection( source->collection(), 250, DatabaseCommand_AllTracks::ModificationTime );
m_historyModel = new PlaylistModel( ui->historyView );
ui->historyView->setModel( m_historyModel );
m_historyModel->loadHistory( source );
connect( source.data(), SIGNAL( playbackFinished( Tomahawk::query_ptr ) ), SLOT( onPlaybackFinished( Tomahawk::query_ptr ) ) );
ui->recentCollectionView->setColumnHidden( TrackModel::Bitrate, true );
ui->recentCollectionView->setColumnHidden( TrackModel::Origin, true );
ui->recentCollectionView->setColumnHidden( TrackModel::Filesize, true );
ui->historyView->setColumnHidden( TrackModel::Bitrate, true );
ui->historyView->setColumnHidden( TrackModel::Origin, true );
ui->historyView->setColumnHidden( TrackModel::Filesize, true );
m_recentAlbumModel = new AlbumModel( ui->recentAlbumView );
ui->recentAlbumView->setModel( m_recentAlbumModel );
m_recentAlbumModel->addFilteredCollection( source->collection(), 20, DatabaseCommand_AllAlbums::ModificationTime );
m_title = tr( "Info about %1" ).arg( source->isLocal() ? tr( "Your Collection" ) : source->friendlyName() );
}
示例2: QWidget
SourceInfoWidget::SourceInfoWidget( const Tomahawk::source_ptr& source, QWidget* parent )
: QWidget( parent )
, ui( new Ui::SourceInfoWidget )
, m_source( source )
{
ui->setupUi( this );
ui->historyView->setFrameShape( QFrame::NoFrame );
ui->historyView->setAttribute( Qt::WA_MacShowFocusRect, 0 );
ui->recentAlbumView->setFrameShape( QFrame::NoFrame );
ui->recentAlbumView->setAttribute( Qt::WA_MacShowFocusRect, 0 );
ui->recentCollectionView->setFrameShape( QFrame::NoFrame );
ui->recentCollectionView->setAttribute( Qt::WA_MacShowFocusRect, 0 );
TomahawkUtils::unmarginLayout( layout() );
ui->historyView->overlay()->setEnabled( false );
m_recentCollectionModel = new CollectionFlatModel( ui->recentCollectionView );
m_recentCollectionModel->setStyle( TrackModel::Short );
ui->recentCollectionView->setTrackModel( m_recentCollectionModel );
ui->recentCollectionView->sortByColumn( TrackModel::Age, Qt::DescendingOrder );
m_historyModel = new PlaylistModel( ui->historyView );
m_historyModel->setStyle( TrackModel::Short );
ui->historyView->setPlaylistModel( m_historyModel );
m_historyModel->loadHistory( source, 25 );
m_recentAlbumModel = new AlbumModel( ui->recentAlbumView );
ui->recentAlbumView->setAlbumModel( m_recentAlbumModel );
ui->recentAlbumView->proxyModel()->sort( -1 );
onCollectionChanged();
connect( source->collection().data(), SIGNAL( changed() ), SLOT( onCollectionChanged() ) );
connect( source.data(), SIGNAL( playbackFinished( Tomahawk::query_ptr ) ), SLOT( onPlaybackFinished( Tomahawk::query_ptr ) ) );
m_title = tr( "New Additions" );
if ( source->isLocal() )
{
m_description = tr( "My recent activity" );
}
else
{
m_description = tr( "Recent activity from %1" ).arg( source->friendlyName() );
}
m_pixmap.load( RESPATH "images/new-additions.png" );
}
示例3: QWidget
SourceInfoWidget::SourceInfoWidget( const Tomahawk::source_ptr& source, QWidget* parent )
: QWidget( parent )
, ui( new Ui::SourceInfoWidget )
, m_source( source )
{
ui->setupUi( this );
TomahawkUtils::unmarginLayout( layout() );
TomahawkUtils::unmarginLayout( ui->horizontalLayout );
TomahawkUtils::unmarginLayout( ui->verticalLayout );
TomahawkUtils::unmarginLayout( ui->verticalLayout_2 );
TomahawkUtils::unmarginLayout( ui->verticalLayout_3 );
ui->splitter->setStretchFactor( 0, 0 );
ui->splitter->setStretchFactor( 1, 1 );
ui->historyView->overlay()->setEnabled( false );
m_recentTracksModel = new RecentlyAddedModel( source, ui->recentCollectionView );
m_recentTracksModel->setStyle( PlayableModel::Short );
ui->recentCollectionView->setPlayableModel( m_recentTracksModel );
ui->recentCollectionView->sortByColumn( PlayableModel::Age, Qt::DescendingOrder );
m_historyModel = new RecentlyPlayedModel( source, ui->historyView );
m_historyModel->setStyle( PlayableModel::Short );
ui->historyView->setPlaylistModel( m_historyModel );
m_recentAlbumModel = new AlbumModel( ui->recentAlbumView );
ui->recentAlbumView->setAlbumModel( m_recentAlbumModel );
ui->recentAlbumView->proxyModel()->sort( -1 );
onCollectionChanged();
connect( source->collection().data(), SIGNAL( changed() ), SLOT( onCollectionChanged() ) );
m_title = tr( "New Additions" );
if ( source->isLocal() )
{
m_description = tr( "My recent activity" );
}
else
{
m_description = tr( "Recent activity from %1" ).arg( source->friendlyName() );
}
m_pixmap.load( RESPATH "images/new-additions.png" );
}
示例4: catchUpRequest
void
LatchManager::latchModeChangeRequest( const Tomahawk::source_ptr& source, bool realtime )
{
if ( !isLatched( source ) )
return;
source->playlistInterface()->setLatchMode( realtime ? Tomahawk::PlaylistModes::RealTime : Tomahawk::PlaylistModes::StayOnSong );
if ( realtime )
catchUpRequest();
}
示例5: id
Tomahawk::playlistinterface_ptr
Source::playlistInterface()
{
if ( m_playlistInterface.isNull() )
{
Tomahawk::source_ptr source = SourceList::instance()->get( id() );
m_playlistInterface = Tomahawk::playlistinterface_ptr( new Tomahawk::SourcePlaylistInterface( source.data() ) );
}
return m_playlistInterface;
}
示例6:
void
SipHandler::onAvatarReceived( const QString& from, const QPixmap& avatar )
{
// qDebug() << Q_FUNC_INFO << "setting avatar on source for" << from;
if ( avatar.isNull() )
{
return;
}
m_usernameAvatars.insert( from, avatar );
ControlConnection *conn = Servent::instance()->lookupControlConnection( from );
if( conn )
{
Tomahawk::source_ptr source = conn->source();
if( source )
{
// qDebug() << Q_FUNC_INFO << from << "got source, setting avatar on source:" << source->friendlyName();
source->setAvatar( avatar );
}
}
}
示例7: QWidget
SourceInfoWidget::SourceInfoWidget( const Tomahawk::source_ptr& source, QWidget* parent )
: QWidget( parent )
, ui( new Ui::SourceInfoWidget )
{
ui->setupUi( this );
ui->historyView->setFrameShape( QFrame::NoFrame );
ui->historyView->setAttribute( Qt::WA_MacShowFocusRect, 0 );
ui->recentAlbumView->setFrameShape( QFrame::NoFrame );
ui->recentAlbumView->setAttribute( Qt::WA_MacShowFocusRect, 0 );
ui->recentCollectionView->setFrameShape( QFrame::NoFrame );
ui->recentCollectionView->setAttribute( Qt::WA_MacShowFocusRect, 0 );
TomahawkUtils::unmarginLayout( layout() );
ui->historyView->overlay()->setEnabled( false );
m_recentCollectionModel = new CollectionFlatModel( ui->recentCollectionView );
m_recentCollectionModel->setStyle( TrackModel::Short );
ui->recentCollectionView->setTrackModel( m_recentCollectionModel );
m_recentCollectionModel->addFilteredCollection( source->collection(), 250, DatabaseCommand_AllTracks::ModificationTime );
m_historyModel = new PlaylistModel( ui->historyView );
m_historyModel->setStyle( TrackModel::Short );
ui->historyView->setPlaylistModel( m_historyModel );
m_historyModel->loadHistory( source, 25 );
connect( source.data(), SIGNAL( playbackFinished( Tomahawk::query_ptr ) ), SLOT( onPlaybackFinished( Tomahawk::query_ptr ) ) );
m_recentAlbumModel = new AlbumModel( ui->recentAlbumView );
ui->recentAlbumView->setAlbumModel( m_recentAlbumModel );
m_recentAlbumModel->addFilteredCollection( source->collection(), 20, DatabaseCommand_AllAlbums::ModificationTime );
m_title = tr( "New Additions" );
m_description = tr( "Recent activity from %1" ).arg( source->isLocal() ? tr( "Your Collection" ) : source->friendlyName() );
m_pixmap.load( RESPATH "images/new-additions.png" );
}
示例8: foreach
QList< Tomahawk::PlaybackLog >
Artist::playbackHistory( const Tomahawk::source_ptr& source ) const
{
QList< Tomahawk::PlaybackLog > history;
foreach ( const PlaybackLog& log, m_playbackHistory )
{
if ( source.isNull() || log.source == source )
{
history << log;
}
}
return history;
}
示例9: locker
QList< Tomahawk::PlaybackLog >
TrackData::playbackHistory( const Tomahawk::source_ptr& source ) const
{
QMutexLocker locker( &s_memberMutex );
QList< Tomahawk::PlaybackLog > history;
foreach ( const PlaybackLog& log, m_playbackHistory )
{
if ( source.isNull() || log.source == source )
{
history << log;
}
}
return history;
}
示例10: onSourcesReady
void
RecentlyPlayedModel::setSource( const Tomahawk::source_ptr& source )
{
m_source = source;
if ( source.isNull() )
{
if ( SourceList::instance()->isReady() )
onSourcesReady();
else
connect( SourceList::instance(), SIGNAL( ready() ), SLOT( onSourcesReady() ) );
connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ), SLOT( onSourceAdded( Tomahawk::source_ptr ) ) );
}
else
{
onSourceAdded( source );
loadHistory();
}
}
示例11: SourceTreeItem
SourceItem::SourceItem( SourcesModel* mdl, SourceTreeItem* parent, const Tomahawk::source_ptr& source )
: SourceTreeItem( mdl, parent, SourcesModel::Collection )
, m_source( source )
, m_playlists( 0 )
, m_stations( 0 )
, m_latchedOn( false )
, m_sourceInfoItem( 0 )
, m_coolPlaylistsItem( 0 )
, m_collectionPage( 0 )
, m_sourceInfoPage( 0 )
, m_coolPlaylistsPage( 0 )
, m_lovedTracksPage( 0 )
, m_latestAdditionsPage( 0 )
, m_recentPlaysPage( 0 )
, m_whatsHotPage( 0 )
{
if ( m_source.isNull() )
{
m_superCol = TomahawkUtils::createAvatarFrame( QPixmap( RESPATH "images/supercollection.png" ) );
return;
}
m_collectionItem = new GenericPageItem( model(), this, tr( "Collection" ), QIcon( RESPATH "images/collection.png" ), //FIXME different icon
boost::bind( &SourceItem::collectionClicked, this ),
boost::bind( &SourceItem::getCollectionPage, this ) );
/* m_sourceInfoItem = new GenericPageItem( model(), this, tr( "New Additions" ), QIcon( RESPATH "images/new-additions.png" ),
boost::bind( &SourceItem::sourceInfoClicked, this ),
boost::bind( &SourceItem::getSourceInfoPage, this ) );*/
m_latestAdditionsItem = new GenericPageItem( model(), this, tr( "Latest Additions" ), QIcon( RESPATH "images/new-additions.png" ),
boost::bind( &SourceItem::latestAdditionsClicked, this ),
boost::bind( &SourceItem::getLatestAdditionsPage, this ) );
m_recentPlaysItem = new GenericPageItem( model(), this, tr( "Recently Played" ), QIcon( RESPATH "images/recently-played.png" ),
boost::bind( &SourceItem::recentPlaysClicked, this ),
boost::bind( &SourceItem::getRecentPlaysPage, this ) );
m_lovedTracksItem = new GenericPageItem( model(), this, tr( "Loved Tracks" ), QIcon( RESPATH "images/loved_playlist.png" ),
boost::bind( &SourceItem::lovedTracksClicked, this ),
boost::bind( &SourceItem::getLovedTracksPage, this ) );
m_collectionItem->setSortValue( -350 );
// m_sourceInfoItem->setSortValue( -300 );
m_latestAdditionsItem->setSortValue( -250 );
m_recentPlaysItem->setSortValue( -200 );
m_lovedTracksItem->setSortValue( -150 );
// create category items if there are playlists to show, or stations to show
QList< playlist_ptr > playlists = source->collection()->playlists();
QList< dynplaylist_ptr > autoplaylists = source->collection()->autoPlaylists();
QList< dynplaylist_ptr > stations = source->collection()->stations();
if ( !playlists.isEmpty() || !autoplaylists.isEmpty() || source->isLocal() )
{
m_playlists = new CategoryItem( model(), this, SourcesModel::PlaylistsCategory, source->isLocal() );
onPlaylistsAdded( playlists );
onAutoPlaylistsAdded( autoplaylists );
}
if ( !stations.isEmpty() || source->isLocal() )
{
m_stations = new CategoryItem( model(), this, SourcesModel::StationsCategory, source->isLocal() );
onStationsAdded( stations );
}
if ( ViewManager::instance()->pageForCollection( source->collection() ) )
model()->linkSourceItemToPage( this, ViewManager::instance()->pageForCollection( source->collection() ) );
m_defaultAvatar = TomahawkUtils::createAvatarFrame( QPixmap( RESPATH "images/user-avatar.png" ) );
// load auto playlists and stations!
connect( source.data(), SIGNAL( stats( QVariantMap ) ), SIGNAL( updated() ) );
connect( source.data(), SIGNAL( syncedWithDatabase() ), SIGNAL( updated() ) );
connect( source.data(), SIGNAL( playbackStarted( Tomahawk::query_ptr ) ), SIGNAL( updated() ) );
connect( source.data(), SIGNAL( stateChanged() ), SIGNAL( updated() ) );
connect( source.data(), SIGNAL( offline() ), SIGNAL( updated() ) );
connect( source.data(), SIGNAL( online() ), SIGNAL( updated() ) );
connect( SourceList::instance(), SIGNAL( sourceLatchedOn( Tomahawk::source_ptr, Tomahawk::source_ptr ) ), SLOT( latchedOn( Tomahawk::source_ptr, Tomahawk::source_ptr ) ) );
connect( SourceList::instance(), SIGNAL( sourceLatchedOff( Tomahawk::source_ptr, Tomahawk::source_ptr ) ), SLOT( latchedOff( Tomahawk::source_ptr, Tomahawk::source_ptr ) ) );
connect( source->collection().data(), SIGNAL( playlistsAdded( QList<Tomahawk::playlist_ptr> ) ),
SLOT( onPlaylistsAdded( QList<Tomahawk::playlist_ptr> ) ), Qt::QueuedConnection );
connect( source->collection().data(), SIGNAL( autoPlaylistsAdded( QList< Tomahawk::dynplaylist_ptr > ) ),
SLOT( onAutoPlaylistsAdded( QList<Tomahawk::dynplaylist_ptr> ) ), Qt::QueuedConnection );
connect( source->collection().data(), SIGNAL( stationsAdded( QList<Tomahawk::dynplaylist_ptr> ) ),
SLOT( onStationsAdded( QList<Tomahawk::dynplaylist_ptr> ) ), Qt::QueuedConnection );
if ( m_source->isLocal() )
QTimer::singleShot( 0, this, SLOT( requestExpanding() ) );
}
示例12: connect
void
RecentlyPlayedModel::onSourceAdded( const Tomahawk::source_ptr& source )
{
connect( source.data(), SIGNAL( playbackFinished( Tomahawk::track_ptr, Tomahawk::PlaybackLog ) ),
SLOT( onPlaybackFinished( Tomahawk::track_ptr, Tomahawk::PlaybackLog ) ), Qt::UniqueConnection );
}
示例13: connect
void
WelcomeWidget::onSourceAdded( const Tomahawk::source_ptr& source )
{
connect( source->dbCollection().data(), SIGNAL( changed() ), SLOT( updateRecentAdditions() ), Qt::UniqueConnection );
}
示例14:
void
TrackData::share( const Tomahawk::source_ptr& source )
{
DatabaseCommand_ShareTrack* cmd = new DatabaseCommand_ShareTrack( m_ownRef.toStrongRef(), source->nodeId() );
Database::instance()->enqueue( QSharedPointer< DatabaseCommand >( cmd ) );
}
示例15: connect
void
RecentlyAddedModel::onSourceAdded( const Tomahawk::source_ptr& source )
{
connect( source->dbCollection().data(), SIGNAL( changed() ), SLOT( loadHistory() ) );
}