aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2020-05-12 16:26:34 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2020-05-14 08:23:59 +0000
commitb02f6b5d30a81040ad5f4912d689926ddc4da95a (patch)
treeafc214dcbbaa8331c096e0f04489e28ced5898ab /src
parente35f945758e46051a85c7d33a91eedcf31f5d98a (diff)
ProjectExplorer: Give the Task class an explicit summary
We'd like to create more useful tasks from compiler output, that is, try harder to identify consecutive lines that refer to the same issue and create one task for them, rather than one for each line. In such "aggregate" tasks, the first line will not necessarily carry the main information. Therefore, we make it explicit what this main information is by introducing a dedicated summary member. Also streamline the font handling for compile tasks. Change-Id: I933f2643a13c710dab1ab548c56669b129026eb5 Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/baremetal/iarewparser.cpp32
-rw-r--r--src/plugins/baremetal/keilparser.cpp29
-rw-r--r--src/plugins/baremetal/keilparser.h1
-rw-r--r--src/plugins/baremetal/sdccparser.cpp16
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeparser.cpp11
-rw-r--r--src/plugins/debugger/debuggerruncontrol.cpp2
-rw-r--r--src/plugins/help/searchtaskhandler.cpp7
-rw-r--r--src/plugins/projectexplorer/clangparser.cpp2
-rw-r--r--src/plugins/projectexplorer/configtaskhandler.cpp2
-rw-r--r--src/plugins/projectexplorer/copytaskhandler.cpp2
-rw-r--r--src/plugins/projectexplorer/extracompiler.cpp2
-rw-r--r--src/plugins/projectexplorer/gccparser.cpp20
-rw-r--r--src/plugins/projectexplorer/gccparser.h2
-rw-r--r--src/plugins/projectexplorer/ioutputparser.cpp15
-rw-r--r--src/plugins/projectexplorer/ioutputparser.h1
-rw-r--r--src/plugins/projectexplorer/ldparser.cpp2
-rw-r--r--src/plugins/projectexplorer/linuxiccparser.cpp21
-rw-r--r--src/plugins/projectexplorer/linuxiccparser.h1
-rw-r--r--src/plugins/projectexplorer/msvcparser.cpp25
-rw-r--r--src/plugins/projectexplorer/outputparser_test.cpp2
-rw-r--r--src/plugins/projectexplorer/targetsetupwidget.cpp2
-rw-r--r--src/plugins/projectexplorer/task.cpp22
-rw-r--r--src/plugins/projectexplorer/task.h5
-rw-r--r--src/plugins/projectexplorer/taskhub.cpp6
-rw-r--r--src/plugins/projectexplorer/taskmodel.cpp4
-rw-r--r--src/plugins/python/pythonrunconfiguration.cpp6
-rw-r--r--src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp2
-rw-r--r--src/plugins/qtsupport/qttestparser.cpp2
-rw-r--r--src/tools/buildoutputparser/outputprocessor.cpp2
29 files changed, 89 insertions, 157 deletions
diff --git a/src/plugins/baremetal/iarewparser.cpp b/src/plugins/baremetal/iarewparser.cpp
index 5e8b97fa62..4ee139c778 100644
--- a/src/plugins/baremetal/iarewparser.cpp
+++ b/src/plugins/baremetal/iarewparser.cpp
@@ -28,9 +28,6 @@
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/task.h>
-#include <texteditor/fontsettings.h>
-#include <texteditor/texteditorsettings.h>
-
#include <QRegularExpression>
using namespace ProjectExplorer;
@@ -69,28 +66,6 @@ void IarParser::newTask(const Task &task)
m_lines = 1;
}
-void IarParser::amendDescription()
-{
- while (!m_descriptionParts.isEmpty())
- m_lastTask.description.append(m_descriptionParts.takeFirst());
-
- while (!m_snippets.isEmpty()) {
- const QString snippet = m_snippets.takeFirst();
- const int start = m_lastTask.description.count() + 1;
- m_lastTask.description.append('\n');
- m_lastTask.description.append(snippet);
-
- QTextLayout::FormatRange fr;
- fr.start = start;
- fr.length = m_lastTask.description.count() + 1;
- fr.format.setFont(TextEditor::TextEditorSettings::fontSettings().font());
- fr.format.setFontStyleHint(QFont::Monospace);
- m_lastTask.formats.append(fr);
-
- ++m_lines;
- }
-}
-
void IarParser::amendFilePath()
{
if (m_filePathParts.isEmpty())
@@ -251,7 +226,12 @@ void IarParser::flush()
if (m_lastTask.isNull())
return;
- amendDescription();
+ while (!m_descriptionParts.isEmpty())
+ m_lastTask.summary.append(m_descriptionParts.takeFirst());
+ m_lastTask.details = m_snippets;
+ m_snippets.clear();
+ m_lines += m_lastTask.details.count();
+ setMonospacedDetailsFormat(m_lastTask);
amendFilePath();
m_expectSnippet = true;
diff --git a/src/plugins/baremetal/keilparser.cpp b/src/plugins/baremetal/keilparser.cpp
index 3e5032566b..cc0eb1b1b8 100644
--- a/src/plugins/baremetal/keilparser.cpp
+++ b/src/plugins/baremetal/keilparser.cpp
@@ -28,9 +28,6 @@
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/task.h>
-#include <texteditor/fontsettings.h>
-#include <texteditor/texteditorsettings.h>
-
#include <QRegularExpression>
using namespace ProjectExplorer;
@@ -71,26 +68,6 @@ void KeilParser::newTask(const Task &task)
m_lines = 1;
}
-void KeilParser::amendDescription()
-{
- while (!m_snippets.isEmpty()) {
- const QString snippet = m_snippets.takeFirst();
-
- const int start = m_lastTask.description.count() + 1;
- m_lastTask.description.append('\n');
- m_lastTask.description.append(snippet);
-
- QTextLayout::FormatRange fr;
- fr.start = start;
- fr.length = m_lastTask.description.count() + 1;
- fr.format.setFont(TextEditor::TextEditorSettings::fontSettings().font());
- fr.format.setFontStyleHint(QFont::Monospace);
- m_lastTask.formats.append(fr);
-
- ++m_lines;
- }
-}
-
// ARM compiler specific parsers.
OutputLineParser::Result KeilParser::parseArmWarningOrErrorDetailsMessage(const QString &lne)
@@ -278,8 +255,10 @@ void KeilParser::flush()
if (m_lastTask.isNull())
return;
- amendDescription();
-
+ m_lastTask.details = m_snippets;
+ m_snippets.clear();
+ m_lines += m_lastTask.details.count();
+ setMonospacedDetailsFormat(m_lastTask);
Task t = m_lastTask;
m_lastTask.clear();
scheduleTask(t, m_lines, 1);
diff --git a/src/plugins/baremetal/keilparser.h b/src/plugins/baremetal/keilparser.h
index f8f5f8b97d..26fa00fdea 100644
--- a/src/plugins/baremetal/keilparser.h
+++ b/src/plugins/baremetal/keilparser.h
@@ -43,7 +43,6 @@ public:
private:
void newTask(const ProjectExplorer::Task &task);
- void amendDescription();
// ARM compiler specific parsers.
Result parseArmWarningOrErrorDetailsMessage(const QString &lne);
diff --git a/src/plugins/baremetal/sdccparser.cpp b/src/plugins/baremetal/sdccparser.cpp
index 9ed21234d9..b7e60aafeb 100644
--- a/src/plugins/baremetal/sdccparser.cpp
+++ b/src/plugins/baremetal/sdccparser.cpp
@@ -28,9 +28,6 @@
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/task.h>
-#include <texteditor/fontsettings.h>
-#include <texteditor/texteditorsettings.h>
-
#include <QRegularExpression>
using namespace ProjectExplorer;
@@ -73,17 +70,7 @@ void SdccParser::newTask(const Task &task)
void SdccParser::amendDescription(const QString &desc)
{
- const int start = m_lastTask.description.count() + 1;
- m_lastTask.description.append('\n');
- m_lastTask.description.append(desc);
-
- QTextLayout::FormatRange fr;
- fr.start = start;
- fr.length = m_lastTask.description.count() + 1;
- fr.format.setFont(TextEditor::TextEditorSettings::fontSettings().font());
- fr.format.setFontStyleHint(QFont::Monospace);
- m_lastTask.formats.append(fr);
-
+ m_lastTask.details.append(desc);
++m_lines;
}
@@ -165,6 +152,7 @@ void SdccParser::flush()
if (m_lastTask.isNull())
return;
+ setMonospacedDetailsFormat(m_lastTask);
Task t = m_lastTask;
m_lastTask.clear();
scheduleTask(t, m_lines, 1);
diff --git a/src/plugins/cmakeprojectmanager/cmakeparser.cpp b/src/plugins/cmakeprojectmanager/cmakeparser.cpp
index 2d8aa7c022..2e008791e7 100644
--- a/src/plugins/cmakeprojectmanager/cmakeparser.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeparser.cpp
@@ -101,9 +101,9 @@ OutputLineParser::Result CMakeParser::handleLine(const QString &line, OutputForm
m_lines = 1;
return {Status::InProgress, linkSpecs};
} else if (trimmedLine.startsWith(QLatin1String(" ")) && !m_lastTask.isNull()) {
- if (!m_lastTask.description.isEmpty())
- m_lastTask.description.append(QLatin1Char(' '));
- m_lastTask.description.append(trimmedLine.trimmed());
+ if (!m_lastTask.summary.isEmpty())
+ m_lastTask.summary.append(' ');
+ m_lastTask.summary.append(trimmedLine.trimmed());
++m_lines;
return Status::InProgress;
} else if (trimmedLine.endsWith(QLatin1String("in cmake code at"))) {
@@ -136,7 +136,7 @@ OutputLineParser::Result CMakeParser::handleLine(const QString &line, OutputForm
return {Status::InProgress, linkSpecs};
}
case LINE_DESCRIPTION:
- m_lastTask.description = trimmedLine;
+ m_lastTask.summary = trimmedLine;
if (trimmedLine.endsWith(QLatin1Char('\"')))
m_expectTripleLineErrorData = LINE_DESCRIPTION2;
else {
@@ -146,8 +146,7 @@ OutputLineParser::Result CMakeParser::handleLine(const QString &line, OutputForm
}
return Status::InProgress;
case LINE_DESCRIPTION2:
- m_lastTask.description.append(QLatin1Char('\n'));
- m_lastTask.description.append(trimmedLine);
+ m_lastTask.details.append(trimmedLine);
m_expectTripleLineErrorData = NONE;
flush();
return Status::Done;
diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp
index a5339cb2f7..055dc97146 100644
--- a/src/plugins/debugger/debuggerruncontrol.cpp
+++ b/src/plugins/debugger/debuggerruncontrol.cpp
@@ -977,7 +977,7 @@ DebuggerRunTool::DebuggerRunTool(RunControl *runControl, AllowTerminal allowTerm
const Tasks tasks = DebuggerKitAspect::validateDebugger(kit);
for (const Task &t : tasks) {
if (t.type != Task::Warning)
- m_runParameters.validationErrors.append(t.description);
+ m_runParameters.validationErrors.append(t.description());
}
RunConfiguration *runConfig = runControl->runConfiguration();
diff --git a/src/plugins/help/searchtaskhandler.cpp b/src/plugins/help/searchtaskhandler.cpp
index 2971d7bff4..8df2a71565 100644
--- a/src/plugins/help/searchtaskhandler.cpp
+++ b/src/plugins/help/searchtaskhandler.cpp
@@ -36,15 +36,12 @@ using namespace Help::Internal;
bool SearchTaskHandler::canHandle(const ProjectExplorer::Task &task) const
{
- return !task.description.isEmpty()
- && !task.description.startsWith(QLatin1Char('\n'));
+ return !task.summary.isEmpty();
}
void SearchTaskHandler::handle(const ProjectExplorer::Task &task)
{
- const int eol = task.description.indexOf(QLatin1Char('\n'));
- const QUrl url(QLatin1String("https://www.google.com/search?q=") + task.description.left(eol));
- emit search(url);
+ emit search(QUrl("https://www.google.com/search?q=" + task.summary));
}
QAction *SearchTaskHandler::createAction(QObject *parent) const
diff --git a/src/plugins/projectexplorer/clangparser.cpp b/src/plugins/projectexplorer/clangparser.cpp
index 1ea867ca6d..9198ea5af3 100644
--- a/src/plugins/projectexplorer/clangparser.cpp
+++ b/src/plugins/projectexplorer/clangparser.cpp
@@ -112,7 +112,7 @@ OutputLineParser::Result ClangParser::handleLine(const QString &line, OutputForm
}
if (m_expectSnippet) {
- amendDescription(lne, true);
+ amendDescription(lne);
return Status::InProgress;
}
diff --git a/src/plugins/projectexplorer/configtaskhandler.cpp b/src/plugins/projectexplorer/configtaskhandler.cpp
index e3c5ed58d5..e7daf060c2 100644
--- a/src/plugins/projectexplorer/configtaskhandler.cpp
+++ b/src/plugins/projectexplorer/configtaskhandler.cpp
@@ -44,7 +44,7 @@ ConfigTaskHandler::ConfigTaskHandler(const Task &pattern, Core::Id page) :
bool ConfigTaskHandler::canHandle(const Task &task) const
{
- return task.description == m_pattern.description
+ return task.description() == m_pattern.description()
&& task.category == m_pattern.category;
}
diff --git a/src/plugins/projectexplorer/copytaskhandler.cpp b/src/plugins/projectexplorer/copytaskhandler.cpp
index 1896eb2f7d..574cad4b90 100644
--- a/src/plugins/projectexplorer/copytaskhandler.cpp
+++ b/src/plugins/projectexplorer/copytaskhandler.cpp
@@ -54,7 +54,7 @@ void CopyTaskHandler::handle(const Task &task)
QApplication::clipboard()->setText(task.file.toUserOutput() + QLatin1Char(':') +
QString::number(task.line) + QLatin1String(": ")
- + type + task.description);
+ + type + task.description());
}
Core::Id CopyTaskHandler::actionManagerId() const
diff --git a/src/plugins/projectexplorer/extracompiler.cpp b/src/plugins/projectexplorer/extracompiler.cpp
index bfb7164550..1a764712ca 100644
--- a/src/plugins/projectexplorer/extracompiler.cpp
+++ b/src/plugins/projectexplorer/extracompiler.cpp
@@ -292,7 +292,7 @@ void ExtraCompilerPrivate::updateIssues()
const auto fontSettings = TextEditor::TextEditorSettings::instance()->fontSettings();
selection.format = fontSettings.toTextCharFormat(issue.type == Task::Warning ?
TextEditor::C_WARNING : TextEditor::C_ERROR);
- selection.format.setToolTip(issue.description);
+ selection.format.setToolTip(issue.description());
selections.append(selection);
}
diff --git a/src/plugins/projectexplorer/gccparser.cpp b/src/plugins/projectexplorer/gccparser.cpp
index 2e55e9178f..2f2653703e 100644
--- a/src/plugins/projectexplorer/gccparser.cpp
+++ b/src/plugins/projectexplorer/gccparser.cpp
@@ -30,8 +30,6 @@
#include "projectexplorerconstants.h"
#include "buildmanager.h"
-#include <texteditor/fontsettings.h>
-#include <texteditor/texteditorsettings.h>
#include <utils/qtcassert.h>
using namespace ProjectExplorer;
@@ -82,27 +80,19 @@ void GccParser::flush()
{
if (m_currentTask.isNull())
return;
+
+ setMonospacedDetailsFormat(m_currentTask);
Task t = m_currentTask;
m_currentTask.clear();
scheduleTask(t, m_lines, 1);
m_lines = 0;
}
-void GccParser::amendDescription(const QString &desc, bool monospaced)
+void GccParser::amendDescription(const QString &desc)
{
if (m_currentTask.isNull())
return;
- int start = m_currentTask.description.count() + 1;
- m_currentTask.description.append(QLatin1Char('\n'));
- m_currentTask.description.append(desc);
- if (monospaced) {
- QTextLayout::FormatRange fr;
- fr.start = start;
- fr.length = desc.count() + 1;
- fr.format.setFont(TextEditor::TextEditorSettings::fontSettings().font());
- fr.format.setFontStyleHint(QFont::Monospace);
- m_currentTask.formats.append(fr);
- }
+ m_currentTask.details.append(desc);
++m_lines;
return;
}
@@ -174,7 +164,7 @@ OutputLineParser::Result GccParser::handleLine(const QString &line, OutputFormat
newTask(CompileTask(Task::Unknown, lne.trimmed() /* description */, filePath, lineNo));
return {Status::InProgress, linkSpecs};
} else if (lne.startsWith(' ') && !m_currentTask.isNull()) {
- amendDescription(lne, true);
+ amendDescription(lne);
return Status::InProgress;
}
diff --git a/src/plugins/projectexplorer/gccparser.h b/src/plugins/projectexplorer/gccparser.h
index 76afb53668..326b02a47d 100644
--- a/src/plugins/projectexplorer/gccparser.h
+++ b/src/plugins/projectexplorer/gccparser.h
@@ -48,7 +48,7 @@ protected:
void newTask(const Task &task);
void flush() override;
- void amendDescription(const QString &desc, bool monospaced);
+ void amendDescription(const QString &desc);
private:
Result handleLine(const QString &line, Utils::OutputFormat type) override;
diff --git a/src/plugins/projectexplorer/ioutputparser.cpp b/src/plugins/projectexplorer/ioutputparser.cpp
index 72d4e28fe1..6bda7560f4 100644
--- a/src/plugins/projectexplorer/ioutputparser.cpp
+++ b/src/plugins/projectexplorer/ioutputparser.cpp
@@ -28,6 +28,9 @@
#include "task.h"
#include "taskhub.h"
+#include <texteditor/fontsettings.h>
+#include <texteditor/texteditorsettings.h>
+
/*!
\class ProjectExplorer::OutputTaskParser
@@ -91,6 +94,18 @@ void OutputTaskParser::scheduleTask(const Task &task, int outputLines, int skipp
QTC_CHECK(d->scheduledTasks.size() <= 2);
}
+void OutputTaskParser::setMonospacedDetailsFormat(Task &task)
+{
+ if (task.details.isEmpty())
+ return;
+ QTextLayout::FormatRange fr;
+ fr.start = task.summary.length() + 1;
+ fr.length = task.details.join('\n').length();
+ fr.format.setFont(TextEditor::TextEditorSettings::fontSettings().font());
+ fr.format.setFontStyleHint(QFont::Monospace);
+ task.formats = {fr};
+}
+
void OutputTaskParser::runPostPrintActions()
{
for (const TaskInfo &t : qAsConst(d->scheduledTasks))
diff --git a/src/plugins/projectexplorer/ioutputparser.h b/src/plugins/projectexplorer/ioutputparser.h
index 9a8ce59be1..d3d5f3c024 100644
--- a/src/plugins/projectexplorer/ioutputparser.h
+++ b/src/plugins/projectexplorer/ioutputparser.h
@@ -54,6 +54,7 @@ public:
protected:
void scheduleTask(const Task &task, int outputLines, int skippedLines = 0);
+ void setMonospacedDetailsFormat(Task &task);
private:
void runPostPrintActions() override;
diff --git a/src/plugins/projectexplorer/ldparser.cpp b/src/plugins/projectexplorer/ldparser.cpp
index 135401dd1c..325e123b51 100644
--- a/src/plugins/projectexplorer/ldparser.cpp
+++ b/src/plugins/projectexplorer/ldparser.cpp
@@ -77,7 +77,7 @@ Utils::OutputLineParser::Result LdParser::handleLine(const QString &line, Utils:
return Status::InProgress;
}
if (!m_incompleteTask.isNull() && lne.startsWith(" ")) {
- m_incompleteTask.description.append('\n').append(lne);
+ m_incompleteTask.details.append(lne);
static const QRegularExpression locRegExp(" (?<symbol>\\S+) in (?<file>\\S+)");
const QRegularExpressionMatch match = locRegExp.match(lne);
LinkSpecs linkSpecs;
diff --git a/src/plugins/projectexplorer/linuxiccparser.cpp b/src/plugins/projectexplorer/linuxiccparser.cpp
index 49bdbcdc2a..99427de113 100644
--- a/src/plugins/projectexplorer/linuxiccparser.cpp
+++ b/src/plugins/projectexplorer/linuxiccparser.cpp
@@ -92,18 +92,7 @@ OutputLineParser::Result LinuxIccParser::handleLine(const QString &line, OutputF
return Status::InProgress;
}
if (!m_expectFirstLine && m_caretLine.indexIn(line) != -1) {
- // Format the last line as code
- QTextLayout::FormatRange fr;
- fr.start = m_temporary.description.lastIndexOf(QLatin1Char('\n')) + 1;
- fr.length = m_temporary.description.length() - fr.start;
- fr.format.setFontItalic(true);
- m_temporary.formats.append(fr);
-
- QTextLayout::FormatRange fr2;
- fr2.start = fr.start + line.indexOf(QLatin1Char('^')) - m_indent;
- fr2.length = 1;
- fr2.format.setFontWeight(QFont::Bold);
- m_temporary.formats.append(fr2);
+ // FIXME: m_temporary.details.append(line);
return Status::InProgress;
}
if (!m_expectFirstLine && line.trimmed().isEmpty()) { // last Line
@@ -113,11 +102,7 @@ OutputLineParser::Result LinuxIccParser::handleLine(const QString &line, OutputF
return Status::Done;
}
if (!m_expectFirstLine && m_continuationLines.indexIn(line) != -1) {
- m_temporary.description.append(QLatin1Char('\n'));
- m_indent = 0;
- while (m_indent < line.length() && line.at(m_indent).isSpace())
- m_indent++;
- m_temporary.description.append(m_continuationLines.cap(1).trimmed());
+ m_temporary.details.append(m_continuationLines.cap(1).trimmed());
++m_lines;
return Status::InProgress;
}
@@ -139,6 +124,8 @@ void LinuxIccParser::flush()
{
if (m_temporary.isNull())
return;
+
+ setMonospacedDetailsFormat(m_temporary);
Task t = m_temporary;
m_temporary.clear();
scheduleTask(t, m_lines, 1);
diff --git a/src/plugins/projectexplorer/linuxiccparser.h b/src/plugins/projectexplorer/linuxiccparser.h
index 44ff094c05..4d6a00264d 100644
--- a/src/plugins/projectexplorer/linuxiccparser.h
+++ b/src/plugins/projectexplorer/linuxiccparser.h
@@ -53,7 +53,6 @@ private:
QRegExp m_pchInfoLine;
bool m_expectFirstLine = true;
- int m_indent = 0;
Task m_temporary;
int m_lines = 0;
};
diff --git a/src/plugins/projectexplorer/msvcparser.cpp b/src/plugins/projectexplorer/msvcparser.cpp
index 22bf2c13de..072e1da8f8 100644
--- a/src/plugins/projectexplorer/msvcparser.cpp
+++ b/src/plugins/projectexplorer/msvcparser.cpp
@@ -113,26 +113,7 @@ OutputLineParser::Result MsvcParser::handleLine(const QString &line, OutputForma
if (m_lastTask.isNull())
return Status::NotHandled;
- m_lastTask.description.append('\n');
- m_lastTask.description.append(line.mid(8));
- // trim trailing spaces:
- int i = 0;
- for (i = m_lastTask.description.length() - 1; i >= 0; --i) {
- if (!m_lastTask.description.at(i).isSpace())
- break;
- }
- m_lastTask.description.truncate(i + 1);
-
- if (m_lastTask.formats.isEmpty()) {
- QTextLayout::FormatRange fr;
- fr.start = m_lastTask.description.indexOf('\n') + 1;
- fr.length = m_lastTask.description.length() - fr.start;
- fr.format.setFontItalic(true);
- m_lastTask.formats.append(fr);
- } else {
- m_lastTask.formats[0].length = m_lastTask.description.length()
- - m_lastTask.formats[0].start;
- }
+ m_lastTask.details.append(rightTrimmed(line.mid(8)));
++m_lines;
return Status::InProgress;
}
@@ -195,6 +176,7 @@ void MsvcParser::flush()
if (m_lastTask.isNull())
return;
+ setMonospacedDetailsFormat(m_lastTask);
Task t = m_lastTask;
m_lastTask.clear();
scheduleTask(t, m_lines, 1);
@@ -275,8 +257,7 @@ OutputLineParser::Result ClangClParser::handleLine(const QString &line, OutputFo
flush();
return Status::Done;
}
- m_lastTask.description.append('\n');
- m_lastTask.description.append(trimmed);
+ m_lastTask.details.append(trimmed);
++m_linkedLines;
return Status::InProgress;
}
diff --git a/src/plugins/projectexplorer/outputparser_test.cpp b/src/plugins/projectexplorer/outputparser_test.cpp
index 8516a84de0..99d241bf13 100644
--- a/src/plugins/projectexplorer/outputparser_test.cpp
+++ b/src/plugins/projectexplorer/outputparser_test.cpp
@@ -83,7 +83,7 @@ void OutputParserTester::testParsing(const QString &lines,
if (m_receivedTasks.size() == tasks.size()) {
for (int i = 0; i < tasks.size(); ++i) {
QCOMPARE(m_receivedTasks.at(i).category, tasks.at(i).category);
- QCOMPARE(m_receivedTasks.at(i).description, tasks.at(i).description);
+ QCOMPARE(m_receivedTasks.at(i).description(), tasks.at(i).description());
QVERIFY2(m_receivedTasks.at(i).file == tasks.at(i).file,
msgFileComparisonFail(m_receivedTasks.at(i).file, tasks.at(i).file));
QCOMPARE(m_receivedTasks.at(i).line, tasks.at(i).line);
diff --git a/src/plugins/projectexplorer/targetsetupwidget.cpp b/src/plugins/projectexplorer/targetsetupwidget.cpp
index ca6e544350..2982ed9ad6 100644
--- a/src/plugins/projectexplorer/targetsetupwidget.cpp
+++ b/src/plugins/projectexplorer/targetsetupwidget.cpp
@@ -388,7 +388,7 @@ QPair<Task::TaskType, QString> TargetSetupWidget::findIssues(const BuildInfo &in
highestType = Task::Warning;
severity = tr("<b>Warning:</b> ", "Severity is Task::Warning");
}
- text.append(severity + t.description);
+ text.append(severity + t.description());
}
if (!text.isEmpty())
text = QLatin1String("<nobr>") + text;
diff --git a/src/plugins/projectexplorer/task.cpp b/src/plugins/projectexplorer/task.cpp
index aa39a85e3d..1e68e747d3 100644
--- a/src/plugins/projectexplorer/task.cpp
+++ b/src/plugins/projectexplorer/task.cpp
@@ -62,15 +62,20 @@ unsigned int Task::s_nextId = 1;
\sa ProjectExplorer::TaskHub
*/
-Task::Task(TaskType type_, const QString &description_,
+Task::Task(TaskType type_, const QString &description,
const Utils::FilePath &file_, int line_, Core::Id category_,
const QIcon &icon, Options options) :
- taskId(s_nextId), type(type_), options(options), description(description_),
+ taskId(s_nextId), type(type_), options(options), summary(description),
line(line_), movedLine(line_), category(category_),
icon(icon.isNull() ? taskTypeIcon(type_) : icon)
{
++s_nextId;
setFile(file_);
+ QStringList desc = description.split('\n');
+ if (desc.length() > 1) {
+ summary = desc.first();
+ details = desc.mid(1);
+ }
}
Task Task::compilerMissingTask()
@@ -97,7 +102,8 @@ void Task::clear()
{
taskId = 0;
type = Task::Unknown;
- description.clear();
+ summary.clear();
+ details.clear();
file = Utils::FilePath();
line = -1;
movedLine = -1;
@@ -119,6 +125,14 @@ void Task::setFile(const Utils::FilePath &file_)
}
}
+QString Task::description() const
+{
+ QString desc = summary;
+ if (!details.isEmpty())
+ desc.append('\n').append(details.join('\n'));
+ return desc;
+}
+
//
// functions
//
@@ -173,7 +187,7 @@ QString toHtml(const Tasks &issues)
default:
break;
}
- str << "</b>" << t.description << "<br>";
+ str << "</b>" << t.description() << "<br>";
}
return result;
}
diff --git a/src/plugins/projectexplorer/task.h b/src/plugins/projectexplorer/task.h
index 6055dec43e..d609a13584 100644
--- a/src/plugins/projectexplorer/task.h
+++ b/src/plugins/projectexplorer/task.h
@@ -32,6 +32,7 @@
#include <QIcon>
#include <QMetaType>
+#include <QStringList>
#include <QTextLayout>
namespace TextEditor {
@@ -72,11 +73,13 @@ public:
bool isNull() const;
void clear();
void setFile(const Utils::FilePath &file);
+ QString description() const;
unsigned int taskId = 0;
TaskType type = Unknown;
Options options = AddTextMark | FlashWorthy;
- QString description;
+ QString summary;
+ QStringList details;
Utils::FilePath file;
Utils::FilePaths fileCandidates;
int line = -1;
diff --git a/src/plugins/projectexplorer/taskhub.cpp b/src/plugins/projectexplorer/taskhub.cpp
index ea38fe0422..cb41d8fafe 100644
--- a/src/plugins/projectexplorer/taskhub.cpp
+++ b/src/plugins/projectexplorer/taskhub.cpp
@@ -74,9 +74,9 @@ public:
if (task.category == Constants::TASK_CATEGORY_COMPILE) {
setToolTip("<html><body><b>" + QApplication::translate("TaskHub", "Build Issue")
+ "</b><br/><code style=\"white-space:pre;font-family:monospace\">"
- + task.description.toHtmlEscaped() + "</code></body></html>");
+ + task.description().toHtmlEscaped() + "</code></body></html>");
} else {
- setToolTip(task.description);
+ setToolTip(task.description());
}
setIcon(task.icon);
setVisible(!task.icon.isNull());
@@ -152,7 +152,7 @@ void TaskHub::addTask(Task::TaskType type, const QString &description, Core::Id
void TaskHub::addTask(Task task)
{
QTC_ASSERT(m_registeredCategories.contains(task.category), return);
- QTC_ASSERT(!task.description.isEmpty(), return);
+ QTC_ASSERT(!task.description().isEmpty(), return);
QTC_ASSERT(!task.isNull(), return);
QTC_ASSERT(task.m_mark.isNull(), return);
diff --git a/src/plugins/projectexplorer/taskmodel.cpp b/src/plugins/projectexplorer/taskmodel.cpp
index f256f026cb..abcbc6732b 100644
--- a/src/plugins/projectexplorer/taskmodel.cpp
+++ b/src/plugins/projectexplorer/taskmodel.cpp
@@ -247,7 +247,7 @@ QVariant TaskModel::data(const QModelIndex &index, int role) const
else if (role == TaskModel::MovedLine)
return m_tasks.at(index.row()).movedLine;
else if (role == TaskModel::Description)
- return m_tasks.at(index.row()).description;
+ return m_tasks.at(index.row()).description();
else if (role == TaskModel::FileNotFound)
return m_fileNotFound.value(m_tasks.at(index.row()).file.toString());
else if (role == TaskModel::Type)
@@ -405,7 +405,7 @@ bool TaskFilterModel::filterAcceptsTask(const Task &task) const
return m_filterStringIsRegexp ? m_filterRegexp.isValid() && s.contains(m_filterRegexp)
: s.contains(m_filterText, m_filterCaseSensitivity);
};
- if ((accepts(task.file.toString()) || accepts(task.description)) == m_filterIsInverted)
+ if ((accepts(task.file.toString()) || accepts(task.description())) == m_filterIsInverted)
accept = false;
}
diff --git a/src/plugins/python/pythonrunconfiguration.cpp b/src/plugins/python/pythonrunconfiguration.cpp
index 30b3a18801..1b0db037b8 100644
--- a/src/plugins/python/pythonrunconfiguration.cpp
+++ b/src/plugins/python/pythonrunconfiguration.cpp
@@ -99,9 +99,9 @@ private:
m_tasks.append({Task::Warning, text.trimmed(), {}, -1, category});
} else {
Task &task = m_tasks.back();
- if (!task.description.isEmpty())
- task.description += ' ';
- task.description += text.trimmed();
+ if (!task.summary.isEmpty())
+ task.summary += ' ';
+ task.summary += text.trimmed();
}
} else {
// The actual exception. This ends the traceback.
diff --git a/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp b/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp
index 4cd0ab3d9a..6cf2179015 100644
--- a/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp
@@ -313,7 +313,7 @@ void QmakeBuildConfiguration::updateProblemLabel()
}
if (!text.endsWith(QLatin1String("br>")))
text.append(QLatin1String("<br>"));
- text.append(type + task.description);
+ text.append(type + task.description());
}
buildDirectoryAspect()->setProblem(text);
return;
diff --git a/src/plugins/qtsupport/qttestparser.cpp b/src/plugins/qtsupport/qttestparser.cpp
index 1e8a572f4a..ec9bde4dd1 100644
--- a/src/plugins/qtsupport/qttestparser.cpp
+++ b/src/plugins/qtsupport/qttestparser.cpp
@@ -78,7 +78,7 @@ OutputLineParser::Result QtTestParser::handleLine(const QString &line, OutputFor
emitCurrentTask();
return {Status::Done, linkSpecs};
}
- m_currentTask.description.append('\n').append(theLine);
+ m_currentTask.details.append(theLine);
return Status::InProgress;
}
diff --git a/src/tools/buildoutputparser/outputprocessor.cpp b/src/tools/buildoutputparser/outputprocessor.cpp
index d52876d214..11bcdfe77c 100644
--- a/src/tools/buildoutputparser/outputprocessor.cpp
+++ b/src/tools/buildoutputparser/outputprocessor.cpp
@@ -90,5 +90,5 @@ void CompilerOutputProcessor::handleTask(const ProjectExplorer::Task &task)
*m_ostream << ':' << task.line;
*m_ostream << ": ";
}
- *m_ostream << task.description << '\n';
+ *m_ostream << task.description() << '\n';
}