void K3b::VcdJob::slotParseVcdxBuildOutput( const QString& line ) { QDomDocument xml_doc; QDomElement xml_root; QString str = line.trimmed(); emit debuggingOutput( "vcdxbuild", str ); xml_doc.setContent( QString( "<?xml version='1.0'?><vcdxbuild>" ) + str + "</vcdxbuild>" ); xml_root = xml_doc.documentElement(); // There should be only one... but ... for ( QDomNode node = xml_root.firstChild(); !node.isNull(); node = node.nextSibling() ) { QDomElement el = node.toElement(); if ( el.isNull() ) continue; const QString tagName = el.tagName().toLower(); if ( tagName == "progress" ) { const QString oper = el.attribute( "operation" ).toLower(); const unsigned long long pos = el.attribute( "position" ).toLong(); const long long size = el.attribute( "size" ).toLong(); if ( oper == "scan" ) { // Scan Video Files if ( m_stage == stageUnknown || pos < m_bytesFinished ) { const uint index = el.attribute( "id" ).remove( QRegExp( "sequence-" ) ).toUInt(); m_currentWrittenTrack = m_doc->at( m_currentWrittenTrackNumber ); emit newSubTask( i18n( "Scanning video file %1 of %2 (%3)" , index + 1 , doc() ->numOfTracks() , m_currentWrittenTrack->fileName() ) ); m_bytesFinished = 0; if ( !firstTrack ) { m_bytesFinishedTracks += m_doc->at( m_currentWrittenTrackNumber ) ->size(); m_currentWrittenTrackNumber++; } else firstTrack = false; } emit subPercent( ( int ) ( 100.0 * ( double ) pos / ( double ) size ) ); emit processedSubSize( pos / 1024 / 1024, size / 1024 / 1024 ); // this is the first of three processes. double relOverallWritten = ( ( double ) m_bytesFinishedTracks + ( double ) pos ) / ( double ) doc() ->size(); emit percent( ( int ) ( m_createimageonlypercent * relOverallWritten ) ); m_bytesFinished = pos; m_stage = stageScan; } else if ( oper == "write" ) { emit subPercent( ( int ) ( 100.0 * ( double ) pos / ( double ) size ) ); emit processedSubSize( ( pos * 2048 ) / 1024 / 1024, ( size * 2048 ) / 1024 / 1024 ); emit percent( ( int ) ( m_createimageonlypercent + ( m_createimageonlypercent * ( double ) pos / ( double ) size ) ) ); m_stage = stageWrite; } else { return ; } } else if ( tagName == "log" ) { QDomText tel = el.firstChild().toText(); const QString level = el.attribute( "level" ).toLower(); if ( tel.isText() ) { const QString text = tel.data(); if ( m_stage == stageWrite && level == "information" ) qDebug() << QString( "(K3b::VcdJob) VcdxBuild information, %1" ).arg( text ); if ( ( text ).startsWith( "writing track" ) ) emit newSubTask( i18n( "Creating Image for track %1" , ( text ).mid( 14 ) ) ); else { if ( level != "error" ) { qDebug() << QString( "(K3b::VcdJob) vcdxbuild warning, %1" ).arg( text ); parseInformation( text ); } else { qDebug() << QString( "(K3b::VcdJob) vcdxbuild error, %1" ).arg( text ); emit infoMessage( text, K3b::Job::MessageError ); } } } } } }