Commit ace7419f authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: reuse the SD data

When reloading, correctly update the view.
parent 4bc32868
...@@ -77,25 +77,30 @@ void PLSelector::setSource( QTreeWidgetItem *item ) ...@@ -77,25 +77,30 @@ void PLSelector::setSource( QTreeWidgetItem *item )
int i_type = item->data( 0, Qt::UserRole ).toInt(); int i_type = item->data( 0, Qt::UserRole ).toInt();
assert( ( i_type == PL_TYPE || i_type == ML_TYPE || i_type == SD_TYPE ) );
if( i_type == SD_TYPE ) if( i_type == SD_TYPE )
{ {
QString qs = item->data( 0, Qt::UserRole + 1 ).toString(); QString qs = item->data( 0, Qt::UserRole + 2 ).toString();
if( !playlist_IsServicesDiscoveryLoaded( THEPL, qtu( qs ) ) ) if( !playlist_IsServicesDiscoveryLoaded( THEPL, qtu( qs ) ) )
{ {
playlist_ServicesDiscoveryAdd( THEPL, qtu( qs ) ); playlist_ServicesDiscoveryAdd( THEPL, qtu( qs ) );
#warning FIXME #warning FIXME
emit activated( THEPL->p_root_category->pp_children[THEPL->p_root_category->i_children-1] ); playlist_item_t *pl_item =
THEPL->p_root_category->pp_children[THEPL->p_root_category->i_children-1];
item->setData( 0, Qt::UserRole + 1, QVariant::fromValue( pl_item ) );
emit activated( pl_item );
return;
} }
} }
else if( i_type == PL_TYPE || i_type == ML_TYPE )
{ if( i_type == SD_TYPE )
playlist_item_t *pl_item = msg_Dbg( p_intf, "SD already loaded, reloading" );
item->data( 0, Qt::UserRole + 1 ).value<playlist_item_t *>();
if( pl_item ) playlist_item_t *pl_item =
item->data( 0, Qt::UserRole + 1 ).value<playlist_item_t *>();
if( pl_item )
emit activated( pl_item ); emit activated( pl_item );
}
else
assert( 0 );
} }
void PLSelector::createItems() void PLSelector::createItems()
...@@ -132,7 +137,7 @@ void PLSelector::createItems() ...@@ -132,7 +137,7 @@ void PLSelector::createItems()
{ {
sd_item = new QTreeWidgetItem( QStringList( *ppsz_longname ) ); sd_item = new QTreeWidgetItem( QStringList( *ppsz_longname ) );
sd_item->setData( 0, Qt::UserRole, SD_TYPE ); sd_item->setData( 0, Qt::UserRole, SD_TYPE );
sd_item->setData( 0, Qt::UserRole + 1, qfu( *ppsz_name ) ); sd_item->setData( 0, Qt::UserRole + 2, qfu( *ppsz_name ) );
sds->addChild( sd_item ); sds->addChild( sd_item );
} }
} }
......
...@@ -344,4 +344,3 @@ StandardPLPanel::~StandardPLPanel() ...@@ -344,4 +344,3 @@ StandardPLPanel::~StandardPLPanel()
getSettings()->endGroup(); getSettings()->endGroup();
} }
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