Commit 3554eedc authored by Dylan Yudaken's avatar Dylan Yudaken Committed by Jean-Baptiste Kempf

Fix sorting of plugin scores in the QT plugin dialog.

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 0b8acb0f
...@@ -106,7 +106,7 @@ inline void PluginDialog::FillTree() ...@@ -106,7 +106,7 @@ inline void PluginDialog::FillTree()
if( qs_item.at(1).isEmpty() ) continue; if( qs_item.at(1).isEmpty() ) continue;
#endif #endif
QTreeWidgetItem *item = new QTreeWidgetItem( qs_item ); QTreeWidgetItem *item = new PluginTreeItem( qs_item );
treePlugins->addTopLevelItem( item ); treePlugins->addTopLevelItem( item );
} }
} }
...@@ -131,3 +131,10 @@ PluginDialog::~PluginDialog() ...@@ -131,3 +131,10 @@ PluginDialog::~PluginDialog()
treePlugins->header()->saveState() ); 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 );
}
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
#define QVLC_PLUGIN_DIALOG_H_ 1 #define QVLC_PLUGIN_DIALOG_H_ 1
#include "util/qvlcframe.hpp" #include "util/qvlcframe.hpp"
#include <QTreeWidget>
#include <QStringList>
class QTreeWidget; class QTreeWidget;
class QLineEdit; class QLineEdit;
...@@ -57,5 +59,13 @@ private slots: ...@@ -57,5 +59,13 @@ private slots:
void search( const QString& ); 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 #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment