forked from qt-creator/qt-creator
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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user