]> git.sesse.net Git - vlc/commitdiff
Fix sorting of plugin scores in the QT plugin dialog.
authorDylan Yudaken <dyudaken@gmail.com>
Mon, 19 Oct 2009 22:04:54 +0000 (00:04 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Wed, 21 Oct 2009 21:14:48 +0000 (23:14 +0200)
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/gui/qt4/dialogs/plugins.cpp
modules/gui/qt4/dialogs/plugins.hpp

index 9ab3e36e607c2a0a14fa0f4fd890e41f71f4dfc9..e071c18804a43b61ec0f1c8e5961e1c547198120 100644 (file)
@@ -106,7 +106,7 @@ inline void PluginDialog::FillTree()
         if( qs_item.at(1).isEmpty() ) continue;
 #endif
 
-        QTreeWidgetItem *item = new QTreeWidgetItem( qs_item );
+        QTreeWidgetItem *item = new PluginTreeItem( qs_item );
         treePlugins->addTopLevelItem( item );
     }
 }
@@ -131,3 +131,10 @@ PluginDialog::~PluginDialog()
                              treePlugins->header()->saveState() );
 }
 
+bool PluginTreeItem::operator< ( const QTreeWidgetItem & other ) const
+{
+    int col = treeWidget()->sortColumn();
+    if( col == 2 )
+        return text( col ).toInt() < other.text( col ).toInt();
+    return text( col ) < other.text( col );
+}
index 1a243a8913e5ab058a066a506ce48234f33f0650..1245e9ca8c2206570c8e9569ea66518655343cf1 100644 (file)
@@ -25,6 +25,8 @@
 #define QVLC_PLUGIN_DIALOG_H_ 1
 
 #include "util/qvlcframe.hpp"
+#include <QTreeWidget>
+#include <QStringList>
 
 class QTreeWidget;
 class QLineEdit;
@@ -57,5 +59,13 @@ private slots:
     void search( const QString& );
 };
 
+class PluginTreeItem : public QTreeWidgetItem
+{
+public:
+    PluginTreeItem(QStringList &qs_item, int Type = QTreeWidgetItem::Type) : QTreeWidgetItem (qs_item, Type)
+    { }
+    virtual bool operator< ( const QTreeWidgetItem & other ) const;
+};
+
 #endif