当前位置: 首页>>代码示例>>C++>>正文


C++ source_ptr类代码示例

本文整理汇总了C++中source_ptr的典型用法代码示例。如果您正苦于以下问题:C++ source_ptr类的具体用法?C++ source_ptr怎么用?C++ source_ptr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了source_ptr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: FlexibleView

HistoryWidget::HistoryWidget( const source_ptr& source, QWidget* parent )
    : FlexibleView( parent, m_header = new QWidget() )
{
    m_header->setMaximumHeight( 160 );
/*    QCalendarWidget* m_calendarFrom = new QCalendarWidget();
    QCalendarWidget* m_calendarTo = new QCalendarWidget();
    m_calendarFrom->setGridVisible( false );
    m_calendarTo->setGridVisible( false );*/
    m_calendarFrom = new QDateEdit( QDate::currentDate() );
    m_calendarTo = new QDateEdit( QDate::currentDate() );
    m_calendarFrom->setDisplayFormat( "yyyy MMMM dd" );
    m_calendarTo->setDisplayFormat( "yyyy MMMM dd" );

    // setting an empty style-sheet prevents the QDateEdits from adopting their parent's QPalette
    QString calSheet = QString( "QDateEdit { }" ).arg( TomahawkStyle::PAGE_BACKGROUND.name() );
    m_calendarFrom->setStyleSheet( calSheet );
    m_calendarTo->setStyleSheet( calSheet );

    QPalette pal = m_header->palette();
    pal.setColor( QPalette::Foreground, Qt::white );
    pal.setColor( QPalette::Text, Qt::white );
    pal.setBrush( backgroundRole(), TomahawkStyle::PAGE_BACKGROUND );
    m_header->setPalette( pal );
    m_header->setAutoFillBackground( true );

    QHBoxLayout* layout = new QHBoxLayout( m_header );
    layout->addSpacerItem( new QSpacerItem( 1, 0, QSizePolicy::MinimumExpanding, QSizePolicy::Minimum ) );
    layout->addWidget( new QLabel( tr( "From:" ) ) );
    layout->addWidget( m_calendarFrom );
    layout->addSpacerItem( new QSpacerItem( 16, 0, QSizePolicy::Fixed, QSizePolicy::Minimum ) );
    layout->addWidget( new QLabel( tr( "To:" ) ) );
    layout->addWidget( m_calendarTo );
    layout->addSpacerItem( new QSpacerItem( 1, 0, QSizePolicy::MinimumExpanding, QSizePolicy::Minimum ) );
    m_header->setLayout( layout );

    setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::RecentlyPlayed ) );

    m_model = new RecentlyPlayedModel( this );
    m_model->setTitle( tr( "Recently Played Tracks" ) );

    if ( source->isLocal() )
        m_model->setDescription( tr( "Your recently played tracks" ) );
    else
        m_model->setDescription( tr( "%1's recently played tracks" ).arg( source->friendlyName() ) );

    PlaylistLargeItemDelegate* del = new PlaylistLargeItemDelegate( PlaylistLargeItemDelegate::RecentlyPlayed, trackView(), trackView()->proxyModel() );
    trackView()->setItemDelegate( del );

    setPlayableModel( m_model );
    setEmptyTip( tr( "Sorry, we could not find any recent plays!" ) );
    m_model->setSource( source );

    setGuid( QString( "recentplays/%1" ).arg( source->nodeId() ) );

/*    connect( m_calendarFrom, SIGNAL( clicked( QDate ) ), SLOT( onDateClicked( QDate ) ) );
    connect( m_calendarTo, SIGNAL( clicked( QDate ) ), SLOT( onDateClicked( QDate ) ) );*/
    connect( m_calendarFrom, SIGNAL( dateChanged( QDate ) ), SLOT( onDateClicked( QDate ) ) );
    connect( m_calendarTo, SIGNAL( dateChanged( QDate ) ), SLOT( onDateClicked( QDate ) ) );
}
开发者ID:ehaas,项目名称:tomahawk,代码行数:59,代码来源:HistoryWidget.cpp

示例2: qDebug

void
LatchManager::latchRequest( const source_ptr& source )
{
    qDebug() << Q_FUNC_INFO;
    if ( isLatched( source ) )
        return;

    m_state = Latching;
    m_waitingForLatch = source;
    AudioEngine::instance()->playItem( source->playlistInterface(), source->playlistInterface()->nextResult() );
}
开发者ID:AidedPolecat6,项目名称:tomahawk,代码行数:11,代码来源:LatchManager.cpp

示例3: QObject

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() ) );
}
开发者ID:AndyCoder,项目名称:tomahawk,代码行数:11,代码来源:Collection.cpp

示例4: socialAttributesChanged

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 );
    }
}
开发者ID:Pritoj,项目名称:tomahawk,代码行数:18,代码来源:source.cpp

示例5: QObject

Collection::Collection( const source_ptr& source, const QString& name, QObject* parent )
    : QObject( parent )
    , m_name( name )
    , m_lastmodified( 0 )
    , m_isLoaded( false )
    , m_source( source )
{
    qDebug() << Q_FUNC_INFO << name << source->friendlyName();
}
开发者ID:ralepinski,项目名称:tomahawk,代码行数:9,代码来源:collection.cpp

示例6: updated

void
SourceItem::latchedOff( const source_ptr& from, const source_ptr& to )
{
    if ( from->isLocal() && ( m_source == to || m_source == from ) )
    {
        m_latchedOn = false;
        disconnect( m_latchedOnTo->playlistInterface().data(), SIGNAL( latchModeChanged( Tomahawk::PlaylistModes::LatchMode ) ) );
        m_latchedOnTo.clear();
        emit updated();
    }
}
开发者ID:eartle,项目名称:tomahawk,代码行数:11,代码来源:SourceItem.cpp

示例7: SourceTreeItem

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
}
开发者ID:tiegz,项目名称:tomahawk,代码行数:20,代码来源:sourcesmodel.cpp

示例8: updated

void
SourceItem::latchedOn( const source_ptr& from, const source_ptr& to )
{
    if ( from->isLocal() && ( m_source == to || m_source == from ) )
    {
        m_latchedOn = true;
        m_latchedOnTo = to;
        connect( m_latchedOnTo->playlistInterface().data(), SIGNAL( latchModeChanged( Tomahawk::PlaylistInterface::LatchMode ) ), SLOT( latchModeChanged( Tomahawk::PlaylistInterface::LatchMode ) ) );
        emit updated();
    }
}
开发者ID:mguentner,项目名称:tomahawk,代码行数:11,代码来源:SourceItem.cpp

示例9: foreach

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;
}
开发者ID:seezer,项目名称:tomahawk,代码行数:12,代码来源:Artist.cpp

示例10: FlexibleView

HistoryWidget::HistoryWidget( const source_ptr& source, QWidget* parent )
    : FlexibleView( parent )
{
    setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::RecentlyPlayed ) );

    m_model = new RecentlyPlayedModel( this );
    m_model->setTitle( tr( "Recently Played Tracks" ) );

    if ( source->isLocal() )
        m_model->setDescription( tr( "Your recently played tracks" ) );
    else
        m_model->setDescription( tr( "%1's recently played tracks" ).arg( source->friendlyName() ) );

    trackView()->setIndentation( 0 );
    trackView()->setUniformRowHeights( false );

    setPlayableModel( m_model );
    setEmptyTip( tr( "Sorry, we could not find any recent plays!" ) );
    m_model->setSource( source );

    setGuid( QString( "recentplays/%1" ).arg( source->nodeId() ) );
}
开发者ID:Irkinosor,项目名称:tomahawk,代码行数:22,代码来源:HistoryWidget.cpp

示例11: locker

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;
}
开发者ID:purcaro,项目名称:tomahawk,代码行数:14,代码来源:TrackData.cpp

示例12: TrackModel

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();
    }
}
开发者ID:mguentner,项目名称:tomahawk,代码行数:16,代码来源:RecentlyAddedModel.cpp

示例13: Connection

DBSyncConnection::DBSyncConnection( Servent* s, source_ptr src )
    : Connection( s )
    , m_source( src )
    , m_state( UNKNOWN )
{
    qDebug() << Q_FUNC_INFO << src->id() << thread();
    connect( this,            SIGNAL( stateChanged( DBSyncConnection::State, DBSyncConnection::State, QString ) ),
             m_source.data(),   SLOT( onStateChanged( DBSyncConnection::State, DBSyncConnection::State, QString ) ) );

    m_timer.setInterval( IDLE_TIMEOUT );
    connect( &m_timer, SIGNAL( timeout() ), SLOT( idleTimeout() ) );

    this->setMsgProcessorModeIn( MsgProcessor::PARSE_JSON | MsgProcessor::UNCOMPRESS_ALL );

    // msgs are stored compressed in the db, so not typically needed here, but doesnt hurt:
    this->setMsgProcessorModeOut( MsgProcessor::COMPRESS_IF_LARGE );
}
开发者ID:xevix,项目名称:tomahawk,代码行数:17,代码来源:dbsyncconnection.cpp

示例14: Connection

DBSyncConnection::DBSyncConnection( Servent* s, const source_ptr& src )
    : Connection( s )
    , m_source( src )
    , m_state( UNKNOWN )
{
    qDebug() << Q_FUNC_INFO << src->id() << thread();

    connect( this,            SIGNAL( stateChanged( DBSyncConnection::State, DBSyncConnection::State, QString ) ),
             m_source.data(),   SLOT( onStateChanged( DBSyncConnection::State, DBSyncConnection::State, QString ) ) );
    connect( m_source.data(), SIGNAL( commandsFinished() ),
             this,              SLOT( lastOpApplied() ) );

    this->setMsgProcessorModeIn( MsgProcessor::PARSE_JSON | MsgProcessor::UNCOMPRESS_ALL );

    // msgs are stored compressed in the db, so not typically needed here, but doesnt hurt:
    this->setMsgProcessorModeOut( MsgProcessor::COMPRESS_IF_LARGE );
}
开发者ID:MechanisM,项目名称:tomahawk,代码行数:17,代码来源:dbsyncconnection.cpp

示例15: PlaylistView

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 ) ) );
    }
开发者ID:eartle,项目名称:tomahawk,代码行数:21,代码来源:CustomPlaylistView.cpp


注:本文中的source_ptr类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。