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

Qt4: restore search in SD

Close #5545
parent cedc46ea
......@@ -278,7 +278,14 @@ void PLSelector::setSource( QTreeWidgetItem *item )
QString qs = item->data( 0, NAME_ROLE ).toString();
sd_loaded = playlist_IsServicesDiscoveryLoaded( THEPL, qtu( qs ) );
if( !sd_loaded )
{
playlist_ServicesDiscoveryAdd( THEPL, qtu( qs ) );
services_discovery_descriptor_t *p_test = new services_discovery_descriptor_t;
playlist_ServicesDiscoveryControl( THEPL, qtu( qs ), SD_CMD_DESCRIPTOR, p_test );
if( p_test->i_capabilities & SD_CAP_SEARCH )
item->setData( 0, CAP_SEARCH_ROLE, true );
}
}
#ifdef MEDIA_LIBRARY
else if( i_type == SQL_ML_TYPE )
......@@ -528,10 +535,11 @@ void PLSelector::drawBranches ( QPainter * painter, const QRect & rect, const QM
QStyle::PE_IndicatorArrowRight, &option, painter );
}
void PLSelector::getCurrentSelectedItem( int* type, QString *string)
void PLSelector::getCurrentItemInfos( int* type, bool* can_delay_search, QString *string)
{
*type = currentItem()->data( 0, TYPE_ROLE ).toInt();
*string = currentItem()->data( 0, NAME_ROLE ).toString();
*can_delay_search = currentItem()->data( 0, CAP_SEARCH_ROLE ).toBool();
}
int PLSelector::getCurrentItemCategory()
......
......@@ -60,7 +60,8 @@ enum {
PL_ITEM_ROLE, //playlist_item_t*
PL_ITEM_ID_ROLE, //playlist_item_t->i_id
IN_ITEM_ROLE, //input_item_t->i_id
SPECIAL_ROLE //SpecialData
SPECIAL_ROLE, //SpecialData
CAP_SEARCH_ROLE,
};
enum ItemAction {
......@@ -116,7 +117,7 @@ public:
PLSelector( QWidget *p, intf_thread_t *_p_intf );
virtual ~PLSelector();
void getCurrentSelectedItem( int *type, QString *name );
void getCurrentItemInfos( int *type, bool *delayedSearch, QString *name );
int getCurrentItemCategory();
protected:
......
......@@ -151,8 +151,10 @@ void StandardPLPanel::search( const QString& searchText )
{
int type;
QString name;
p_selector->getCurrentSelectedItem( &type, &name );
if( type != SD_TYPE )
bool can_search;
p_selector->getCurrentItemInfos( &type, &can_search, &name );
if( type != SD_TYPE || !can_search )
{
bool flat = ( currentView == iconView ||
currentView == listView ||
......@@ -167,10 +169,12 @@ void StandardPLPanel::searchDelayed( const QString& searchText )
{
int type;
QString name;
p_selector->getCurrentSelectedItem( &type, &name );
bool can_search;
p_selector->getCurrentItemInfos( &type, &can_search, &name );
if( type == SD_TYPE )
if( type == SD_TYPE && can_search )
{
msg_Err( p_intf, "SEARCHING DELAYED");
if( !name.isEmpty() && !searchText.isEmpty() )
playlist_ServicesDiscoveryControl( THEPL, qtu( name ), SD_CMD_SEARCH,
qtu( searchText ) );
......
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