void StandardPLPanel::handleExpansion( const QModelIndex& index ) { assert( currentView ); if( currentRootIndexPLId != -1 && currentRootIndexPLId != model->itemId( index.parent(), PLAYLIST_ID ) ) browseInto( index.parent() ); currentView->scrollTo( index ); }
void StandardPLPanel::showView( int i_view ) { switch( i_view ) { case TREE_VIEW: { if( treeView == NULL ) createTreeView(); currentView = treeView; break; } case ICON_VIEW: { if( iconView == NULL ) createIconView(); currentView = iconView; break; } case LIST_VIEW: { if( listView == NULL ) createListView(); currentView = listView; break; } default: return; } viewStack->setCurrentWidget( currentView ); viewActions[i_view]->setChecked( true ); browseInto(); gotoPlayingItem(); }
void StandardPLPanel::browseInto( input_item_t *p_input ) { if( p_input->i_id != lastActivatedId ) return; playlist_Lock( THEPL ); playlist_item_t *p_item = playlist_ItemGetByInput( THEPL, p_input ); if( !p_item ) { playlist_Unlock( THEPL ); return; } QModelIndex index = model->index( p_item->i_id, 0 ); playlist_Unlock( THEPL ); if( currentView == treeView ) treeView->setExpanded( index, true ); else browseInto( index ); lastActivatedId = -1; }
void StandardPLPanel::browseInto( int i_id ) { if( i_id != lastActivatedId ) return; QModelIndex index = model->index( i_id, 0 ); playlist_Unlock( THEPL ); if( currentView == treeView ) treeView->setExpanded( index, true ); else browseInto( index ); lastActivatedId = -1; }
StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent, intf_thread_t *_p_intf, playlist_item_t *p_root, PLSelector *_p_selector, VLCModel *_p_model ) : QWidget( _parent ), model( _p_model ), p_intf( _p_intf ), p_selector( _p_selector ) { viewStack = new QStackedLayout( this ); viewStack->setSpacing( 0 ); viewStack->setMargin( 0 ); setMinimumWidth( 300 ); iconView = NULL; treeView = NULL; listView = NULL; picFlowView = NULL; currentRootIndexPLId = -1; lastActivatedPLItemId = -1; QList<QString> frames; frames << ":/util/wait1"; frames << ":/util/wait2"; frames << ":/util/wait3"; frames << ":/util/wait4"; spinnerAnimation = new PixmapAnimator( this, frames ); CONNECT( spinnerAnimation, pixmapReady( const QPixmap & ), this, updateViewport() ); /* Saved Settings */ int i_savedViewMode = getSettings()->value( "Playlist/view-mode", TREE_VIEW ).toInt(); QFont font = QApplication::font(); font.setPointSize( font.pointSize() + getSettings()->value( "Playlist/zoom", 0 ).toInt() ); model->setData( QModelIndex(), font, Qt::FontRole ); showView( i_savedViewMode ); DCONNECT( THEMIM, leafBecameParent( int ), this, browseInto( int ) ); CONNECT( model, currentIndexChanged( const QModelIndex& ), this, handleExpansion( const QModelIndex& ) ); CONNECT( model, rootIndexChanged(), this, browseInto() ); setRootItem( p_root, false ); }
void StandardPLPanel::activate( const QModelIndex &index ) { if( !index.data( PLModel::IsLeafNodeRole ).toBool() ) { if( currentView != treeView ) browseInto( index ); } else { playlist_Lock( THEPL ); playlist_item_t *p_item = playlist_ItemGetById( THEPL, model->itemId( index ) ); p_item->i_flags |= PLAYLIST_SUBITEM_STOP_FLAG; lastActivatedId = p_item->p_input->i_id; playlist_Unlock( THEPL ); model->activateItem( index ); } }
void StandardPLPanel::showView( int i_view ) { switch( i_view ) { case ICON_VIEW: { if( iconView == NULL ) createIconView(); currentView = iconView; break; } case LIST_VIEW: { if( listView == NULL ) createListView(); currentView = listView; break; } case PICTUREFLOW_VIEW: { if( picFlowView == NULL ) createCoverView(); currentView = picFlowView; break; } default: case TREE_VIEW: { if( treeView == NULL ) createTreeView(); currentView = treeView; break; } } changeModel( false ); viewStack->setCurrentWidget( currentView ); browseInto(); gotoPlayingItem(); }
StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent, intf_thread_t *_p_intf, playlist_item_t *p_root, PLSelector *_p_selector, PLModel *_p_model, MLModel *_p_plmodel) : QWidget( _parent ), model( _p_model ), mlmodel( _p_plmodel), p_intf( _p_intf ), p_selector( _p_selector ) { viewStack = new QStackedLayout( this ); viewStack->setSpacing( 0 ); viewStack->setMargin( 0 ); setMinimumWidth( 300 ); iconView = NULL; treeView = NULL; listView = NULL; picFlowView = NULL; currentRootIndexId = -1; lastActivatedId = -1; /* Saved Settings */ int i_savedViewMode = getSettings()->value( "Playlist/view-mode", TREE_VIEW ).toInt(); i_zoom = getSettings()->value( "Playlist/zoom", 0 ).toInt(); showView( i_savedViewMode ); DCONNECT( THEMIM, leafBecameParent( int ), this, browseInto( int ) ); CONNECT( model, currentIndexChanged( const QModelIndex& ), this, handleExpansion( const QModelIndex& ) ); CONNECT( model, rootIndexChanged(), this, browseInto() ); setRootItem( p_root, false ); }
void StandardPLPanel::browseInto( ) { browseInto( currentRootIndexId != -1 && currentView != treeView ? model->index( currentRootIndexId, 0 ) : QModelIndex() ); }
void StandardPLPanel::handleRootChange() { browseInto(); }
void StandardPLPanel::showView( int i_view ) { bool b_treeViewCreated = false; switch( i_view ) { case ICON_VIEW: { if( iconView == NULL ) createIconView(); currentView = iconView; break; } case LIST_VIEW: { if( listView == NULL ) createListView(); currentView = listView; break; } case PICTUREFLOW_VIEW: { if( picFlowView == NULL ) createCoverView(); currentView = picFlowView; break; } default: case TREE_VIEW: { if( treeView == NULL ) { createTreeView(); b_treeViewCreated = true; } currentView = treeView; break; } } changeModel( false ); /* Restoring the header Columns must come after changeModel */ if( b_treeViewCreated ) { assert( treeView ); if( getSettings()->contains( "Playlist/headerStateV2" ) ) { treeView->header()->restoreState(getSettings() ->value( "Playlist/headerStateV2" ).toByteArray() ); /* if there is allready stuff in playlist, we don't sort it and we reset sorting */ if( model->rowCount() ) { treeView->header()->setSortIndicator( -1 , Qt::AscendingOrder ); } } else { for( int m = 1, c = 0; m != COLUMN_END; m <<= 1, c++ ) { treeView->setColumnHidden( c, !( m & COLUMN_DEFAULT ) ); if( m == COLUMN_TITLE ) treeView->header()->resizeSection( c, 200 ); else if( m == COLUMN_DURATION ) treeView->header()->resizeSection( c, 80 ); } } } viewStack->setCurrentWidget( currentView ); browseInto(); gotoPlayingItem(); }