Skip to content

Commit

Permalink
catch GRASS_INFO_PERCENT also from stdout
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@5858 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek committed Sep 22, 2006
1 parent 767fd2f commit d9f2c14
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/plugins/grass/qgsgrassmodule.cpp
Expand Up @@ -1272,12 +1272,22 @@ void QgsGrassModule::readStdout()
#endif

QString line;
QRegExp rxpercent ( "GRASS_INFO_PERCENT: (\\d+)" );

mProcess.setReadChannel ( QProcess::StandardOutput );
while ( mProcess.canReadLine() ) {
//line = QString::fromLocal8Bit( mProcess.readLineStdout().ascii() );
QByteArray ba = mProcess.readLine();
line = QString::fromLocal8Bit( QString(ba).ascii() );
mOutputTextBrowser->append ( line );

// GRASS_INFO_PERCENT is catched here only because of bugs in GRASS,
// normaly it should be printed to stderr
if ( rxpercent.search ( line ) != -1 ) {
int progress = rxpercent.cap(1).toInt();
mProgressBar->setProgress ( progress, 100 );
} else {
mOutputTextBrowser->append ( line );
}
}
}

Expand All @@ -1301,7 +1311,7 @@ void QgsGrassModule::readStderr()
//line = QString::fromLocal8Bit( mProcess.readLineStderr().ascii() );
QByteArray ba = mProcess.readLine();
line = QString::fromLocal8Bit( QString(ba).ascii() );
//std::cerr << "stderr: " << line << std::endl;
//std::cerr << "line: '" << line.ascii() << "'" << std::endl;

if ( rxpercent.search ( line ) != -1 ) {
int progress = rxpercent.cap(1).toInt();
Expand Down

0 comments on commit d9f2c14

Please sign in to comment.