[vlc-commits] Qt4: restore search in SD
Jean-Baptiste Kempf
git at videolan.org
Wed Jan 11 18:43:38 CET 2012
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Wed Jan 11 18:42:09 2012 +0100| [d1902eb8d655d269f342d0562d0e63c1b0ab136d] | committer: Jean-Baptiste Kempf
Qt4: restore search in SD
Close #5545
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d1902eb8d655d269f342d0562d0e63c1b0ab136d
---
modules/gui/qt4/components/playlist/selector.cpp | 10 +++++++++-
modules/gui/qt4/components/playlist/selector.hpp | 5 +++--
.../gui/qt4/components/playlist/standardpanel.cpp | 12 ++++++++----
3 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/modules/gui/qt4/components/playlist/selector.cpp b/modules/gui/qt4/components/playlist/selector.cpp
index 820c69f..bef865a 100644
--- a/modules/gui/qt4/components/playlist/selector.cpp
+++ b/modules/gui/qt4/components/playlist/selector.cpp
@@ -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()
diff --git a/modules/gui/qt4/components/playlist/selector.hpp b/modules/gui/qt4/components/playlist/selector.hpp
index 21d2977..68db810 100644
--- a/modules/gui/qt4/components/playlist/selector.hpp
+++ b/modules/gui/qt4/components/playlist/selector.hpp
@@ -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:
diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp
index 979049f..db7f780 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.cpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.cpp
@@ -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 ) );
More information about the vlc-commits
mailing list