forked from qt-creator/qt-creator
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>
This commit is contained in:
committed by
Daniel Teske
parent
8877ae2793
commit
54801c5163
@@ -37,6 +37,7 @@
|
|||||||
#include "projectexplorerconstants.h"
|
#include "projectexplorerconstants.h"
|
||||||
#include "projectexplorer.h"
|
#include "projectexplorer.h"
|
||||||
#include "projectexplorersettings.h"
|
#include "projectexplorersettings.h"
|
||||||
|
#include "taskhub.h"
|
||||||
|
|
||||||
#include <coreplugin/icontext.h>
|
#include <coreplugin/icontext.h>
|
||||||
#include <find/basetextfind.h>
|
#include <find/basetextfind.h>
|
||||||
@@ -59,10 +60,50 @@ namespace {
|
|||||||
const int MAX_LINECOUNT = 50000;
|
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*/)
|
CompileOutputWindow::CompileOutputWindow(BuildManager * /*bm*/)
|
||||||
{
|
{
|
||||||
Core::Context context(Constants::C_COMPILE_OUTPUT);
|
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->setWindowTitle(tr("Compile Output"));
|
||||||
m_outputWindow->setWindowIcon(QIcon(QLatin1String(Constants::ICON_WINDOW)));
|
m_outputWindow->setWindowIcon(QIcon(QLatin1String(Constants::ICON_WINDOW)));
|
||||||
m_outputWindow->setReadOnly(true);
|
m_outputWindow->setReadOnly(true);
|
||||||
@@ -148,6 +189,7 @@ void CompileOutputWindow::appendText(const QString &text, ProjectExplorer::Build
|
|||||||
void CompileOutputWindow::clearContents()
|
void CompileOutputWindow::clearContents()
|
||||||
{
|
{
|
||||||
m_outputWindow->clear();
|
m_outputWindow->clear();
|
||||||
|
m_outputWindow->clearTasks();
|
||||||
m_taskPositions.clear();
|
m_taskPositions.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,7 +233,9 @@ void CompileOutputWindow::registerPositionOf(const Task &task)
|
|||||||
int blocknumber = m_outputWindow->blockCount();
|
int blocknumber = m_outputWindow->blockCount();
|
||||||
if (blocknumber > MAX_LINECOUNT)
|
if (blocknumber > MAX_LINECOUNT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_taskPositions.insert(task.taskId, blocknumber);
|
m_taskPositions.insert(task.taskId, blocknumber);
|
||||||
|
m_outputWindow->addTask(task, blocknumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CompileOutputWindow::knowsPositionOf(const Task &task)
|
bool CompileOutputWindow::knowsPositionOf(const Task &task)
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ class Task;
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class ShowOutputTaskHandler;
|
class ShowOutputTaskHandler;
|
||||||
|
class CompileOutputTextEdit;
|
||||||
|
|
||||||
class CompileOutputWindow : public Core::IOutputPane
|
class CompileOutputWindow : public Core::IOutputPane
|
||||||
{
|
{
|
||||||
@@ -86,7 +87,7 @@ private slots:
|
|||||||
void updateWordWrapMode();
|
void updateWordWrapMode();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Core::OutputWindow *m_outputWindow;
|
CompileOutputTextEdit *m_outputWindow;
|
||||||
QHash<unsigned int, int> m_taskPositions;
|
QHash<unsigned int, int> m_taskPositions;
|
||||||
ShowOutputTaskHandler * m_handler;
|
ShowOutputTaskHandler * m_handler;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -132,6 +132,11 @@ void TaskHub::taskMarkClicked(unsigned int id)
|
|||||||
emit showTask(id);
|
emit showTask(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TaskHub::showTaskInEditor(unsigned int id)
|
||||||
|
{
|
||||||
|
emit openTask(id);
|
||||||
|
}
|
||||||
|
|
||||||
void TaskHub::setCategoryVisibility(const Core::Id &categoryId, bool visible)
|
void TaskHub::setCategoryVisibility(const Core::Id &categoryId, bool visible)
|
||||||
{
|
{
|
||||||
emit categoryVisibilityChanged(categoryId, visible);
|
emit categoryVisibilityChanged(categoryId, visible);
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ public:
|
|||||||
void removeTask(const Task &task);
|
void removeTask(const Task &task);
|
||||||
void updateTaskLineNumber(unsigned int id, int line);
|
void updateTaskLineNumber(unsigned int id, int line);
|
||||||
void taskMarkClicked(unsigned int id);
|
void taskMarkClicked(unsigned int id);
|
||||||
|
void showTaskInEditor(unsigned int id);
|
||||||
void setCategoryVisibility(const Core::Id &categoryId, bool visible);
|
void setCategoryVisibility(const Core::Id &categoryId, bool visible);
|
||||||
|
|
||||||
void popup(bool withFocus);
|
void popup(bool withFocus);
|
||||||
@@ -69,6 +70,7 @@ signals:
|
|||||||
void categoryVisibilityChanged(const Core::Id &categoryId, bool visible);
|
void categoryVisibilityChanged(const Core::Id &categoryId, bool visible);
|
||||||
void popupRequested(bool withFocus);
|
void popupRequested(bool withFocus);
|
||||||
void showTask(unsigned int id);
|
void showTask(unsigned int id);
|
||||||
|
void openTask(unsigned int id);
|
||||||
private:
|
private:
|
||||||
const QIcon m_errorIcon;
|
const QIcon m_errorIcon;
|
||||||
const QIcon m_warningIcon;
|
const QIcon m_warningIcon;
|
||||||
|
|||||||
@@ -306,6 +306,8 @@ TaskWindow::TaskWindow(TaskHub *taskhub) : d(new TaskWindowPrivate)
|
|||||||
this, SLOT(popup(bool)));
|
this, SLOT(popup(bool)));
|
||||||
connect(d->m_taskHub, SIGNAL(showTask(uint)),
|
connect(d->m_taskHub, SIGNAL(showTask(uint)),
|
||||||
this, SLOT(showTask(uint)));
|
this, SLOT(showTask(uint)));
|
||||||
|
connect(d->m_taskHub, SIGNAL(openTask(uint)),
|
||||||
|
this, SLOT(openTask(uint)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskWindow::~TaskWindow()
|
TaskWindow::~TaskWindow()
|
||||||
@@ -398,6 +400,14 @@ void TaskWindow::showTask(unsigned int id)
|
|||||||
d->m_listview->setCurrentIndex(filterIdx);
|
d->m_listview->setCurrentIndex(filterIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TaskWindow::openTask(unsigned int id)
|
||||||
|
{
|
||||||
|
int sourceRow = d->m_model->rowForId(id);
|
||||||
|
QModelIndex sourceIdx = d->m_model->index(sourceRow, 0);
|
||||||
|
QModelIndex filterIdx = d->m_filter->mapFromSource(sourceIdx);
|
||||||
|
triggerDefaultHandler(filterIdx);
|
||||||
|
}
|
||||||
|
|
||||||
void TaskWindow::triggerDefaultHandler(const QModelIndex &index)
|
void TaskWindow::triggerDefaultHandler(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ private slots:
|
|||||||
void removeTask(const ProjectExplorer::Task &task);
|
void removeTask(const ProjectExplorer::Task &task);
|
||||||
void updatedTaskLineNumber(unsigned int id, int line);
|
void updatedTaskLineNumber(unsigned int id, int line);
|
||||||
void showTask(unsigned int id);
|
void showTask(unsigned int id);
|
||||||
|
void openTask(unsigned int id);
|
||||||
void clearTasks(const Core::Id &categoryId);
|
void clearTasks(const Core::Id &categoryId);
|
||||||
void setCategoryVisibility(const Core::Id &categoryId, bool visible);
|
void setCategoryVisibility(const Core::Id &categoryId, bool visible);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user