From c5a70e7daac9c988bf608e80bb3c15bcd2e5c87c Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 1 Dec 2020 12:52:59 +0100 Subject: [PATCH] CMake: Use new MessageManager API Flash when CMake is started, write all other output silently. This avoids re-popping up the general messages pane all the time. When an error occurs, that is put into the issues pane, so no need to pop up the general messages pane for that either. Task-number: QTCREATORBUG-24430 Change-Id: I07ae4182cbc43147fbb343b360baf9da7e65f224 Reviewed-by: Cristian Adam --- .../cmakeprojectmanager/cmakeprocess.cpp | 17 ++++++++--------- .../cmakeprojectmanager/cmakeprojectmanager.cpp | 4 ++-- .../cmakeprojectmanager/fileapiparser.cpp | 9 +++++---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakeprocess.cpp b/src/plugins/cmakeprojectmanager/cmakeprocess.cpp index 637bb4b656f..8a4615a90e0 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprocess.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprocess.cpp @@ -117,9 +117,8 @@ void CMakeProcess::run(const BuildDirParameters ¶meters, const QStringList & TaskHub::clearTasks(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM); - Core::MessageManager::write(tr("Running %1 in %2.") - .arg(commandLine.toUserOutput()) - .arg(workDirectory.toUserOutput())); + Core::MessageManager::writeFlashing( + tr("Running %1 in %2.").arg(commandLine.toUserOutput()).arg(workDirectory.toUserOutput())); auto future = std::make_unique>(); future->setProgressRange(0, 1); @@ -168,9 +167,9 @@ void CMakeProcess::processStandardOutput() QTC_ASSERT(m_process, return); static QString rest; - rest = lineSplit(rest, m_process->readAllStandardOutput(), - [](const QString &s) { Core::MessageManager::write(s); }); - + rest = lineSplit(rest, m_process->readAllStandardOutput(), [](const QString &s) { + Core::MessageManager::writeSilently(s); + }); } void CMakeProcess::processStandardError() @@ -180,7 +179,7 @@ void CMakeProcess::processStandardError() static QString rest; rest = lineSplit(rest, m_process->readAllStandardError(), [this](const QString &s) { m_parser.appendMessage(s + '\n', Utils::StdErrFormat); - Core::MessageManager::write(s); + Core::MessageManager::writeSilently(s); }); } @@ -206,7 +205,7 @@ void CMakeProcess::handleProcessFinished(int code, QProcess::ExitStatus status) m_lastExitCode = code; if (!msg.isEmpty()) { - Core::MessageManager::write(msg); + Core::MessageManager::writeSilently(msg); TaskHub::addTask(BuildSystemTask(Task::Error, msg)); m_future->reportCanceled(); } else { @@ -218,7 +217,7 @@ void CMakeProcess::handleProcessFinished(int code, QProcess::ExitStatus status) emit finished(code, status); const QString elapsedTime = Utils::formatElapsedTime(m_elapsed.elapsed()); - Core::MessageManager::write(elapsedTime); + Core::MessageManager::writeSilently(elapsedTime); } void CMakeProcess::checkForCancelled() diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp index 6ab8e805f88..566d1e30f19 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp @@ -281,8 +281,8 @@ void CMakeManager::buildFile(Node *node) bc->buildDirectory()); targetBase = relativeBuildDir / "CMakeFiles" / (targetNode->displayName() + ".dir"); } else if (!generator.contains("Makefiles")) { - Core::MessageManager::write(tr("Build File is not supported for generator \"%1\"") - .arg(generator)); + Core::MessageManager::writeFlashing( + tr("Build File is not supported for generator \"%1\"").arg(generator)); return; } diff --git a/src/plugins/cmakeprojectmanager/fileapiparser.cpp b/src/plugins/cmakeprojectmanager/fileapiparser.cpp index 5c3c3e92665..b62bb2c943f 100644 --- a/src/plugins/cmakeprojectmanager/fileapiparser.cpp +++ b/src/plugins/cmakeprojectmanager/fileapiparser.cpp @@ -61,10 +61,11 @@ static FilePath cmakeReplyDirectory(const FilePath &buildDirectory) static void reportFileApiSetupFailure() { - Core::MessageManager::write(QCoreApplication::translate( - "CMakeProjectManager::Internal", - "Failed to set up CMake file API support. %1 cannot " - "extract project information.").arg(Core::Constants::IDE_DISPLAY_NAME)); + Core::MessageManager::writeFlashing( + QCoreApplication::translate("CMakeProjectManager::Internal", + "Failed to set up CMake file API support. %1 cannot " + "extract project information.") + .arg(Core::Constants::IDE_DISPLAY_NAME)); } static std::pair cmakeVersion(const QJsonObject &obj)