Commit 1950858c authored by Ilkka Ollakka's avatar Ilkka Ollakka

Qt4: remove i_input_id from PLItem

parent 79980287
...@@ -52,7 +52,6 @@ void PLItem::init( playlist_item_t *_playlist_item, PLItem *parent, PLModel *m, ...@@ -52,7 +52,6 @@ void PLItem::init( playlist_item_t *_playlist_item, PLItem *parent, PLModel *m,
{ {
parentItem = parent; /* Can be NULL, but only for the rootItem */ parentItem = parent; /* Can be NULL, but only for the rootItem */
i_id = _playlist_item->i_id; /* Playlist item specific id */ i_id = _playlist_item->i_id; /* Playlist item specific id */
i_input_id = _playlist_item->p_input->i_id; /* Identifier of the input */
model = m; /* PLModel (QAbsmodel) */ model = m; /* PLModel (QAbsmodel) */
i_type = -1; /* Item type - Avoid segfault */ i_type = -1; /* Item type - Avoid segfault */
b_current = false; /* Is the item the current Item or not */ b_current = false; /* Is the item the current Item or not */
...@@ -142,7 +141,7 @@ int PLItem::row() const ...@@ -142,7 +141,7 @@ int PLItem::row() const
/* update the PL Item, get the good names and so on */ /* update the PL Item, get the good names and so on */
void PLItem::update( playlist_item_t *p_item, bool iscurrent ) void PLItem::update( playlist_item_t *p_item, bool iscurrent )
{ {
assert( p_item->p_input->i_id == i_input_id ); assert( p_item->p_input == p_input);
/* Useful for the model */ /* Useful for the model */
i_type = p_item->p_input->i_type; i_type = p_item->p_input->i_type;
......
...@@ -66,7 +66,6 @@ protected: ...@@ -66,7 +66,6 @@ protected:
bool b_current; bool b_current;
int i_type; int i_type;
int i_id; int i_id;
int i_input_id;
int i_showflags; int i_showflags;
bool b_is_node; bool b_is_node;
input_item_t *p_input; input_item_t *p_input;
......
...@@ -121,21 +121,21 @@ Qt::ItemFlags PLModel::flags( const QModelIndex &index ) const ...@@ -121,21 +121,21 @@ Qt::ItemFlags PLModel::flags( const QModelIndex &index ) const
static_cast<PLItem*>( index.internalPointer() ) : static_cast<PLItem*>( index.internalPointer() ) :
rootItem; rootItem;
int pl_input_id = p_playlist->p_local_category->p_input->i_id; input_item_t *pl_input = p_playlist->p_local_category->p_input;
int ml_input_id = p_playlist->p_ml_category->p_input->i_id; input_item_t *ml_input = p_playlist->p_ml_category->p_input;
if( rootItem->i_id == p_playlist->p_root_onelevel->i_id if( rootItem->i_id == p_playlist->p_root_onelevel->i_id
|| rootItem->i_id == p_playlist->p_root_category->i_id ) || rootItem->i_id == p_playlist->p_root_category->i_id )
{ {
if( item->i_input_id == pl_input_id if( item->p_input == pl_input
|| item->i_input_id == ml_input_id ) || item->p_input == ml_input)
flags |= Qt::ItemIsDropEnabled; flags |= Qt::ItemIsDropEnabled;
} }
else else
{ {
if ( item->b_is_node && if ( item->b_is_node &&
( rootItem->i_input_id == pl_input_id || ( rootItem->p_input == pl_input ||
rootItem->i_input_id == ml_input_id ) ) rootItem->p_input == ml_input ) )
flags |= Qt::ItemIsDropEnabled; flags |= Qt::ItemIsDropEnabled;
flags |= Qt::ItemIsDragEnabled; flags |= Qt::ItemIsDragEnabled;
} }
...@@ -561,7 +561,8 @@ PLItem *PLModel::FindById( PLItem *root, int i_id ) ...@@ -561,7 +561,8 @@ PLItem *PLModel::FindById( PLItem *root, int i_id )
PLItem *PLModel::FindByInput( PLItem *root, int i_id ) PLItem *PLModel::FindByInput( PLItem *root, int i_id )
{ {
return FindInner( root, i_id, true ); PLItem *result = FindInner( root, i_id, true );
return result;
} }
#define CACHE( i, p ) { i_cached_id = i; p_cached_item = p; } #define CACHE( i, p ) { i_cached_id = i; p_cached_item = p; }
...@@ -580,7 +581,7 @@ PLItem * PLModel::FindInner( PLItem *root, int i_id, bool b_input ) ...@@ -580,7 +581,7 @@ PLItem * PLModel::FindInner( PLItem *root, int i_id, bool b_input )
CACHE( i_id, root ); CACHE( i_id, root );
return root; return root;
} }
else if( b_input && root->i_input_id == i_id ) else if( b_input && root->p_input->i_id == i_id )
{ {
ICACHE( i_id, root ); ICACHE( i_id, root );
return root; return root;
...@@ -594,7 +595,7 @@ PLItem * PLModel::FindInner( PLItem *root, int i_id, bool b_input ) ...@@ -594,7 +595,7 @@ PLItem * PLModel::FindInner( PLItem *root, int i_id, bool b_input )
CACHE( i_id, (*it) ); CACHE( i_id, (*it) );
return p_cached_item; return p_cached_item;
} }
else if( b_input && (*it)->i_input_id == i_id ) else if( b_input && (*it)->p_input->i_id == i_id )
{ {
ICACHE( i_id, (*it) ); ICACHE( i_id, (*it) );
return p_cached_item_bi; return p_cached_item_bi;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment