]> git.sesse.net Git - vlc/commitdiff
Qt: Plugins list: improve sorting
authorFrancois Cartegnie <fcvlcdev@free.fr>
Tue, 2 Apr 2013 19:22:32 +0000 (21:22 +0200)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Tue, 2 Apr 2013 19:22:58 +0000 (21:22 +0200)
modules/gui/qt4/dialogs/plugins.cpp
modules/gui/qt4/dialogs/plugins.hpp

index 2bc493896cc76ccf4858dfc3ff2ca47cdc6a5774..e23c0193da81900ac65f02e89d5816297008f658 100644 (file)
@@ -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 );
 }
 
index 0058c677f368e25380ac5649fe475d81e64cc142..1bba5e11700861c8b8b2ce128353854fde2f6a0d 100644 (file)
@@ -69,6 +69,13 @@ private:
 class PluginTab : public QVLCFrame
 {
     Q_OBJECT
+public:
+    enum
+    {
+        NAME = 0,
+        CAPABILITY,
+        SCORE
+    };
 
 protected:
     virtual void keyPressEvent( QKeyEvent *keyEvent );