ProjectExplorer: Generalize issues -> output pane linking

This feature was specific to the compile output pane, but we want
to have it in other panes too.

Change-Id: I110b27af7d0aa23acbc5623d1c0405816250df19
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2021-11-25 12:31:14 +01:00
parent 857ca05ac3
commit 08a86169db
11 changed files with 82 additions and 62 deletions

View File

@@ -27,22 +27,25 @@
#include "task.h"
#include "compileoutputwindow.h"
#include <coreplugin/ioutputpane.h>
#include <coreplugin/outputwindow.h>
#include <utils/algorithm.h>
#include <QAction>
namespace ProjectExplorer {
namespace Internal {
ShowOutputTaskHandler::ShowOutputTaskHandler(CompileOutputWindow *window) :
m_window(window)
ShowOutputTaskHandler::ShowOutputTaskHandler(Core::IOutputPane *window) : m_window(window)
{
Q_ASSERT(m_window);
}
bool ShowOutputTaskHandler::canHandle(const Task &task) const
{
return m_window->knowsPositionOf(task);
return Utils::anyOf(m_window->outputWindows(), [task](const Core::OutputWindow *ow) {
return ow->knowsPositionOf(task.taskId);
});
}
void ShowOutputTaskHandler::handle(const Task &task)
@@ -50,7 +53,12 @@ void ShowOutputTaskHandler::handle(const Task &task)
Q_ASSERT(canHandle(task));
// popup first as this does move the visible area!
m_window->popup(Core::IOutputPane::Flags(Core::IOutputPane::ModeSwitch | Core::IOutputPane::WithFocus));
m_window->showPositionOf(task);
for (Core::OutputWindow * const ow : m_window->outputWindows()) {
if (ow->knowsPositionOf(task.taskId)) {
ow->showPositionOf(task.taskId);
break;
}
}
}
QAction *ShowOutputTaskHandler::createAction(QObject *parent) const