[vlc-devel] commit: Fix sorting of plugin scores in the QT plugin dialog. ( Dylan Yudaken )

git version control git at videolan.org
Wed Oct 21 23:15:02 CEST 2009


vlc | branch: master | Dylan Yudaken <dyudaken at gmail.com> | Tue Oct 20 00:04:54 2009 +0200| [3554eedcce5f33711220578285aad015595c53c6] | committer: Jean-Baptiste Kempf 

Fix sorting of plugin scores in the QT plugin dialog.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/gui/qt4/dialogs/plugins.cpp |    9 ++++++++-
 modules/gui/qt4/dialogs/plugins.hpp |   10 ++++++++++
 2 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/modules/gui/qt4/dialogs/plugins.cpp b/modules/gui/qt4/dialogs/plugins.cpp
index 9ab3e36..e071c18 100644
--- a/modules/gui/qt4/dialogs/plugins.cpp
+++ b/modules/gui/qt4/dialogs/plugins.cpp
@@ -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 );
+}
diff --git a/modules/gui/qt4/dialogs/plugins.hpp b/modules/gui/qt4/dialogs/plugins.hpp
index 1a243a8..1245e9c 100644
--- a/modules/gui/qt4/dialogs/plugins.hpp
+++ b/modules/gui/qt4/dialogs/plugins.hpp
@@ -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
 




More information about the vlc-devel mailing list