Add support to change the number of lines of the compile output

This patch adds support to modify the number of line shown in the
compile output window. This will allow users with big projects to have
more room to look at when compiling.

Task-number: QTCREATORBUG-2200
Change-Id: I1023b2150a3eff4a33b8872fb711d150e5a8b00c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Samuel Gaist
2016-09-26 23:40:25 +02:00
parent 301dd629e6
commit d6591625c3
8 changed files with 77 additions and 18 deletions

View File

@@ -35,6 +35,7 @@
#include <coreplugin/outputwindow.h>
#include <coreplugin/find/basetextfind.h>
#include <coreplugin/icore.h>
#include <coreplugin/coreconstants.h>
#include <extensionsystem/pluginmanager.h>
#include <texteditor/texteditorsettings.h>
#include <texteditor/fontsettings.h>
@@ -55,7 +56,6 @@ using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal;
namespace {
const int MAX_LINECOUNT = 100000;
const char SETTINGS_KEY[] = "ProjectExplorer/CompileOutput/Zoom";
const char C_COMPILE_OUTPUT[] = "ProjectExplorer.CompileOutput";
}
@@ -155,7 +155,7 @@ CompileOutputWindow::CompileOutputWindow(QAction *cancelBuildAction) :
m_outputWindow->setWindowIcon(Icons::WINDOW.icon());
m_outputWindow->setReadOnly(true);
m_outputWindow->setUndoRedoEnabled(false);
m_outputWindow->setMaxLineCount(MAX_LINECOUNT);
m_outputWindow->setMaxLineCount(Core::Constants::DEFAULT_MAX_LINE_COUNT);
// Let selected text be colored as if the text edit was editable,
// otherwise the highlight for searching is too light
@@ -195,8 +195,8 @@ CompileOutputWindow::CompileOutputWindow(QAction *cancelBuildAction) :
m_handler = new ShowOutputTaskHandler(this);
ExtensionSystem::PluginManager::addObject(m_handler);
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::settingsChanged,
this, &CompileOutputWindow::updateWordWrapMode);
updateWordWrapMode();
this, &CompileOutputWindow::updateFromSettings);
updateFromSettings();
}
CompileOutputWindow::~CompileOutputWindow()
@@ -219,9 +219,10 @@ void CompileOutputWindow::updateZoomEnabled()
m_outputWindow->setWheelZoomEnabled(zoomEnabled);
}
void CompileOutputWindow::updateWordWrapMode()
void CompileOutputWindow::updateFromSettings()
{
m_outputWindow->setWordWrapEnabled(ProjectExplorerPlugin::projectExplorerSettings().wrapAppOutput);
m_outputWindow->setMaxLineCount(ProjectExplorerPlugin::projectExplorerSettings().maxBuildOutputLines);
}
bool CompileOutputWindow::hasFocus() const
@@ -319,7 +320,7 @@ void CompileOutputWindow::registerPositionOf(const Task &task, int linkedOutputL
if (linkedOutputLines <= 0)
return;
int blocknumber = m_outputWindow->document()->blockCount();
if (blocknumber > MAX_LINECOUNT)
if (blocknumber > m_outputWindow->maxLineCount())
return;
const int startLine = blocknumber - linkedOutputLines + 1 - skipLines;