Commit d878853f authored by Francois Cartegnie's avatar Francois Cartegnie

Qt: Plugins list: improve sorting

parent e495dc9b
...@@ -183,8 +183,15 @@ void PluginTab::keyPressEvent( QKeyEvent *keyEvent ) ...@@ -183,8 +183,15 @@ void PluginTab::keyPressEvent( QKeyEvent *keyEvent )
bool PluginTreeItem::operator< ( const QTreeWidgetItem & other ) const bool PluginTreeItem::operator< ( const QTreeWidgetItem & other ) const
{ {
int col = treeWidget()->sortColumn(); int col = treeWidget()->sortColumn();
if( col == 2 ) if( col == PluginTab::SCORE )
return text( col ).toInt() < other.text( col ).toInt(); 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 ); return text( col ) < other.text( col );
} }
......
...@@ -69,6 +69,13 @@ private: ...@@ -69,6 +69,13 @@ private:
class PluginTab : public QVLCFrame class PluginTab : public QVLCFrame
{ {
Q_OBJECT Q_OBJECT
public:
enum
{
NAME = 0,
CAPABILITY,
SCORE
};
protected: protected:
virtual void keyPressEvent( QKeyEvent *keyEvent ); virtual void keyPressEvent( QKeyEvent *keyEvent );
......
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