QByteArray encodedData;
QDataStream stream( &encodedData, QIODevice::WriteOnly );
- foreach( QModelIndex index, indexes ) {
+ foreach( const QModelIndex &index, indexes ) {
if( index.isValid() && index.column() == 0 )
stream << itemId( index );
}
PL_LOCK;
playlist_item_t *p_target =
- playlist_ItemGetById( p_playlist, targetItem->i_id,
- pl_Locked );
- playlist_item_t *p_src = playlist_ItemGetById( p_playlist, srcId,
- pl_Locked );
+ playlist_ItemGetById( p_playlist, targetItem->i_id );
+ playlist_item_t *p_src = playlist_ItemGetById( p_playlist, srcId );
if( !p_target || !p_src )
{
PLItem *parentItem = targetItem->parent();
assert( parentItem );
playlist_item_t *p_parent =
- playlist_ItemGetById( p_playlist, parentItem->i_id,
- pl_Locked );
+ playlist_ItemGetById( p_playlist, parentItem->i_id );
if( !p_parent )
{
PL_UNLOCK;
/* Some global changes happened -> Rebuild all */
var_AddCallback( p_playlist, "intf-change", PlaylistChanged, this );
/* We went to the next item */
- var_AddCallback( p_playlist, "playlist-current", PlaylistNext, this );
+ var_AddCallback( p_playlist, "item-current", PlaylistNext, this );
/* One item has been updated */
var_AddCallback( p_playlist, "item-change", ItemChanged, this );
- var_AddCallback( p_playlist, "item-append", ItemAppended, this );
- var_AddCallback( p_playlist, "item-deleted", ItemDeleted, this );
+ var_AddCallback( p_playlist, "playlist-item-append", ItemAppended, this );
+ var_AddCallback( p_playlist, "playlist-item-deleted", ItemDeleted, this );
}
void PLModel::delCallbacks()
{
var_DelCallback( p_playlist, "item-change", ItemChanged, this );
- var_DelCallback( p_playlist, "playlist-current", PlaylistNext, this );
+ var_DelCallback( p_playlist, "item-current", PlaylistNext, this );
var_DelCallback( p_playlist, "intf-change", PlaylistChanged, this );
- var_DelCallback( p_playlist, "item-append", ItemAppended, this );
- var_DelCallback( p_playlist, "item-deleted", ItemDeleted, this );
+ var_DelCallback( p_playlist, "playlist-item-append", ItemAppended, this );
+ var_DelCallback( p_playlist, "playlist-item-deleted", ItemDeleted, this );
}
void PLModel::activateItem( const QModelIndex &index )
PLItem *item = static_cast<PLItem*>(index.internalPointer());
assert( item );
PL_LOCK;
- playlist_item_t *p_item = playlist_ItemGetById( p_playlist, item->i_id,
- pl_Locked );
+ playlist_item_t *p_item = playlist_ItemGetById( p_playlist, item->i_id );
activateItem( p_item );
PL_UNLOCK;
}
PL_LOCK;
if( !nodeItem ) goto end;
- p_item = playlist_ItemGetById( p_playlist, p_add->i_item, pl_Locked );
+ p_item = playlist_ItemGetById( p_playlist, p_add->i_item );
if( !p_item || p_item->i_flags & PLAYLIST_DBL_FLAG ) goto end;
if( i_depth == DEPTH_SEL && p_item->p_parent &&
p_item->p_parent->i_id != rootItem->i_id )
assert( rootItem );
/* Recreate from root */
UpdateNodeChildren( rootItem );
- if( p_item=playlist_CurrentPlayingItem(p_playlist) )
+ if( (p_item = playlist_CurrentPlayingItem(p_playlist)) )
{
PLItem *currentItem = FindByInput( rootItem,
p_item->p_input->i_id );
/* This function must be entered WITH the playlist lock */
void PLModel::UpdateNodeChildren( PLItem *root )
{
- playlist_item_t *p_node = playlist_ItemGetById( p_playlist, root->i_id,
- pl_Locked );
+ playlist_item_t *p_node = playlist_ItemGetById( p_playlist, root->i_id );
UpdateNodeChildren( p_node, root );
}
/* This function must be entered WITH the playlist lock */
void PLModel::UpdateTreeItem( PLItem *item, bool signal, bool force )
{
- playlist_item_t *p_item = playlist_ItemGetById( p_playlist, item->i_id,
- pl_Locked );
+ playlist_item_t *p_item = playlist_ItemGetById( p_playlist, item->i_id );
UpdateTreeItem( p_item, item, signal, force );
}
fullList->removeAll( deleteIndex );
PL_LOCK;
- playlist_item_t *p_item = playlist_ItemGetById( p_playlist, item->i_id,
- pl_Locked );
+ playlist_item_t *p_item = playlist_ItemGetById( p_playlist, item->i_id );
if( !p_item )
{
- PL_UNLOCK; return;
+ PL_UNLOCK;
+ return;
}
if( p_item->i_children == -1 )
playlist_DeleteFromInput( p_playlist, item->i_input_id, pl_Locked );
int i_index = -1;
int i_flag = 0;
- // FIXME: Disable sorting on startup by ignoring
- // first call of sorting caused by showing dialog
- // see: standardpanel.cpp:65
- static bool b_first_time = true;
- if( b_first_time )
- {
- b_first_time = false;
- return;
- }
-
int i_column = 1;
for( i_column = 1; i_column != COLUMN_END; i_column<<=1 )
{
PL_LOCK;
{
playlist_item_t *p_root = playlist_ItemGetById( p_playlist,
- rootItem->i_id,
- pl_Locked );
+ rootItem->i_id );
if( p_root )
{
playlist_RecursiveNodeSort( p_playlist, p_root,
PL_LOCK;
{
playlist_item_t *p_root = playlist_ItemGetById( p_playlist,
- rootItem->i_id,
- pl_Locked );
+ rootItem->i_id );
assert( p_root );
char *psz_name = search_text.toUtf8().data();
playlist_LiveSearchUpdate( p_playlist , p_root, psz_name );
{
assert( index.isValid() );
PL_LOCK;
- playlist_item_t *p_item = playlist_ItemGetById( p_playlist,
- itemId( index ), pl_Locked );
+ playlist_item_t *p_item = playlist_ItemGetById( p_playlist, itemId( index ) );
if( p_item )
{
i_popup_item = p_item->i_id;
PL_UNLOCK;
current_selection = list;
QMenu *menu = new QMenu;
- menu->addAction( qfu(I_POP_PLAY), this, SLOT( popupPlay() ) );
- menu->addAction( qfu(I_POP_DEL), this, SLOT( popupDel() ) );
+ menu->addAction( qtr(I_POP_PLAY), this, SLOT( popupPlay() ) );
+ menu->addAction( qtr(I_POP_DEL), this, SLOT( popupDel() ) );
menu->addSeparator();
- menu->addAction( qfu(I_POP_STREAM), this, SLOT( popupStream() ) );
- menu->addAction( qfu(I_POP_SAVE), this, SLOT( popupSave() ) );
+ menu->addAction( qtr(I_POP_STREAM), this, SLOT( popupStream() ) );
+ menu->addAction( qtr(I_POP_SAVE), this, SLOT( popupSave() ) );
menu->addSeparator();
- menu->addAction( qfu(I_POP_INFO), this, SLOT( popupInfo() ) );
+ menu->addAction( qtr(I_POP_INFO), this, SLOT( popupInfo() ) );
if( p_item->i_children > -1 )
{
menu->addSeparator();
- menu->addAction( qfu(I_POP_SORT), this, SLOT( popupSort() ) );
- menu->addAction( qfu(I_POP_ADD), this, SLOT( popupAdd() ) );
+ menu->addAction( qtr(I_POP_SORT), this, SLOT( popupSort() ) );
+ menu->addAction( qtr(I_POP_ADD), this, SLOT( popupAdd() ) );
}
menu->addSeparator();
- menu->addAction( qfu( I_POP_EXPLORE ), this, SLOT( popupExplore() ) );
+ menu->addAction( qtr( I_POP_EXPLORE ), this, SLOT( popupExplore() ) );
menu->popup( point );
}
else
PL_LOCK;
{
playlist_item_t *p_item = playlist_ItemGetById( p_playlist,
- i_popup_item,
- pl_Locked );
+ i_popup_item );
activateItem( p_item );
}
PL_UNLOCK;
void PLModel::popupInfo()
{
+ PL_LOCK;
playlist_item_t *p_item = playlist_ItemGetById( p_playlist,
- i_popup_item,
- pl_Unlocked );
+ i_popup_item );
if( p_item )
{
- MediaInfoDialog *mid = new MediaInfoDialog( p_intf, p_item->p_input );
+ input_item_t* p_input = p_item->p_input;
+ vlc_gc_incref( p_input );
+ PL_UNLOCK;
+ MediaInfoDialog *mid = new MediaInfoDialog( p_intf, p_input );
+ vlc_gc_decref( p_input );
mid->setParent( PlaylistDialog::getInstance( p_intf ),
Qt::Dialog );
mid->show();
#include <QDesktopServices>
void PLModel::popupExplore()
{
+ PL_LOCK;
playlist_item_t *p_item = playlist_ItemGetById( p_playlist,
- i_popup_item,
- pl_Unlocked );
+ i_popup_item );
if( p_item )
{
input_item_t *p_input = p_item->p_input;
char *psz_meta = input_item_GetURI( p_input );
+ PL_UNLOCK;
if( psz_meta )
{
const char *psz_access;
free( psz_meta );
}
}
+ else
+ PL_UNLOCK;
}
/**********************************************************************
{
PLModel *p_model = (PLModel *) param;
PLEvent *event = new PLEvent( PLUpdate_Type, 0 );
- QApplication::postEvent( p_model, static_cast<QEvent*>(event) );
+ QApplication::postEvent( p_model, event );
return VLC_SUCCESS;
}
{
PLModel *p_model = (PLModel *) param;
PLEvent *event = new PLEvent( ItemUpdate_Type, oval.i_int );
- QApplication::postEvent( p_model, static_cast<QEvent*>(event) );
+ QApplication::postEvent( p_model, event );
event = new PLEvent( ItemUpdate_Type, nval.i_int );
- QApplication::postEvent( p_model, static_cast<QEvent*>(event) );
+ QApplication::postEvent( p_model, event );
return VLC_SUCCESS;
}
{
PLModel *p_model = (PLModel *) param;
PLEvent *event = new PLEvent( ItemUpdate_Type, nval.i_int );
- QApplication::postEvent( p_model, static_cast<QEvent*>(event) );
+ QApplication::postEvent( p_model, event );
return VLC_SUCCESS;
}
{
PLModel *p_model = (PLModel *) param;
PLEvent *event = new PLEvent( ItemDelete_Type, nval.i_int );
- QApplication::postEvent( p_model, static_cast<QEvent*>(event) );
+ QApplication::postEvent( p_model, event );
return VLC_SUCCESS;
}
memcpy( p_add, nval.p_address, sizeof( playlist_add_t ) );
PLEvent *event = new PLEvent( p_add );
- QApplication::postEvent( p_model, static_cast<QEvent*>(event) );
+ QApplication::postEvent( p_model, event );
return VLC_SUCCESS;
}