diff --git a/src/plugins/projectexplorer/kit.cpp b/src/plugins/projectexplorer/kit.cpp index c0cebbd0c80..decc1d0a72d 100644 --- a/src/plugins/projectexplorer/kit.cpp +++ b/src/plugins/projectexplorer/kit.cpp @@ -532,34 +532,15 @@ IOutputParser *Kit::createOutputParser() const QString Kit::toHtml(const QList &additional) const { - QString rc; - QTextStream str(&rc); + QString result; + QTextStream str(&result); str << ""; str << "

" << displayName() << "

"; + + if (!isValid() || hasWarning() || !additional.isEmpty()) + str << "

" << toHtml(additional + validate()) << "

"; + str << ""; - - if (!isValid() || hasWarning() || !additional.isEmpty()) { - QList issues = additional; - issues.append(validate()); - str << "

"; - foreach (const Task &t, issues) { - str << ""; - switch (t.type) { - case Task::Error: - str << QCoreApplication::translate("ProjectExplorer::Kit", "Error:") << " "; - break; - case Task::Warning: - str << QCoreApplication::translate("ProjectExplorer::Kit", "Warning:") << " "; - break; - case Task::Unknown: - default: - break; - } - str << "" << t.description << "
"; - } - str << "

"; - } - QList infoList = KitManager::kitInformation(); foreach (KitInformation *ki, infoList) { KitInformation::ItemList list = ki->toUserOutput(this); @@ -576,7 +557,7 @@ QString Kit::toHtml(const QList &additional) const } } str << "
"; - return rc; + return result; } void Kit::setAutoDetected(bool detected) diff --git a/src/plugins/projectexplorer/task.cpp b/src/plugins/projectexplorer/task.cpp index bc8fc334a60..7adbbed74a8 100644 --- a/src/plugins/projectexplorer/task.cpp +++ b/src/plugins/projectexplorer/task.cpp @@ -32,6 +32,8 @@ #include "projectexplorerconstants.h" +#include + namespace ProjectExplorer { @@ -149,4 +151,27 @@ uint qHash(const Task &task) return task.taskId; } +QString toHtml(const QList &issues) +{ + QString result; + QTextStream str(&result); + + for (const Task &t : issues) { + str << ""; + switch (t.type) { + case Task::Error: + str << QCoreApplication::translate("ProjectExplorer::Kit", "Error:") << " "; + break; + case Task::Warning: + str << QCoreApplication::translate("ProjectExplorer::Kit", "Warning:") << " "; + break; + case Task::Unknown: + default: + break; + } + str << "" << t.description << "
"; + } + return result; +} + } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/task.h b/src/plugins/projectexplorer/task.h index be63662f807..7a29db5d4aa 100644 --- a/src/plugins/projectexplorer/task.h +++ b/src/plugins/projectexplorer/task.h @@ -98,6 +98,8 @@ uint PROJECTEXPLORER_EXPORT qHash(const Task &task); bool PROJECTEXPLORER_EXPORT operator<(const Task &a, const Task &b); +QString PROJECTEXPLORER_EXPORT toHtml(const QList &issues); + } //namespace ProjectExplorer Q_DECLARE_METATYPE(ProjectExplorer::Task)