bool VLCProxyModel::switchToModel( models type ) { VLCModel *previousModel = model(); VLCModel *newModel = sourcemodels[ type ]; if ( ! newModel /*|| newModel == previousModel*/ ) return false; setSourceModel( newModel ); if ( previousModel ) { /* First disconnect previous signals */ disconnect( previousModel->sigs, SIGNAL( currentIndexChanged(const QModelIndex&) ), this, SIGNAL( currentIndexChanged_IndexConversion(const QModelIndex&) ) ); disconnect( previousModel->sigs, SIGNAL( rootIndexChanged() ), this->sigs, SIGNAL( rootIndexChanged() ) ); } /* wire to propagate sourceModel's signals */ connect( model()->sigs, SIGNAL( currentIndexChanged(const QModelIndex&) ), this, SLOT( currentIndexChanged_IndexConversion(const QModelIndex&) ) ); connect( model()->sigs, SIGNAL( rootIndexChanged() ), this->sigs, SIGNAL( rootIndexChanged() ) ); return true; }
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 ); }
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 emit_rootIndexChanged() { emit rootIndexChanged(); }