vlc_linux/vlc-3.0.16/modules/gui/qt/components/controller.cpp
/* Open the generic config line for the toolbar, parse it
 * and create the widgets accordingly */
Open the generic config line for the toolbar, parse it
and create the widgets accordingly
Open the generic config line for the toolbar parse it and create the widgets accordingly
void AbstractController::parseAndCreate( const QString& config,
                                         QBoxLayout *newControlLayout )
{
    QStringList list = config.split( ";", QString::SkipEmptyParts ) ;
    for( int i = 0; i < list.count(); i++ )
    {
        QStringList list2 = list.at( i ).split( "-" );
        if( list2.count() < 1 )
        {
            msg_Warn( p_intf, "Parsing error 1. Please, report this." );
            continue;
        }
        bool ok;
        int i_option = WIDGET_NORMAL;
        buttonType_e i_type = (buttonType_e)list2.at( 0 ).toInt( &ok );
        if( !ok )
        {
            msg_Warn( p_intf, "Parsing error 2. Please, report this." );
            continue;
        }
        if( list2.count() > 1 )
        {
            i_option = list2.at( 1 ).toInt( &ok );
            if( !ok )
            {
                msg_Warn( p_intf, "Parsing error 3. Please, report this." );
                continue;
            }
        }
        createAndAddWidget( newControlLayout, -1, i_type, i_option );
    }
    if( buttonGroupLayout )
    {
        newControlLayout->addLayout( buttonGroupLayout );
        buttonGroupLayout = NULL;
    }
}
void AbstractController :: parseAndCreate ( const QString & config , QBoxLayout * newControlLayout ) { QStringList list = config . split ( " " , QString :: SkipEmptyParts ) ; for ( int i = 0 ; i < list . count ( ) ; i ++ ) { QStringList list2 = list . at ( i ) . split ( " " ) ; if ( list2 . count ( ) < 1 ) { msg_Warn ( p_intf , " " ) ; continue ; } bool ok ; int i_option = WIDGET_NORMAL ; buttonType_e i_type = ( buttonType_e ) list2 . at ( 0 ) . toInt ( & ok ) ; if ( ! ok ) { msg_Warn ( p_intf , " " ) ; continue ; } if ( list2 . count ( ) > 1 ) { i_option = list2 . at ( 1 ) . toInt ( & ok ) ; if ( ! ok ) { msg_Warn ( p_intf , " " ) ; continue ; } } createAndAddWidget ( newControlLayout , -1 , i_type , i_option ) ; } if ( buttonGroupLayout ) { newControlLayout -> addLayout ( buttonGroupLayout ) ; buttonGroupLayout = NULL ; } }
Open the generic config line for the toolbar, parse it
 and create the widgets accordingly
Open the generic config line for the toolbar parse it and create the widgets accordingly