diff --git a/src/plugins/cmakeprojectmanager/cmakeautocompleter.cpp b/src/plugins/cmakeprojectmanager/cmakeautocompleter.cpp index b0b145e7fd5..76f49bff9a4 100644 --- a/src/plugins/cmakeprojectmanager/cmakeautocompleter.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeautocompleter.cpp @@ -25,6 +25,8 @@ #include "cmakeautocompleter.h" +#include + namespace CMakeProjectManager { namespace Internal { @@ -110,7 +112,7 @@ QString CMakeAutoCompleter::insertMatchingQuote(const QTextCursor &cursor, int CMakeAutoCompleter::paragraphSeparatorAboutToBeInserted(QTextCursor &cursor) { const QString line = cursor.block().text().trimmed(); - if (line.contains(QRegExp(QStringLiteral("^(endfunction|endmacro|endif|endforeach|endwhile)\\w*\\(")))) + if (line.contains(QRegularExpression(QStringLiteral("^(endfunction|endmacro|endif|endforeach|endwhile)\\w*\\(")))) tabSettings().indentLine(cursor.block(), tabSettings().indentationColumn(cursor.block().text())); return 0; } diff --git a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp index 0f99ad4fced..fab9b57b076 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp @@ -88,8 +88,8 @@ static bool isCurrentExecutableTarget(const QString &target) CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl, Utils::Id id) : AbstractProcessStep(bsl, id) { - m_percentProgress = QRegExp("^\\[\\s*(\\d*)%\\]"); - m_ninjaProgress = QRegExp("^\\[\\s*(\\d*)/\\s*(\\d*)"); + m_percentProgress = QRegularExpression("^\\[\\s*(\\d*)%\\]"); + m_ninjaProgress = QRegularExpression("^\\[\\s*(\\d*)/\\s*(\\d*)"); m_ninjaProgressString = "[%f/%t "; // ninja: [33/100 //: Default display name for the cmake make step. setDefaultDisplayName(tr("CMake Build")); @@ -289,26 +289,30 @@ void CMakeBuildStep::stdOutput(const QString &output) line = output.mid(offset, newlinePos - offset + 1); offset = newlinePos + 1; } - if (m_percentProgress.indexIn(line) != -1) { + QRegularExpressionMatch match = m_percentProgress.match(line); + if (match.hasMatch()) { AbstractProcessStep::stdOutput(line); bool ok = false; - int percent = m_percentProgress.cap(1).toInt(&ok); + int percent = match.captured(1).toInt(&ok); if (ok) emit progress(percent, QString()); continue; - } else if (m_ninjaProgress.indexIn(line) != -1) { - AbstractProcessStep::stdOutput(line); - m_useNinja = true; - bool ok = false; - int done = m_ninjaProgress.cap(1).toInt(&ok); - if (ok) { - int all = m_ninjaProgress.cap(2).toInt(&ok); - if (ok && all != 0) { - const int percent = static_cast(100.0 * done/all); - emit progress(percent, QString()); + } else { + match = m_ninjaProgress.match(line); + if (match.hasMatch()) { + AbstractProcessStep::stdOutput(line); + m_useNinja = true; + bool ok = false; + int done = match.captured(1).toInt(&ok); + if (ok) { + int all = match.captured(2).toInt(&ok); + if (ok && all != 0) { + const int percent = static_cast(100.0 * done/all); + emit progress(percent, QString()); + } } + continue; } - continue; } if (m_useNinja) AbstractProcessStep::stdError(line); diff --git a/src/plugins/cmakeprojectmanager/cmakebuildstep.h b/src/plugins/cmakeprojectmanager/cmakebuildstep.h index ffab03c1809..4b20ef58958 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildstep.h +++ b/src/plugins/cmakeprojectmanager/cmakebuildstep.h @@ -27,6 +27,8 @@ #include +#include + namespace Utils { class CommandLine; } namespace ProjectExplorer { class RunConfiguration; } @@ -98,8 +100,8 @@ private: QMetaObject::Connection m_runTrigger; - QRegExp m_percentProgress; - QRegExp m_ninjaProgress; + QRegularExpression m_percentProgress; + QRegularExpression m_ninjaProgress; QString m_ninjaProgressString; QStringList m_buildTargets; QString m_cmakeArguments;