Commit 09e5eedd authored by Stéphane Albert's avatar Stéphane Albert

ENH: Used QString::simplified() text to search of OTB-applications.

parent 6ca9f6d4
......@@ -139,6 +139,8 @@ ApplicationsToolBox
mainItem->setText( COLUMN_NAME, tr( "Orfeo Toolbox Algorithms" ) );
mainItem->setExpanded( !m_SearchText.isEmpty() );
QString search( m_SearchText.simplified() );
//
// iterate on map: key as high-level item / algorithms as lower-level items
for( ApplicationsTagContainer::const_iterator itTag( m_AppTags.begin() );
......@@ -152,8 +154,8 @@ ApplicationsToolBox
// If a current tag applicaton name match the searchText, add the
// tag as an item to the tree
if (m_SearchText.isEmpty() ||
IsSearchTextMatchAnyAlgorithm( qcurrentTag ) ||
qcurrentTag.contains(m_SearchText ,Qt::CaseInsensitive))
IsSearchTextMatchAnyAlgorithm( qcurrentTag, search ) ||
qcurrentTag.contains( search, Qt::CaseInsensitive ) )
{
//
// step #1 -> DocTag is a main item
......@@ -181,8 +183,8 @@ ApplicationsToolBox
// does the current algorithm DocName match the search text
if ( m_SearchText.isEmpty() ||
title.contains( m_SearchText, Qt::CaseInsensitive ) ||
name.contains( m_SearchText, Qt::CaseInsensitive ) )
title.contains( search, Qt::CaseInsensitive ) ||
name.contains( search, Qt::CaseInsensitive ) )
{
//
// set current application name as secondary item
......@@ -209,7 +211,7 @@ ApplicationsToolBox
/*******************************************************************************/
bool
ApplicationsToolBox
::IsSearchTextMatchAnyAlgorithm(const QString & tagName )
::IsSearchTextMatchAnyAlgorithm( const QString & tagName, const QString & search )
{
// find the pair corresponding to the tagName
ApplicationsTagContainer::const_iterator itTag(
......@@ -227,9 +229,9 @@ ApplicationsToolBox
{
QString name( FromStdString( *itApps ) );
if( name.contains( m_SearchText, Qt::CaseInsensitive ) ||
if( name.contains( search, Qt::CaseInsensitive ) ||
GetApplicationDocNameByApplicationName( name )
.contains( m_SearchText, Qt::CaseInsensitive ) )
.contains( search, Qt::CaseInsensitive ) )
return true;
}
......
......@@ -143,7 +143,8 @@ private:
* \brief Helper method to check if searchText matches any of the
* algorithms string contained in the map
*/
bool IsSearchTextMatchAnyAlgorithm( const QString & tagName );
bool IsSearchTextMatchAnyAlgorithm( const QString & tagName,
const QString & search );
/**
* \brief Helper method to get the DocName of an application from an
......
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