Skip to content
Permalink
Browse files
catch GRASS_INFO_PERCENT also from stdout
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 d9f2c1493bb5fa758a906f574f9db3badd56312e
Showing with 12 additions and 2 deletions.
  1. +12 −2 src/plugins/grass/qgsgrassmodule.cpp
@@ -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 );
}
}
}

@@ -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();

0 comments on commit d9f2c14

Please sign in to comment.