Exemplo n.º 1
0
CollectionTreeItemModel::CollectionTreeItemModel( const QList<CategoryId::CatMenuId> &levelType )
    : CollectionTreeItemModelBase()
{
    m_rootItem = new CollectionTreeItem( this );
    CollectionManager *collMgr = CollectionManager::instance();
    connect( collMgr, SIGNAL(collectionAdded(Collections::Collection*)), this, SLOT(collectionAdded(Collections::Collection*)), Qt::QueuedConnection );
    connect( collMgr, SIGNAL(collectionRemoved(QString)), this, SLOT(collectionRemoved(QString)) );

    QList<Collections::Collection *> collections = CollectionManager::instance()->viewableCollections();
    foreach( Collections::Collection *coll, collections )
    {
        connect( coll, SIGNAL(updated()), this, SLOT(slotFilter()) ) ;
        m_collections.insert( coll->collectionId(), CollectionRoot( coll, new CollectionTreeItem( coll, m_rootItem, this ) ) );
    }
CollectionTreeItemModel::CollectionTreeItemModel( const QList<int> &levelType )
    : CollectionTreeItemModelBase()
{
    CollectionManager* collMgr = CollectionManager::instance();
    connect( collMgr, SIGNAL( collectionAdded( Collections::Collection* ) ), this, SLOT( collectionAdded( Collections::Collection* ) ), Qt::QueuedConnection );
    connect( collMgr, SIGNAL( collectionRemoved( QString ) ), this, SLOT( collectionRemoved( QString ) ) );
    //delete m_rootItem; //clears the whole tree!
    m_rootItem = new CollectionTreeItem( this );
    d->collections.clear();
    QList<Collections::Collection*> collections = CollectionManager::instance()->viewableCollections();
    foreach( Collections::Collection *coll, collections )
    {
        connect( coll, SIGNAL( updated() ), this, SLOT( slotFilter() ) ) ;
        d->collections.insert( coll->collectionId(), CollectionRoot( coll, new CollectionTreeItem( coll, m_rootItem, this ) ) );
    }
Exemplo n.º 3
0
    void
    PlaydarCollectionFactory::init()
    {
        DEBUG_BLOCK
        m_controller = new Playdar::Controller( this );
        connect( m_controller, SIGNAL(playdarReady()),
                 this, SLOT(playdarReady()) );
        connect( m_controller, SIGNAL(playdarError(Playdar::Controller::ErrorState)),
                 this, SLOT(slotPlaydarError(Playdar::Controller::ErrorState)) );
        checkStatus();

        m_collection = new PlaydarCollection;
        connect( m_collection.data(), SIGNAL(remove()), this, SLOT(collectionRemoved()) );
        CollectionManager::instance()->addTrackProvider( m_collection.data() );

        m_initialized = true;
    }
Exemplo n.º 4
0
    void
    PlaydarCollectionFactory::checkStatus()
    {
        m_controller->status();
    }


    void
    PlaydarCollectionFactory::playdarReady()
    {
        DEBUG_BLOCK

        if( !m_collection )
        {
            m_collection = new PlaydarCollection();
            connect( m_collection.data(), SIGNAL(remove()), this, SLOT(collectionRemoved()) );
        }

        if( !m_collectionIsManaged )
        {
            m_collectionIsManaged = true;
            emit newCollection( m_collection.data() );
        }
    }

    void
    PlaydarCollectionFactory::slotPlaydarError( Playdar::Controller::ErrorState error )
    {
        // DEBUG_BLOCK

        if( error == Playdar::Controller::ErrorState( 1 ) )