From 467e846e696a2d59563c98821e93f3dd248cfcc9 Mon Sep 17 00:00:00 2001 From: Javier Serrano Polo Date: Sat, 11 Jun 2016 04:40:58 +0200 Subject: [PATCH] Sort effects in dialog --- include/Plugin.h | 18 ++++++++++++++++++ src/gui/EffectSelectDialog.cpp | 10 ++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/include/Plugin.h b/include/Plugin.h index a182acea1cb..e405d3f540e 100644 --- a/include/Plugin.h +++ b/include/Plugin.h @@ -104,6 +104,17 @@ class EXPORT Plugin : public Model, public JournallingObject return desc != NULL && name.isNull() == false; } + QString displayName() const + { + if( desc->subPluginFeatures ) + { + return QString( "%1: %2" ).arg( + desc->displayName, + name ); + } + return desc->displayName; + } + const Plugin::Descriptor* desc; QString name; AttributeMap attributes; @@ -195,4 +206,11 @@ class EXPORT Plugin : public Model, public JournallingObject } ; +inline bool operator<( const Plugin::Descriptor::SubPluginFeatures::Key & k1, + const Plugin::Descriptor::SubPluginFeatures::Key & k2 ) +{ + return k1.displayName() < k2.displayName(); +} + + #endif diff --git a/src/gui/EffectSelectDialog.cpp b/src/gui/EffectSelectDialog.cpp index bd45ceae982..133c30dcb14 100644 --- a/src/gui/EffectSelectDialog.cpp +++ b/src/gui/EffectSelectDialog.cpp @@ -69,19 +69,13 @@ EffectSelectDialog::EffectSelectDialog( QWidget * _parent ) : } m_effectKeys += subPluginEffectKeys; + qSort( m_effectKeys ); // and fill our source model QStringList pluginNames; for( EffectKeyList::ConstIterator it = m_effectKeys.begin(); it != m_effectKeys.end(); ++it ) { - if( ( *it ).desc->subPluginFeatures ) - { - pluginNames += QString( "%1: %2" ).arg( ( *it ).desc->displayName, ( *it ).name ); - } - else - { - pluginNames += ( *it ).desc->displayName; - } + pluginNames += ( *it ).displayName(); } int row = 0;