[vlc-commits] Qt: Plugins list: improve sorting

Francois Cartegnie git at videolan.org
Tue Apr 2 21:23:29 CEST 2013


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Apr  2 21:22:32 2013 +0200| [d878853f82b2ee7fb1579299eb69f4eccc9ca45c] | committer: Francois Cartegnie

Qt: Plugins list: improve sorting

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d878853f82b2ee7fb1579299eb69f4eccc9ca45c
---

 modules/gui/qt4/dialogs/plugins.cpp |    9 ++++++++-
 modules/gui/qt4/dialogs/plugins.hpp |    7 +++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/modules/gui/qt4/dialogs/plugins.cpp b/modules/gui/qt4/dialogs/plugins.cpp
index 2bc4938..e23c019 100644
--- a/modules/gui/qt4/dialogs/plugins.cpp
+++ b/modules/gui/qt4/dialogs/plugins.cpp
@@ -183,8 +183,15 @@ void PluginTab::keyPressEvent( QKeyEvent *keyEvent )
 bool PluginTreeItem::operator< ( const QTreeWidgetItem & other ) const
 {
     int col = treeWidget()->sortColumn();
-    if( col == 2 )
+    if( col == PluginTab::SCORE )
         return text( col ).toInt() < other.text( col ).toInt();
+    else if ( col == PluginTab::CAPABILITY )
+    {
+        if ( text( PluginTab::CAPABILITY ) == other.text( PluginTab::CAPABILITY ) )
+            return text( PluginTab::NAME ) < other.text( PluginTab::NAME );
+        else
+            return text( PluginTab::CAPABILITY ) < other.text( PluginTab::CAPABILITY );
+    }
     return text( col ) < other.text( col );
 }
 
diff --git a/modules/gui/qt4/dialogs/plugins.hpp b/modules/gui/qt4/dialogs/plugins.hpp
index 0058c67..1bba5e1 100644
--- a/modules/gui/qt4/dialogs/plugins.hpp
+++ b/modules/gui/qt4/dialogs/plugins.hpp
@@ -69,6 +69,13 @@ private:
 class PluginTab : public QVLCFrame
 {
     Q_OBJECT
+public:
+    enum
+    {
+        NAME = 0,
+        CAPABILITY,
+        SCORE
+    };
 
 protected:
     virtual void keyPressEvent( QKeyEvent *keyEvent );



More information about the vlc-commits mailing list