diff options
author | Francois Ferrand <thetypz@gmail.com> | 2010-06-25 10:41:49 +0200 |
---|---|---|
committer | Daniel Teske <daniel.teske@nokia.com> | 2012-03-09 11:27:26 +0100 |
commit | 54801c51636fbf0027a66fa2059cd54944c92807 (patch) | |
tree | d6de281ee77e7161f9b6643bc1e62f120c2c8446 /src/plugins/projectexplorer/compileoutputwindow.cpp | |
parent | 8877ae2793ac7848ec68272dbec8e27a16ad7f83 (diff) | |
download | qt-creator-54801c51636fbf0027a66fa2059cd54944c92807.tar.gz |
Open file when double-clicking in compile window
Track the tasks which are added, so that the generic parsers are
used for detecting file names.
Change-Id: Ie3bcf04c946fa45c99836dc4c29ca03ab5243fb2
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
Diffstat (limited to 'src/plugins/projectexplorer/compileoutputwindow.cpp')
-rw-r--r-- | src/plugins/projectexplorer/compileoutputwindow.cpp | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/src/plugins/projectexplorer/compileoutputwindow.cpp b/src/plugins/projectexplorer/compileoutputwindow.cpp index 2b941dc87c..d9406a603f 100644 --- a/src/plugins/projectexplorer/compileoutputwindow.cpp +++ b/src/plugins/projectexplorer/compileoutputwindow.cpp @@ -37,6 +37,7 @@ #include "projectexplorerconstants.h" #include "projectexplorer.h" #include "projectexplorersettings.h" +#include "taskhub.h" #include <coreplugin/icontext.h> #include <find/basetextfind.h> @@ -59,10 +60,50 @@ namespace { const int MAX_LINECOUNT = 50000; } +namespace ProjectExplorer { +namespace Internal { + +class CompileOutputTextEdit : public Core::OutputWindow +{ +public: + CompileOutputTextEdit(const Core::Context &context) : Core::OutputWindow(context) + { + } + + void addTask(const Task &task, int blocknumber) + { + m_taskids.insert(blocknumber, task.taskId); + } + + void clearTasks() + { + m_taskids.clear(); + } + +protected: + void mouseDoubleClickEvent(QMouseEvent *ev) + { + int line = cursorForPosition(ev->pos()).block().blockNumber(); + if (unsigned taskid = m_taskids.value(line, 0)) { + ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); + TaskHub *hub = pm->getObject<TaskHub>(); + hub->showTaskInEditor(taskid); + } else { + QPlainTextEdit::mouseDoubleClickEvent(ev); + } + } + +private: + QHash<int, unsigned int> m_taskids; //Map blocknumber to taskId +}; + +} // namespace Internal +} // namespace ProjectExplorer + CompileOutputWindow::CompileOutputWindow(BuildManager * /*bm*/) { Core::Context context(Constants::C_COMPILE_OUTPUT); - m_outputWindow = new Core::OutputWindow(context); + m_outputWindow = new CompileOutputTextEdit(context); m_outputWindow->setWindowTitle(tr("Compile Output")); m_outputWindow->setWindowIcon(QIcon(QLatin1String(Constants::ICON_WINDOW))); m_outputWindow->setReadOnly(true); @@ -148,6 +189,7 @@ void CompileOutputWindow::appendText(const QString &text, ProjectExplorer::Build void CompileOutputWindow::clearContents() { m_outputWindow->clear(); + m_outputWindow->clearTasks(); m_taskPositions.clear(); } @@ -191,7 +233,9 @@ void CompileOutputWindow::registerPositionOf(const Task &task) int blocknumber = m_outputWindow->blockCount(); if (blocknumber > MAX_LINECOUNT) return; + m_taskPositions.insert(task.taskId, blocknumber); + m_outputWindow->addTask(task, blocknumber); } bool CompileOutputWindow::knowsPositionOf(const Task &task) |