Exemple #1
0
Tomahawk::ViewPage*
ViewManager::show( const Tomahawk::collection_ptr& collection )
{
    m_currentCollection = collection;

    TreeWidget* widget;
    if ( !m_treeWidgets.contains( collection ) || m_treeWidgets.value( collection ).isNull() )
    {
        widget = new TreeWidget();
        widget->view()->proxyModel()->setStyle( PlayableProxyModel::Collection );
        TreeModel* model = new TreeModel();
        widget->view()->setTreeModel( model );

        if ( !collection.isNull() )
            widget->view()->setEmptyTip( collection->emptyText() );

        model->addCollection( collection );

        m_treeWidgets.insert( collection, widget );
    }
    else
    {
        widget = m_treeWidgets.value( collection ).data();
    }

    setPage( widget );
    return widget;
}
void
CollectionViewPage::onCollectionChanged()
{
    TreeModel* model = new TreeModel();
    PlayableModel* flatModel = new PlayableModel();
    PlayableModel* albumModel = new PlayableModel();

    setTreeModel( model );
    setFlatModel( flatModel );
    setAlbumModel( albumModel );

    model->addCollection( m_collection );
    flatModel->appendTracks( m_collection );
    albumModel->appendAlbums( m_collection );

    if ( m_collection && m_collection->source() && m_collection->source()->isLocal() )
    {
        setEmptyTip( tr( "After you have scanned your music collection you will find your tracks right here." ) );
    }
    else
        setEmptyTip( tr( "This collection is empty." ) );

    if ( m_collection.objectCast<ScriptCollection>() )
        m_trackView->setEmptyTip( tr( "Cloud collections aren't supported in the flat view yet. We will have them covered soon. Switch to another view to navigate them." ) );
}
Exemple #3
0
Tomahawk::ViewPage*
ViewManager::show( const Tomahawk::collection_ptr& collection )
{
    m_currentCollection = collection;

    FlexibleTreeView* view;
    if ( !m_collectionViews.contains( collection ) || m_collectionViews.value( collection ).isNull() )
    {
        view = new FlexibleTreeView();

        view->columnView()->proxyModel()->setStyle( PlayableProxyModel::Collection );
        TreeModel* model = new TreeModel();

        view->setTreeModel( model );

        model->addCollection( collection );
        setPage( view );

        if ( !collection.isNull() )
            view->setEmptyTip( collection->emptyText() );

        m_collectionViews.insert( collection, view );
    }
    else
    {
        view = m_collectionViews.value( collection ).data();
    }
    view->restoreViewMode();

    setPage( view );
    return view;
}
Exemple #4
0
Tomahawk::ViewPage*
ViewManager::show( const Tomahawk::collection_ptr& collection )
{
    m_currentCollection = collection;

    TreeView* view;
    if ( !m_treeViews.contains( collection ) || m_treeViews.value( collection ).isNull() )
    {
        view = new TreeView();
        view->proxyModel()->setStyle( PlayableProxyModel::Collection );
        TreeModel* model = new TreeModel();
        view->setTreeModel( model );

        if ( collection && collection->source()->isLocal() )
            view->setEmptyTip( tr( "After you have scanned your music collection you will find your tracks right here." ) );
        else
            view->setEmptyTip( tr( "This collection is empty." ) );

        model->addCollection( collection );

        m_treeViews.insert( collection, view );
    }
    else
    {
        view = m_treeViews.value( collection ).data();
    }

    setPage( view );
    return view;
}
void
CollectionViewPage::onCollectionChanged()
{
    TreeModel* model = new TreeModel();
    PlayableModel* flatModel = new PlayableModel();
    PlayableModel* albumModel = new PlayableModel();

    setTreeModel( model );
    setFlatModel( flatModel );
    setAlbumModel( albumModel );

    model->addCollection( m_collection );
    flatModel->appendTracks( m_collection );
    albumModel->appendAlbums( m_collection );

    if ( m_collection && m_collection->isLocal() )
    {
        setEmptyTip( tr( "After you have scanned your music collection you will find your tracks right here." ) );
    }
    else
        setEmptyTip( tr( "This collection is empty." ) );
}
Exemple #6
0
Tomahawk::ViewPage*
ViewManager::show( const Tomahawk::collection_ptr& collection )
{
    qDebug() << Q_FUNC_INFO << m_currentMode;
    m_currentCollection = collection;
    ViewPage* shown = 0;
    if ( m_currentMode == PlaylistModes::Flat )
    {
/*        CollectionView* view;
        if ( !m_collectionViews.contains( collection ) || m_collectionViews.value( collection ).isNull() )
        {
            view = new CollectionView();
            CollectionFlatModel* model = new CollectionFlatModel();
            view->setPlayableModel( model );

            model->addCollection( collection );

            m_collectionViews.insert( collection, view );
        }
        else
        {
            view = m_collectionViews.value( collection ).data();
        }

        shown = view;
        setPage( view );*/
    }

    if ( m_currentMode == PlaylistModes::Tree )
    {
        TreeView* view;
        if ( !m_treeViews.contains( collection ) || m_treeViews.value( collection ).isNull() )
        {
            view = new TreeView();
            TreeModel* model = new TreeModel();
            view->setTreeModel( model );

            if ( collection && collection->source()->isLocal() )
                view->setEmptyTip( tr( "After you have scanned your music collection you will find your tracks right here." ) );
            else
                view->setEmptyTip( tr( "This collection is empty." ) );

            model->addCollection( collection );

            m_treeViews.insert( collection, view );
        }
        else
        {
            view = m_treeViews.value( collection ).data();
        }

        shown = view;
        setPage( view );
    }

    if ( m_currentMode == PlaylistModes::Album )
    {
        GridView* aview;
        if ( !m_collectionGridViews.contains( collection ) || m_collectionGridViews.value( collection ).isNull() )
        {
            aview = new GridView();
            AlbumModel* amodel = new AlbumModel( aview );
            aview->setPlayableModel( amodel );
            amodel->addCollection( collection );

            m_collectionGridViews.insert( collection, aview );
        }
        else
        {
            aview = m_collectionGridViews.value( collection ).data();
        }

        shown = aview;
        setPage( aview );
    }

    emit numSourcesChanged( 1 );

    return shown;
}
Exemple #7
0
Tomahawk::ViewPage*
ViewManager::show( const Tomahawk::collection_ptr& collection )
{
    qDebug() << Q_FUNC_INFO << m_currentMode;
    m_currentCollection = collection;
    ViewPage* shown = 0;
    if ( m_currentMode == PlaylistInterface::Flat )
    {
        CollectionView* view;
        if ( !m_collectionViews.contains( collection ) )
        {
            view = new CollectionView();
            CollectionFlatModel* model = new CollectionFlatModel();
            view->setTrackModel( model );
            view->setFrameShape( QFrame::NoFrame );
            view->setAttribute( Qt::WA_MacShowFocusRect, 0 );

            model->addCollection( collection );

            m_collectionViews.insert( collection, view );
        }
        else
        {
            view = m_collectionViews.value( collection );
        }

        shown = view;
        setPage( view );
    }

    if ( m_currentMode == PlaylistInterface::Tree )
    {
        ArtistView* view;
        if ( !m_treeViews.contains( collection ) )
        {
            view = new ArtistView();
            TreeModel* model = new TreeModel();
            view->setTreeModel( model );
            view->setFrameShape( QFrame::NoFrame );
            view->setAttribute( Qt::WA_MacShowFocusRect, 0 );

            model->addCollection( collection );

            m_treeViews.insert( collection, view );
        }
        else
        {
            view = m_treeViews.value( collection );
        }

        shown = view;
        setPage( view );
    }

    if ( m_currentMode == PlaylistInterface::Album )
    {
        AlbumView* aview;
        if ( !m_collectionAlbumViews.contains( collection ) )
        {
            aview = new AlbumView();
            AlbumModel* amodel = new AlbumModel( aview );
            aview->setAlbumModel( amodel );
            aview->setFrameShape( QFrame::NoFrame );
            aview->setAttribute( Qt::WA_MacShowFocusRect, 0 );
            amodel->addCollection( collection );

            m_collectionAlbumViews.insert( collection, aview );
        }
        else
        {
            aview = m_collectionAlbumViews.value( collection );
        }

        shown = aview;
        setPage( aview );
    }

    emit numSourcesChanged( 1 );

    return shown;
}