* Playlist model implementation
*************************************************************************/
-/*
- This model is called two times, for the selector and the standard panel
-*/
PLModel::PLModel( playlist_t *_p_playlist, /* THEPL */
intf_thread_t *_p_intf, /* main Qt p_intf */
playlist_item_t * p_root,
ADD_ICON( NODE, ":/type/node" );
#undef ADD_ICON
- rebuild( p_root, true );
+ rebuild( p_root );
CONNECT( THEMIM->getIM(), metaChanged( input_item_t *),
this, processInputItemUpdate( input_item_t *) );
CONNECT( THEMIM, inputChanged( input_thread_t * ),
void PLModel::rebuild()
{
- rebuild( NULL, false );
+ rebuild( NULL );
}
-void PLModel::rebuild( playlist_item_t *p_root, bool b_first )
+void PLModel::rebuild( playlist_item_t *p_root )
{
playlist_item_t* p_item;
void search( const QString& search_text );
void sort( int column, Qt::SortOrder order );
void sort( int i_root_id, int column, Qt::SortOrder order );
- void rebuild(); void rebuild( playlist_item_t *, bool b_first = false );
+ void rebuild();
+ void rebuild( playlist_item_t * );
inline PLItem *getItem( QModelIndex index ) const
{
else return rootItem;
}
-private:
+signals:
+ void currentChanged( const QModelIndex& );
+ void rootChanged();
+
+public slots:
+ void activateItem( const QModelIndex &index );
+ void activateItem( playlist_item_t *p_item );
+private:
/* General */
PLItem *rootItem;
playlist_t *p_playlist;
intf_thread_t *p_intf;
- int i_depth;
static QIcon icons[ITEM_TYPE_NUMBER];
- /* Actions */
- void recurseDelete( QList<PLItem*> children, QModelIndexList *fullList );
+ /* Shallow actions (do not affect core playlist) */
void updateTreeItem( PLItem * );
void removeItem ( PLItem * );
void removeItem( int );
+ void recurseDelete( QList<PLItem*> children, QModelIndexList *fullList );
void takeItem( PLItem * ); //will not delete item
void insertChildren( PLItem *node, QList<PLItem*>& items, int i_pos );
- void dropAppendCopy( QByteArray& data, PLItem *target );
- void dropMove( QByteArray& data, PLItem *target, int new_pos );
- /* The following actions will not signal the view! */
+ /* ...of which the following will not update the views */
void updateChildren( PLItem * );
void updateChildren( playlist_item_t *, PLItem * );
+ /* Deep actions (affect core playlist) */
+ void dropAppendCopy( QByteArray& data, PLItem *target );
+ void dropMove( QByteArray& data, PLItem *target, int new_pos );
+
/* Popup */
int i_popup_item, i_popup_parent, i_popup_column;
QModelIndexList current_selection;
PLItem *findById( PLItem *, int );
PLItem *findByInput( PLItem *, int );
PLItem *findInner( PLItem *, int , bool );
-
int columnFromMeta( int meta_column ) const;
int columnToMeta( int column ) const;
bool canEdit() const;
+
PLItem *p_cached_item;
PLItem *p_cached_item_bi;
int i_cached_id;
int i_cached_input_id;
-signals:
- void currentChanged( const QModelIndex& );
- void rootChanged();
-
-public slots:
- void activateItem( const QModelIndex &index );
- void activateItem( playlist_item_t *p_item );
-
private slots:
void popupPlay();
void popupDel();
void PLSelector::podcastRemove( PLSelItem* item )
{
- //FIXME will translators know to leave that %1 somewhere inside?
QString question ( qtr( "Do you really want to unsubscribe from %1?" ) );
question = question.arg( item->text() );
QMessageBox::StandardButton res =
QStyleOption option;
option.initFrom( this );
option.rect = rect.adjusted( rect.width() - indentation(), 0, 0, 0 );
-
- /*option.state = QStyle::State_Children;
- if( isExpanded( index ) ) option.state |= QStyle::State_Open;*/
style()->drawPrimitive( isExpanded( index ) ?
QStyle::PE_IndicatorArrowDown :
QStyle::PE_IndicatorArrowRight, &option, painter );
currentRootId = -1;
last_activated_id = -1;
- /* Title label */
- /*title = new QLabel;
- QFont titleFont;
- titleFont.setPointSize( titleFont.pointSize() + 6 );
- titleFont.setFamily( "Verdana" );
- title->setFont( titleFont );
- layout->addWidget( title, 0, 0 );*/
-
locationBar = new LocationBar( model );
layout->addWidget( locationBar, 0, 0 );
CONNECT( model, rootChanged(), locationBar, setRootIndex() );
{
if( currentView == iconView ) {
iconView->setRootIndex( index );
- //title->setText( index.data().toString() );
locationBar->setIndex( index );
}
}
playlist_Lock( THEPL );
playlist_item_t *p_item = playlist_ItemGetById( THEPL, model->itemId( index ) );
p_item->i_flags |= PLAYLIST_SUBITEM_STOP_FLAG;
- last_activated_id = p_item->p_input->i_id;//model->getItem( index )->inputItem()->i_id;
+ last_activated_id = p_item->p_input->i_id;
playlist_Unlock( THEPL );
model->activateItem( index );
}
{
QStyleOptionButton option;
option.initFrom( this );
- //option.rect = rect();
- //option.features = QStyleOptionButton::Flat;
option.state |= QStyle::State_Enabled;
- //option.state |= isChecked() ? QStyle::State_On : QStyle::State_Off;
- //if( isDown() ) option.state |= QStyle::State_Sunken;
QPainter p( this );
if( underMouse() )