Show progress for building cmake projects.

Parse percent output of cmake, report via QtConcurrent and modify the
BuildManager to also report the progress to the ProgressManager.
This commit is contained in:
dt
2009-04-07 13:52:28 +02:00
parent dee34912d5
commit 3d863b211a
4 changed files with 37 additions and 7 deletions

View File

@@ -50,6 +50,7 @@ using namespace CMakeProjectManager::Internal;
MakeStep::MakeStep(CMakeProject *pro)
: AbstractProcessStep(pro), m_pro(pro), m_buildParser(0)
{
m_percentProgress = QRegExp("^\\[\\s*(\\d*)%\\]");
}
MakeStep::~MakeStep()
@@ -107,7 +108,10 @@ bool MakeStep::init(const QString &buildConfiguration)
void MakeStep::run(QFutureInterface<bool> &fi)
{
m_futureInterface = &fi;
m_futureInterface->setProgressRange(0, 100);
AbstractProcessStep::run(fi);
m_futureInterface = 0;
}
QString MakeStep::name()
@@ -134,6 +138,12 @@ void MakeStep::stdOut(const QString &line)
{
if (m_buildParser)
m_buildParser->stdOutput(line);
if (m_percentProgress.indexIn(line) != -1) {
bool ok = false;
int percent = m_percentProgress.cap(1).toInt(&ok);;
if (ok)
m_futureInterface->setProgressValue(percent);
}
AbstractProcessStep::stdOut(line);
}