vlc_linux/vlc-3.0.16/modules/gui/qt/components/complete_preferences.cpp
/* go over the module config items and search text in psz_text
 * also search the module name and head */
go over the module config items and search text in psz_text
also search the module name and head
go over the module config items and search text in psz_text also search the module name and head
bool PrefsItemData::contains( const QString &text, Qt::CaseSensitivity cs )
{
    module_t *p_module = NULL;
    if( this->i_type == TYPE_CATEGORY )
        return false;
    else if( this->i_type == TYPE_MODULE )
        p_module = module_find( this->psz_shortcut );
    else
    {
        p_module = module_get_main();
        assert( p_module );
    }
    unsigned confsize;
    module_config_t *const p_config = module_config_get (p_module, &confsize),
                    *p_item = p_config,
                    *p_end = p_config + confsize;
    if( this->i_type == TYPE_SUBCATEGORY || this->i_type ==  TYPE_CATSUBCAT )
    {
        while ( p_item < p_end )
        {
            if( p_item->i_type == CONFIG_SUBCATEGORY &&
                (
                    ( this->i_type == TYPE_SUBCATEGORY &&
                              p_item->value.i == this->i_object_id )
                    ||
                    ( this->i_type == TYPE_CATSUBCAT &&
                              p_item->value.i == this->i_subcat_id )
                )
              )
                break;
            p_item++;
        }
    }
    QString head;
    if( this->i_type == TYPE_SUBCATEGORY || this->i_type ==  TYPE_CATSUBCAT )
    {
        head.clear();
        p_item++; 
    }
    else
    {
        head = QString( qtr( module_GetLongName( p_module ) ) );
    }
    if (name.contains( text, cs ) || head.contains( text, cs ) || help.contains( text, cs ))
    {
        module_config_free( p_config );
        return true;
    }
    if( p_item ) do
    {
        if (
            (
                ( this->i_type == TYPE_SUBCATEGORY && p_item->value.i != this->i_object_id )
                ||
                ( this->i_type == TYPE_CATSUBCAT && p_item->value.i != this->i_subcat_id )
            ) &&
            ( p_item->i_type == CONFIG_CATEGORY || p_item->i_type == CONFIG_SUBCATEGORY )
           ) break;
        if( p_item->b_internal ) continue;
        if ( p_item->psz_text && qtr( p_item->psz_text ).contains( text, cs ) )
        {
            module_config_free( p_config );
            return true;
        }
    }
    while (
            !(
                ( this->i_type == TYPE_SUBCATEGORY || this->i_type == TYPE_CATSUBCAT )
                &&
                ( p_item->i_type == CONFIG_CATEGORY || p_item->i_type == CONFIG_SUBCATEGORY )
             )
             && ( ++p_item < p_end )
          );
    module_config_free( p_config );
    return false;
}
bool PrefsItemData :: contains ( const QString & text , Qt :: CaseSensitivity cs ) { module_t * p_module = NULL ; if ( this -> i_type == TYPE_CATEGORY ) return false ; else if ( this -> i_type == TYPE_MODULE ) p_module = module_find ( this -> psz_shortcut ) ; else { p_module = module_get_main ( ) ; assert ( p_module ) ; } unsigned confsize ; module_config_t * const p_config = module_config_get ( p_module , & confsize ) , * p_item = p_config , * p_end = p_config + confsize ; if ( this -> i_type == TYPE_SUBCATEGORY || this -> i_type == TYPE_CATSUBCAT ) { while ( p_item < p_end ) { if ( p_item -> i_type == CONFIG_SUBCATEGORY && ( ( this -> i_type == TYPE_SUBCATEGORY && p_item -> value . i == this -> i_object_id ) || ( this -> i_type == TYPE_CATSUBCAT && p_item -> value . i == this -> i_subcat_id ) ) ) break ; p_item ++ ; } } QString head ; if ( this -> i_type == TYPE_SUBCATEGORY || this -> i_type == TYPE_CATSUBCAT ) { head . clear ( ) ; p_item ++ ; } else { head = QString ( qtr ( module_GetLongName ( p_module ) ) ) ; } if ( name . contains ( text , cs ) || head . contains ( text , cs ) || help . contains ( text , cs ) ) { module_config_free ( p_config ) ; return true ; } if ( p_item ) do { if ( ( ( this -> i_type == TYPE_SUBCATEGORY && p_item -> value . i != this -> i_object_id ) || ( this -> i_type == TYPE_CATSUBCAT && p_item -> value . i != this -> i_subcat_id ) ) && ( p_item -> i_type == CONFIG_CATEGORY || p_item -> i_type == CONFIG_SUBCATEGORY ) ) break ; if ( p_item -> b_internal ) continue ; if ( p_item -> psz_text && qtr ( p_item -> psz_text ) . contains ( text , cs ) ) { module_config_free ( p_config ) ; return true ; } } while ( ! ( ( this -> i_type == TYPE_SUBCATEGORY || this -> i_type == TYPE_CATSUBCAT ) && ( p_item -> i_type == CONFIG_CATEGORY || p_item -> i_type == CONFIG_SUBCATEGORY ) ) && ( ++ p_item < p_end ) ) ; module_config_free ( p_config ) ; return false ; }
go over the module config items and search text in psz_text
 also search the module name and head
go over the module config items and search text in psz_text also search the module name and head
/* Find our module */ // Why that ? +1