Skip to content

Commit d9f2c14

Browse files
author
rblazek
committed
catch GRASS_INFO_PERCENT also from stdout
git-svn-id: http://svn.osgeo.org/qgis/trunk@5858 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 767fd2f commit d9f2c14

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/plugins/grass/qgsgrassmodule.cpp

+12-2
Original file line numberDiff line numberDiff line change
@@ -1272,12 +1272,22 @@ void QgsGrassModule::readStdout()
12721272
#endif
12731273

12741274
QString line;
1275+
QRegExp rxpercent ( "GRASS_INFO_PERCENT: (\\d+)" );
1276+
12751277
mProcess.setReadChannel ( QProcess::StandardOutput );
12761278
while ( mProcess.canReadLine() ) {
12771279
//line = QString::fromLocal8Bit( mProcess.readLineStdout().ascii() );
12781280
QByteArray ba = mProcess.readLine();
12791281
line = QString::fromLocal8Bit( QString(ba).ascii() );
1280-
mOutputTextBrowser->append ( line );
1282+
1283+
// GRASS_INFO_PERCENT is catched here only because of bugs in GRASS,
1284+
// normaly it should be printed to stderr
1285+
if ( rxpercent.search ( line ) != -1 ) {
1286+
int progress = rxpercent.cap(1).toInt();
1287+
mProgressBar->setProgress ( progress, 100 );
1288+
} else {
1289+
mOutputTextBrowser->append ( line );
1290+
}
12811291
}
12821292
}
12831293

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

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

0 commit comments

Comments
 (0)