Commit 05ea06a4 authored by Christoph Cullmann's avatar Christoph Cullmann 🐮
Browse files

show tool view for output on >= warning

parent e96dd60f
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
*/ */
#include "kateoutputview.h" #include "kateoutputview.h"
#include "katemainwindow.h"
#include <KLocalizedString> #include <KLocalizedString>
...@@ -91,12 +92,15 @@ void KateOutputView::slotMessage(const QVariantMap &message) ...@@ -91,12 +92,15 @@ void KateOutputView::slotMessage(const QVariantMap &message)
/** /**
* type column: shows the type, icons for some types only * type column: shows the type, icons for some types only
*/ */
bool shouldShowOutputToolView = false;
auto typeColumn = new QStandardItem(); auto typeColumn = new QStandardItem();
const auto typeString = message.value(QStringLiteral("type")).toString(); const auto typeString = message.value(QStringLiteral("type")).toString();
if (typeString == QLatin1String("Error")) { if (typeString == QLatin1String("Error")) {
shouldShowOutputToolView = true;
typeColumn->setText(i18nc("@info", "Error")); typeColumn->setText(i18nc("@info", "Error"));
typeColumn->setIcon(QIcon::fromTheme(QStringLiteral("data-error"))); typeColumn->setIcon(QIcon::fromTheme(QStringLiteral("data-error")));
} else if (typeString == QLatin1String("Warning")) { } else if (typeString == QLatin1String("Warning")) {
shouldShowOutputToolView = true;
typeColumn->setText(i18nc("@info", "Warning")); typeColumn->setText(i18nc("@info", "Warning"));
typeColumn->setIcon(QIcon::fromTheme(QStringLiteral("data-warning"))); typeColumn->setIcon(QIcon::fromTheme(QStringLiteral("data-warning")));
} else if (typeString == QLatin1String("Info")) { } else if (typeString == QLatin1String("Info")) {
...@@ -118,4 +122,11 @@ void KateOutputView::slotMessage(const QVariantMap &message) ...@@ -118,4 +122,11 @@ void KateOutputView::slotMessage(const QVariantMap &message)
* add new message to model as one row * add new message to model as one row
*/ */
m_messagesModel.appendRow({typeColumn, bodyColumn}); m_messagesModel.appendRow({typeColumn, bodyColumn});
/**
* if message requires it => show the tool view if hidden
*/
if (shouldShowOutputToolView) {
m_mainWindow->showToolView(parentWidget());
}
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment