[libcalamares] Refactor bp:list -> QStringList

This commit is contained in:
Adriaan de Groot 2017-11-28 10:42:00 -05:00
parent 9d31380980
commit 6693d91152

View File

@ -71,6 +71,18 @@ mount( const std::string& device_path,
} }
static inline QStringList
_bp_list_to_qstringlist( const bp::list& args )
{
QStringList list;
for ( int i = 0; i < bp::len( args ); ++i )
{
list.append( QString::fromStdString(
bp::extract< std::string >( args[ i ] ) ) );
}
return list;
}
int int
target_env_call( const std::string& command, target_env_call( const std::string& command,
const std::string& stdin, const std::string& stdin,
@ -89,15 +101,8 @@ target_env_call( const bp::list& args,
const std::string& stdin, const std::string& stdin,
int timeout ) int timeout )
{ {
QStringList list;
for ( int i = 0; i < bp::len( args ); ++i )
{
list.append( QString::fromStdString(
bp::extract< std::string >( args[ i ] ) ) );
}
return CalamaresUtils::System::instance()-> return CalamaresUtils::System::instance()->
targetEnvCall( list, targetEnvCall( _bp_list_to_qstringlist( args ),
QString(), QString(),
QString::fromStdString( stdin ), QString::fromStdString( stdin ),
timeout ); timeout );
@ -123,13 +128,7 @@ check_target_env_call( const bp::list& args,
if ( !ec ) if ( !ec )
return ec; return ec;
QStringList failedCmdList; QStringList failedCmdList = _bp_list_to_qstringlist( args );
for ( int i = 0; i < bp::len( args ); ++i )
{
failedCmdList.append( QString::fromStdString(
bp::extract< std::string >( args[ i ] ) ) );
}
return _handle_check_target_env_call_error( ec, failedCmdList.join( ' ' ) ); return _handle_check_target_env_call_error( ec, failedCmdList.join( ' ' ) );
} }
@ -157,13 +156,7 @@ check_target_env_output( const bp::list& args,
int timeout ) int timeout )
{ {
QString output; QString output;
QStringList list; QStringList list = _bp_list_to_qstringlist( args );
for ( int i = 0; i < bp::len( args ); ++i )
{
list.append( QString::fromStdString(
bp::extract< std::string >( args[ i ] ) ) );
}
int ec = CalamaresUtils::System::instance()-> int ec = CalamaresUtils::System::instance()->
targetEnvOutput( list, targetEnvOutput( list,
output, output,