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

git version control git at videolan.org
Sun Nov 15 19:25:16 CET 2009


vlc | branch: 1.0-bugfix | Dylan Yudaken <dyudaken at gmail.com> | Tue Oct 20 00:04:54 2009 +0200| [a4241c2b74c4674d7020cfd4452f1e0ac17f0f89] | committer: Rémi Duraffort 

Fix sorting of plugin scores in the QT plugin dialog.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit 3554eedcce5f33711220578285aad015595c53c6)

Signed-off-by: Rémi Duraffort <ivoire at videolan.org>

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

 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 1575ca0..37b95db 100644
--- a/modules/gui/qt4/dialogs/plugins.cpp
+++ b/modules/gui/qt4/dialogs/plugins.cpp
@@ -105,7 +105,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 );
     }
 }
@@ -130,3 +130,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