2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2008-12-02 16:19:05 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "compileoutputwindow.h"
|
|
|
|
|
#include "buildmanager.h"
|
2010-06-30 16:39:32 +02:00
|
|
|
#include "showoutputtaskhandler.h"
|
|
|
|
|
#include "task.h"
|
2011-04-14 10:39:09 +02:00
|
|
|
#include "projectexplorer.h"
|
2015-11-23 16:41:54 +01:00
|
|
|
#include "projectexplorericons.h"
|
2011-04-14 10:39:09 +02:00
|
|
|
#include "projectexplorersettings.h"
|
2010-06-25 10:41:49 +02:00
|
|
|
#include "taskhub.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2013-03-25 17:13:18 +01:00
|
|
|
#include <coreplugin/outputwindow.h>
|
2014-01-13 16:17:34 +01:00
|
|
|
#include <coreplugin/find/basetextfind.h>
|
2015-08-17 16:29:09 +02:00
|
|
|
#include <coreplugin/icore.h>
|
2015-11-23 16:41:54 +01:00
|
|
|
#include <coreplugin/coreicons.h>
|
2010-06-30 16:39:32 +02:00
|
|
|
#include <extensionsystem/pluginmanager.h>
|
2012-05-07 16:32:06 +02:00
|
|
|
#include <texteditor/texteditorsettings.h>
|
|
|
|
|
#include <texteditor/fontsettings.h>
|
2015-08-17 16:29:09 +02:00
|
|
|
#include <texteditor/behaviorsettings.h>
|
2013-09-03 06:47:17 +03:00
|
|
|
#include <utils/ansiescapecodehandler.h>
|
2015-03-19 20:00:15 +01:00
|
|
|
#include <utils/theme/theme.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QIcon>
|
|
|
|
|
#include <QTextCharFormat>
|
|
|
|
|
#include <QTextBlock>
|
|
|
|
|
#include <QTextCursor>
|
|
|
|
|
#include <QPlainTextEdit>
|
2012-03-28 22:23:03 +02:00
|
|
|
#include <QToolButton>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
using namespace ProjectExplorer;
|
|
|
|
|
using namespace ProjectExplorer::Internal;
|
|
|
|
|
|
2010-07-02 15:54:41 +02:00
|
|
|
namespace {
|
2012-10-15 15:21:28 +02:00
|
|
|
const int MAX_LINECOUNT = 100000;
|
2015-08-17 16:29:09 +02:00
|
|
|
const char SETTINGS_KEY[] = "ProjectExplorer/CompileOutput/Zoom";
|
2010-07-02 15:54:41 +02:00
|
|
|
}
|
|
|
|
|
|
2010-06-25 10:41:49 +02:00
|
|
|
namespace ProjectExplorer {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class CompileOutputTextEdit : public Core::OutputWindow
|
|
|
|
|
{
|
2012-05-07 16:32:06 +02:00
|
|
|
Q_OBJECT
|
2010-06-25 10:41:49 +02:00
|
|
|
public:
|
2015-08-17 16:29:09 +02:00
|
|
|
CompileOutputTextEdit(const Core::Context &context)
|
|
|
|
|
: Core::OutputWindow(context)
|
2010-06-25 10:41:49 +02:00
|
|
|
{
|
2015-08-17 16:29:09 +02:00
|
|
|
setWheelZoomEnabled(true);
|
|
|
|
|
|
|
|
|
|
QSettings *settings = Core::ICore::settings();
|
|
|
|
|
float zoom = settings->value(QLatin1String(SETTINGS_KEY), 0).toFloat();
|
|
|
|
|
setFontZoom(zoom);
|
|
|
|
|
|
2012-05-07 16:32:06 +02:00
|
|
|
fontSettingsChanged();
|
2015-08-17 16:29:09 +02:00
|
|
|
|
2016-01-29 16:38:37 +02:00
|
|
|
connect(TextEditor::TextEditorSettings::instance(), &TextEditor::TextEditorSettings::fontSettingsChanged,
|
|
|
|
|
this, &CompileOutputTextEdit::fontSettingsChanged);
|
2015-08-17 16:29:09 +02:00
|
|
|
|
|
|
|
|
connect(Core::ICore::instance(), &Core::ICore::saveSettingsRequested,
|
|
|
|
|
this, &CompileOutputTextEdit::saveSettings);
|
2015-09-18 14:29:59 +02:00
|
|
|
|
|
|
|
|
setMouseTracking(true);
|
2015-08-17 16:29:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void saveSettings()
|
|
|
|
|
{
|
|
|
|
|
QSettings *settings = Core::ICore::settings();
|
|
|
|
|
settings->setValue(QLatin1String(SETTINGS_KEY), fontZoom());
|
2010-06-25 10:41:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void addTask(const Task &task, int blocknumber)
|
|
|
|
|
{
|
|
|
|
|
m_taskids.insert(blocknumber, task.taskId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void clearTasks()
|
|
|
|
|
{
|
|
|
|
|
m_taskids.clear();
|
|
|
|
|
}
|
2016-01-29 16:38:37 +02:00
|
|
|
private:
|
2012-05-07 16:32:06 +02:00
|
|
|
void fontSettingsChanged()
|
|
|
|
|
{
|
2015-08-17 16:29:09 +02:00
|
|
|
setBaseFont(TextEditor::TextEditorSettings::fontSettings().font());
|
2012-05-07 16:32:06 +02:00
|
|
|
}
|
2010-06-25 10:41:49 +02:00
|
|
|
|
|
|
|
|
protected:
|
2015-09-18 14:29:59 +02:00
|
|
|
void mouseMoveEvent(QMouseEvent *ev)
|
2012-06-25 18:40:14 +02:00
|
|
|
{
|
2010-06-25 10:41:49 +02:00
|
|
|
int line = cursorForPosition(ev->pos()).block().blockNumber();
|
2015-09-18 14:29:59 +02:00
|
|
|
if (m_taskids.value(line, 0))
|
|
|
|
|
viewport()->setCursor(Qt::PointingHandCursor);
|
2013-11-11 22:20:47 +02:00
|
|
|
else
|
2015-09-18 14:29:59 +02:00
|
|
|
viewport()->setCursor(Qt::IBeamCursor);
|
|
|
|
|
QPlainTextEdit::mouseMoveEvent(ev);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void mousePressEvent(QMouseEvent *ev)
|
|
|
|
|
{
|
|
|
|
|
m_mousePressPosition = ev->pos();
|
|
|
|
|
QPlainTextEdit::mousePressEvent(ev);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void mouseReleaseEvent(QMouseEvent *ev)
|
|
|
|
|
{
|
|
|
|
|
if ((m_mousePressPosition - ev->pos()).manhattanLength() < 4) {
|
|
|
|
|
int line = cursorForPosition(ev->pos()).block().blockNumber();
|
|
|
|
|
if (unsigned taskid = m_taskids.value(line, 0))
|
|
|
|
|
TaskHub::showTaskInEditor(taskid);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QPlainTextEdit::mouseReleaseEvent(ev);
|
2010-06-25 10:41:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QHash<int, unsigned int> m_taskids; //Map blocknumber to taskId
|
2015-09-18 14:29:59 +02:00
|
|
|
QPoint m_mousePressPosition;
|
2010-06-25 10:41:49 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace ProjectExplorer
|
|
|
|
|
|
2014-01-27 14:04:03 +01:00
|
|
|
CompileOutputWindow::CompileOutputWindow(QAction *cancelBuildAction) :
|
2013-09-03 06:47:17 +03:00
|
|
|
m_cancelBuildButton(new QToolButton),
|
2015-08-17 16:29:09 +02:00
|
|
|
m_zoomInButton(new QToolButton),
|
|
|
|
|
m_zoomOutButton(new QToolButton),
|
2013-09-03 06:47:17 +03:00
|
|
|
m_escapeCodeHandler(new Utils::AnsiEscapeCodeHandler)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2011-04-14 10:39:09 +02:00
|
|
|
Core::Context context(Constants::C_COMPILE_OUTPUT);
|
2010-06-25 10:41:49 +02:00
|
|
|
m_outputWindow = new CompileOutputTextEdit(context);
|
2010-07-12 14:01:42 +02:00
|
|
|
m_outputWindow->setWindowTitle(tr("Compile Output"));
|
2015-11-23 16:41:54 +01:00
|
|
|
m_outputWindow->setWindowIcon(Icons::WINDOW.icon());
|
2010-07-12 14:01:42 +02:00
|
|
|
m_outputWindow->setReadOnly(true);
|
2011-02-04 14:51:55 +01:00
|
|
|
m_outputWindow->setUndoRedoEnabled(false);
|
2011-04-29 09:36:04 +02:00
|
|
|
m_outputWindow->setMaxLineCount(MAX_LINECOUNT);
|
2010-07-12 14:01:42 +02:00
|
|
|
|
2012-12-20 11:34:00 +01:00
|
|
|
// Let selected text be colored as if the text edit was editable,
|
|
|
|
|
// otherwise the highlight for searching is too light
|
|
|
|
|
QPalette p = m_outputWindow->palette();
|
|
|
|
|
QColor activeHighlight = p.color(QPalette::Active, QPalette::Highlight);
|
|
|
|
|
p.setColor(QPalette::Highlight, activeHighlight);
|
|
|
|
|
QColor activeHighlightedText = p.color(QPalette::Active, QPalette::HighlightedText);
|
|
|
|
|
p.setColor(QPalette::HighlightedText, activeHighlightedText);
|
|
|
|
|
m_outputWindow->setPalette(p);
|
|
|
|
|
|
2012-03-28 22:23:03 +02:00
|
|
|
m_cancelBuildButton->setDefaultAction(cancelBuildAction);
|
2015-08-31 21:45:21 +03:00
|
|
|
m_zoomInButton->setToolTip(tr("Increase Font Size"));
|
2015-11-23 16:41:54 +01:00
|
|
|
m_zoomInButton->setIcon(Core::Icons::PLUS.icon());
|
2015-08-31 21:45:21 +03:00
|
|
|
m_zoomOutButton->setToolTip(tr("Decrease Font Size"));
|
2015-11-23 16:41:54 +01:00
|
|
|
m_zoomOutButton->setIcon(Core::Icons::MINUS.icon());
|
2015-08-17 16:29:09 +02:00
|
|
|
|
|
|
|
|
updateZoomEnabled();
|
|
|
|
|
|
|
|
|
|
connect(TextEditor::TextEditorSettings::instance(),
|
|
|
|
|
&TextEditor::TextEditorSettings::behaviorSettingsChanged,
|
|
|
|
|
this, &CompileOutputWindow::updateZoomEnabled);
|
|
|
|
|
|
|
|
|
|
connect(m_zoomInButton, &QToolButton::clicked,
|
|
|
|
|
this, [this]() { m_outputWindow->zoomIn(1); });
|
|
|
|
|
connect(m_zoomOutButton, &QToolButton::clicked,
|
|
|
|
|
this, [this]() { m_outputWindow->zoomOut(1); });
|
2012-03-28 22:23:03 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
Aggregation::Aggregate *agg = new Aggregation::Aggregate;
|
2010-07-12 14:01:42 +02:00
|
|
|
agg->add(m_outputWindow);
|
2014-01-13 16:17:34 +01:00
|
|
|
agg->add(new Core::BaseTextFind(m_outputWindow));
|
2010-06-08 15:04:42 +02:00
|
|
|
|
|
|
|
|
qRegisterMetaType<QTextCharFormat>("QTextCharFormat");
|
2010-06-30 16:39:32 +02:00
|
|
|
|
|
|
|
|
m_handler = new ShowOutputTaskHandler(this);
|
2012-06-18 11:34:15 +02:00
|
|
|
ExtensionSystem::PluginManager::addObject(m_handler);
|
2016-01-29 16:38:37 +02:00
|
|
|
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::settingsChanged,
|
|
|
|
|
this, &CompileOutputWindow::updateWordWrapMode);
|
2011-04-14 10:39:09 +02:00
|
|
|
updateWordWrapMode();
|
2010-06-30 16:39:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CompileOutputWindow::~CompileOutputWindow()
|
|
|
|
|
{
|
2012-06-18 11:34:15 +02:00
|
|
|
ExtensionSystem::PluginManager::removeObject(m_handler);
|
2010-06-30 16:39:32 +02:00
|
|
|
delete m_handler;
|
2012-03-28 22:23:03 +02:00
|
|
|
delete m_cancelBuildButton;
|
2015-08-17 16:29:09 +02:00
|
|
|
delete m_zoomInButton;
|
|
|
|
|
delete m_zoomOutButton;
|
2013-09-03 06:47:17 +03:00
|
|
|
delete m_escapeCodeHandler;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2015-08-17 16:29:09 +02:00
|
|
|
void CompileOutputWindow::updateZoomEnabled()
|
|
|
|
|
{
|
|
|
|
|
const TextEditor::BehaviorSettings &settings
|
|
|
|
|
= TextEditor::TextEditorSettings::behaviorSettings();
|
|
|
|
|
bool zoomEnabled = settings.m_scrollWheelZooming;
|
|
|
|
|
m_zoomInButton->setEnabled(zoomEnabled);
|
|
|
|
|
m_zoomOutButton->setEnabled(zoomEnabled);
|
|
|
|
|
m_outputWindow->setWheelZoomEnabled(zoomEnabled);
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-14 10:39:09 +02:00
|
|
|
void CompileOutputWindow::updateWordWrapMode()
|
|
|
|
|
{
|
2013-09-05 18:30:50 +02:00
|
|
|
m_outputWindow->setWordWrapEnabled(ProjectExplorerPlugin::projectExplorerSettings().wrapAppOutput);
|
2011-04-14 10:39:09 +02:00
|
|
|
}
|
|
|
|
|
|
2011-09-27 13:47:06 +02:00
|
|
|
bool CompileOutputWindow::hasFocus() const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2014-11-07 15:48:36 +01:00
|
|
|
return m_outputWindow->window()->focusWidget() == m_outputWindow;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2011-09-27 13:47:06 +02:00
|
|
|
bool CompileOutputWindow::canFocus() const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CompileOutputWindow::setFocus()
|
|
|
|
|
{
|
2010-07-12 14:01:42 +02:00
|
|
|
m_outputWindow->setFocus();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QWidget *CompileOutputWindow::outputWidget(QWidget *)
|
|
|
|
|
{
|
2010-07-12 14:01:42 +02:00
|
|
|
return m_outputWindow;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2012-03-28 22:23:03 +02:00
|
|
|
QList<QWidget *> CompileOutputWindow::toolBarWidgets() const
|
|
|
|
|
{
|
2015-08-17 16:29:09 +02:00
|
|
|
return QList<QWidget *>() << m_cancelBuildButton
|
|
|
|
|
<< m_zoomInButton
|
|
|
|
|
<< m_zoomOutButton;
|
2012-03-28 22:23:03 +02:00
|
|
|
}
|
|
|
|
|
|
2014-10-13 22:37:28 +03:00
|
|
|
void CompileOutputWindow::appendText(const QString &text, BuildStep::OutputFormat format)
|
2010-07-15 10:29:38 +02:00
|
|
|
{
|
2015-03-19 20:00:15 +01:00
|
|
|
using Utils::Theme;
|
|
|
|
|
Theme *theme = Utils::creatorTheme();
|
2010-07-15 10:29:38 +02:00
|
|
|
QTextCharFormat textFormat;
|
|
|
|
|
switch (format) {
|
|
|
|
|
case BuildStep::NormalOutput:
|
2015-03-19 20:00:15 +01:00
|
|
|
textFormat.setForeground(theme->color(Theme::TextColorNormal));
|
2010-07-15 10:29:38 +02:00
|
|
|
textFormat.setFontWeight(QFont::Normal);
|
|
|
|
|
break;
|
|
|
|
|
case BuildStep::ErrorOutput:
|
2015-03-30 10:47:48 +03:00
|
|
|
textFormat.setForeground(theme->color(Theme::OutputPanes_ErrorMessageTextColor));
|
2010-07-15 10:29:38 +02:00
|
|
|
textFormat.setFontWeight(QFont::Normal);
|
|
|
|
|
break;
|
|
|
|
|
case BuildStep::MessageOutput:
|
2015-03-30 10:47:48 +03:00
|
|
|
textFormat.setForeground(theme->color(Theme::OutputPanes_MessageOutput));
|
2010-07-15 10:29:38 +02:00
|
|
|
break;
|
|
|
|
|
case BuildStep::ErrorMessageOutput:
|
2015-03-30 10:47:48 +03:00
|
|
|
textFormat.setForeground(theme->color(Theme::OutputPanes_ErrorMessageTextColor));
|
2010-07-15 10:29:38 +02:00
|
|
|
textFormat.setFontWeight(QFont::Bold);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-17 15:55:27 +01:00
|
|
|
foreach (const Utils::FormattedText &output,
|
|
|
|
|
m_escapeCodeHandler->parseText(Utils::FormattedText(text, textFormat)))
|
|
|
|
|
m_outputWindow->appendText(output.text, output.format);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CompileOutputWindow::clearContents()
|
|
|
|
|
{
|
2010-07-12 14:01:42 +02:00
|
|
|
m_outputWindow->clear();
|
2010-06-25 10:41:49 +02:00
|
|
|
m_outputWindow->clearTasks();
|
2010-06-30 16:39:32 +02:00
|
|
|
m_taskPositions.clear();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-07-12 14:01:42 +02:00
|
|
|
void CompileOutputWindow::visibilityChanged(bool)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-07-12 14:01:42 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int CompileOutputWindow::priorityInStatusBar() const
|
|
|
|
|
{
|
|
|
|
|
return 50;
|
|
|
|
|
}
|
2009-04-30 12:50:52 +02:00
|
|
|
|
2011-09-27 13:47:06 +02:00
|
|
|
bool CompileOutputWindow::canNext() const
|
2009-04-30 12:50:52 +02:00
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-27 13:47:06 +02:00
|
|
|
bool CompileOutputWindow::canPrevious() const
|
2009-04-30 12:50:52 +02:00
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CompileOutputWindow::goToNext()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CompileOutputWindow::goToPrev()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-27 13:47:06 +02:00
|
|
|
bool CompileOutputWindow::canNavigate() const
|
2009-04-30 12:50:52 +02:00
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2010-06-30 16:39:32 +02:00
|
|
|
|
2015-04-20 17:13:45 +02:00
|
|
|
void CompileOutputWindow::registerPositionOf(const Task &task, int linkedOutputLines, int skipLines)
|
2010-06-30 16:39:32 +02:00
|
|
|
{
|
2015-04-20 17:13:45 +02:00
|
|
|
if (linkedOutputLines <= 0)
|
|
|
|
|
return;
|
|
|
|
|
int blocknumber = m_outputWindow->document()->blockCount();
|
2010-07-02 15:54:41 +02:00
|
|
|
if (blocknumber > MAX_LINECOUNT)
|
|
|
|
|
return;
|
2010-06-25 10:41:49 +02:00
|
|
|
|
2015-04-20 17:13:45 +02:00
|
|
|
const int startLine = blocknumber - linkedOutputLines + 1 - skipLines;
|
|
|
|
|
const int endLine = blocknumber - skipLines;
|
|
|
|
|
|
|
|
|
|
m_taskPositions.insert(task.taskId, qMakePair(startLine, endLine));
|
|
|
|
|
|
|
|
|
|
for (int i = startLine; i <= endLine; ++i)
|
|
|
|
|
m_outputWindow->addTask(task, i);
|
2010-06-30 16:39:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CompileOutputWindow::knowsPositionOf(const Task &task)
|
|
|
|
|
{
|
|
|
|
|
return (m_taskPositions.contains(task.taskId));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CompileOutputWindow::showPositionOf(const Task &task)
|
|
|
|
|
{
|
2015-04-20 17:13:45 +02:00
|
|
|
QPair<int, int> position = m_taskPositions.value(task.taskId);
|
|
|
|
|
QTextCursor newCursor(m_outputWindow->document()->findBlockByNumber(position.second));
|
|
|
|
|
|
|
|
|
|
// Move cursor to end of last line of interest:
|
|
|
|
|
newCursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::MoveAnchor);
|
2010-07-12 14:01:42 +02:00
|
|
|
m_outputWindow->setTextCursor(newCursor);
|
2015-04-20 17:13:45 +02:00
|
|
|
|
|
|
|
|
// Move cursor and select lines:
|
|
|
|
|
newCursor.setPosition(m_outputWindow->document()->findBlockByNumber(position.first).position(),
|
|
|
|
|
QTextCursor::KeepAnchor);
|
|
|
|
|
m_outputWindow->setTextCursor(newCursor);
|
|
|
|
|
|
|
|
|
|
// Center cursor now:
|
|
|
|
|
m_outputWindow->centerCursor();
|
2010-06-30 16:39:32 +02:00
|
|
|
}
|
2012-05-07 16:32:06 +02:00
|
|
|
|
2013-09-03 06:47:17 +03:00
|
|
|
void CompileOutputWindow::flush()
|
|
|
|
|
{
|
|
|
|
|
if (m_escapeCodeHandler)
|
|
|
|
|
m_escapeCodeHandler->endFormatScope();
|
|
|
|
|
}
|
|
|
|
|
|
2012-05-07 16:32:06 +02:00
|
|
|
#include "compileoutputwindow.moc"
|