qmake: Do not bring general messages pane to front

- message(): Print to general messages and blink
- warning(), error(): create item in Issues pane
- parse error and other errors: create item in Issues pane

Task-number: QTCREATORBUG-24430
Change-Id: I6b37cef0b9e53e2207341bd179e2c60a40da9ee0
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Eike Ziller
2020-11-27 14:36:32 +01:00
parent d3412cfcdc
commit 18e3e70887
4 changed files with 26 additions and 12 deletions

View File

@@ -39,6 +39,7 @@
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
#include <projectexplorer/taskhub.h>
#include <qtsupport/profilereader.h>
#include <texteditor/icodestylepreferences.h>
#include <texteditor/tabsettings.h>
@@ -774,7 +775,7 @@ QPair<ProFile *, QStringList> QmakePriFile::readProFile()
&contents,
&m_textFormat,
&errorMsg) != TextFileFormat::ReadSuccess) {
QmakeBuildSystem::proFileParseError(errorMsg);
QmakeBuildSystem::proFileParseError(errorMsg, filePath());
return qMakePair(includeFile, lines);
}
lines = contents.split('\n');
@@ -1655,7 +1656,7 @@ void QmakeProFile::applyEvaluate(QmakeEvalResult *evalResult)
}
foreach (const QString &error, evalResult->errors)
QmakeBuildSystem::proFileParseError(error);
QmakeBuildSystem::proFileParseError(error, filePath());
// we are changing what is executed in that case
if (result->state == QmakeEvalResult::EvalFail || m_buildSystem->wasEvaluateCanceled()) {
@@ -1666,8 +1667,10 @@ void QmakeProFile::applyEvaluate(QmakeEvalResult *evalResult)
if (result->state == QmakeEvalResult::EvalFail) {
QmakeBuildSystem::proFileParseError(
QCoreApplication::translate("QmakeProFile", "Error while parsing file %1. Giving up.")
.arg(filePath().toUserOutput()));
QCoreApplication::translate("QmakeProFile",
"Error while parsing file %1. Giving up.")
.arg(filePath().toUserOutput()),
filePath());
if (m_projectType == ProjectType::Invalid)
return;

View File

@@ -646,6 +646,7 @@ bool QmakeBuildSystem::wasEvaluateCanceled()
void QmakeBuildSystem::asyncUpdate()
{
TaskHub::clearTasks(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
setParseDelay(UPDATE_INTERVAL);
TRACE("");
@@ -671,7 +672,7 @@ void QmakeBuildSystem::asyncUpdate()
"have a valid Qt.")
.arg(project()->displayName(), k->displayName())
: tr("Cannot parse project \"%1\": No kit selected.").arg(project()->displayName());
proFileParseError(errorMessage);
proFileParseError(errorMessage, project()->projectFilePath());
m_asyncUpdateFutureInterface.reportCanceled();
m_asyncUpdateFutureInterface.reportFinished();
return;
@@ -761,9 +762,9 @@ FilePath QmakeBuildSystem::buildDir(const FilePath &proFilePath) const
return FilePath::fromString(QDir::cleanPath(QDir(buildDir).absoluteFilePath(relativeDir)));
}
void QmakeBuildSystem::proFileParseError(const QString &errorMessage)
void QmakeBuildSystem::proFileParseError(const QString &errorMessage, const FilePath &filePath)
{
Core::MessageManager::write(errorMessage);
TaskHub::addTask(BuildSystemTask(Task::Error, errorMessage, filePath));
}
QtSupport::ProFileReader *QmakeBuildSystem::createProFileReader(const QmakeProFile *qmakeProFile)

View File

@@ -158,7 +158,7 @@ public:
void watchFolders(const QStringList &l, QmakePriFile *file);
void unwatchFolders(const QStringList &l, QmakePriFile *file);
static void proFileParseError(const QString &errorMessage);
static void proFileParseError(const QString &errorMessage, const Utils::FilePath &filePath);
enum AsyncUpdateState { Base, AsyncFullUpdatePending, AsyncPartialUpdatePending, AsyncUpdateInProgress, ShuttingDown };
AsyncUpdateState asyncUpdateState() const;

View File

@@ -26,10 +26,12 @@
#include "profilereader.h"
#include <coreplugin/icore.h>
#include <projectexplorer/taskhub.h>
#include <QCoreApplication>
#include <QDebug>
using namespace ProjectExplorer;
using namespace QtSupport;
static QString format(const QString &fileName, int lineNo, const QString &msg)
@@ -53,7 +55,7 @@ ProMessageHandler::ProMessageHandler(bool verbose, bool exact)
ProMessageHandler::~ProMessageHandler()
{
if (!m_messages.isEmpty())
Core::MessageManager::writeMessages(m_messages);
Core::MessageManager::writeMessages(m_messages, Core::MessageManager::Flash);
}
@@ -61,14 +63,22 @@ ProMessageHandler::~ProMessageHandler()
void ProMessageHandler::message(int type, const QString &msg, const QString &fileName, int lineNo)
{
if ((type & CategoryMask) == ErrorMessage && ((type & SourceMask) == SourceParser || m_verbose)) {
appendMessage(format(fileName, lineNo, msg));
// parse error in qmake files
TaskHub::addTask(
BuildSystemTask(Task::Error, msg, Utils::FilePath::fromString(fileName), lineNo));
}
}
void ProMessageHandler::fileMessage(int type, const QString &msg)
{
Q_UNUSED(type)
if (m_verbose)
// message(), warning() or error() calls in qmake files
if (!m_verbose)
return;
if (type == QMakeHandler::ErrorMessage)
TaskHub::addTask(BuildSystemTask(Task::Error, msg));
else if (type == QMakeHandler::WarningMessage)
TaskHub::addTask(BuildSystemTask(Task::Warning, msg));
else
appendMessage(msg);
}