[vlc-commits] commit: Qt: search the SD if possible. (Jean-Baptiste Kempf )
git at videolan.org
git at videolan.org
Sat Oct 23 01:01:17 CEST 2010
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Fri Oct 22 17:30:21 2010 +0200| [7310bac28eabdc58eb07a86fcd75416df04ebbb4] | committer: Jean-Baptiste Kempf
Qt: search the SD if possible.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7310bac28eabdc58eb07a86fcd75416df04ebbb4
---
modules/gui/qt4/components/playlist/playlist.cpp | 2 +-
.../gui/qt4/components/playlist/playlist_model.cpp | 2 +-
modules/gui/qt4/components/playlist/selector.cpp | 6 ++++
modules/gui/qt4/components/playlist/selector.hpp | 2 +
.../gui/qt4/components/playlist/standardpanel.cpp | 26 +++++++++++++++----
.../gui/qt4/components/playlist/standardpanel.hpp | 3 +-
6 files changed, 32 insertions(+), 9 deletions(-)
diff --git a/modules/gui/qt4/components/playlist/playlist.cpp b/modules/gui/qt4/components/playlist/playlist.cpp
index bc2c643..960904e 100644
--- a/modules/gui/qt4/components/playlist/playlist.cpp
+++ b/modules/gui/qt4/components/playlist/playlist.cpp
@@ -93,7 +93,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
PL_UNLOCK;
- rightPanel = new StandardPLPanel( this, p_intf, THEPL, p_root );
+ rightPanel = new StandardPLPanel( this, p_intf, THEPL, p_root, selector );
/* Connect the activation of the selector to a redefining of the PL */
DCONNECT( selector, activated( playlist_item_t * ),
diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp
index ca718ae..d0e271c 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
@@ -887,7 +887,7 @@ void PLModel::search( const QString& search_text, const QModelIndex & idx, bool
endRemoveRows( );
beginInsertRows( idx, 0, searchRoot->children.size() - 1 );
- updateChildren( searchRoot );
+ updateChildren( searchRoot ); // The PL_LOCK is needed here
endInsertRows();
PL_UNLOCK;
diff --git a/modules/gui/qt4/components/playlist/selector.cpp b/modules/gui/qt4/components/playlist/selector.cpp
index 5b53c3b..30e2e99 100644
--- a/modules/gui/qt4/components/playlist/selector.cpp
+++ b/modules/gui/qt4/components/playlist/selector.cpp
@@ -500,3 +500,9 @@ void PLSelector::drawBranches ( QPainter * painter, const QRect & rect, const QM
QStyle::PE_IndicatorArrowDown :
QStyle::PE_IndicatorArrowRight, &option, painter );
}
+
+void PLSelector::getCurrentSelectedItem( int* type, QString *string)
+{
+ *type = currentItem()->data( 0, TYPE_ROLE ).toInt();
+ *string = currentItem()->data( 0, NAME_ROLE ).toString();
+}
diff --git a/modules/gui/qt4/components/playlist/selector.hpp b/modules/gui/qt4/components/playlist/selector.hpp
index b5e86c5..0c2fc82 100644
--- a/modules/gui/qt4/components/playlist/selector.hpp
+++ b/modules/gui/qt4/components/playlist/selector.hpp
@@ -114,6 +114,8 @@ class PLSelector: public QTreeWidget
public:
PLSelector( QWidget *p, intf_thread_t *_p_intf );
virtual ~PLSelector();
+
+ void getCurrentSelectedItem( int *type, QString *name );
protected:
friend class PlaylistWidget;
diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp
index dc0db6a..68dc8bd 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.cpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.cpp
@@ -31,6 +31,7 @@
#include "components/playlist/playlist_model.hpp"
#include "components/playlist/standardpanel.hpp"
#include "components/playlist/icon_view.hpp"
+#include "components/playlist/selector.hpp"
#include "util/customwidgets.hpp"
#include "menus.hpp"
@@ -60,8 +61,10 @@ static const QString viewNames[] = { qtr( "Detailed View" ),
StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
intf_thread_t *_p_intf,
playlist_t *p_playlist,
- playlist_item_t *p_root ):
- QWidget( _parent ), p_intf( _p_intf )
+ playlist_item_t *p_root,
+ PLSelector *_p_selector ):
+ QWidget( _parent ), p_intf( _p_intf ),
+ p_selector( _p_selector )
{
layout = new QGridLayout( this );
layout->setSpacing( 0 ); layout->setMargin( 0 );
@@ -208,10 +211,21 @@ void StandardPLPanel::toggleColumnShown( int i )
/* Search in the playlist */
void StandardPLPanel::search( const QString& searchText )
{
- bool flat = currentView == iconView || currentView == listView;
- model->search( searchText,
- flat ? currentView->rootIndex() : QModelIndex(),
- !flat );
+ int type;
+ QString name;
+ p_selector->getCurrentSelectedItem( &type, &name );
+ if( type != SD_TYPE )
+ {
+ bool flat = currentView == iconView || currentView == listView;
+ model->search( searchText,
+ flat ? currentView->rootIndex() : QModelIndex(),
+ !flat );
+ }
+ else
+ {
+ if( !name.isEmpty() )
+ playlist_QueryServicesDiscovery( THEPL, qtu(name), qtu(searchText) );
+ }
}
/* Set the root of the new Playlist */
diff --git a/modules/gui/qt4/components/playlist/standardpanel.hpp b/modules/gui/qt4/components/playlist/standardpanel.hpp
index 97663c5..a483557 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.hpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.hpp
@@ -56,7 +56,7 @@ class StandardPLPanel: public QWidget
public:
StandardPLPanel( PlaylistWidget *, intf_thread_t *,
- playlist_t *,playlist_item_t * );
+ playlist_t *, playlist_item_t *, PLSelector * );
virtual ~StandardPLPanel();
protected:
friend class PlaylistWidget;
@@ -78,6 +78,7 @@ private:
QGridLayout *layout;
LocationBar *locationBar;
SearchLineEdit *searchEdit;
+ PLSelector *p_selector;
QTreeView *treeView;
PlIconView *iconView;
More information about the vlc-commits
mailing list