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

@@ -208,6 +208,7 @@ const char TR_CLEAR_MENU[] = QT_TRANSLATE_NOOP("Core", "Clear Menu");
const char DEFAULT_BUILD_DIRECTORY[] = "../%{JS: Util.asciify(\"build-%{CurrentProject:Name}-%{CurrentKit:FileSystemName}-%{CurrentBuild:Name}\")}"; const char DEFAULT_BUILD_DIRECTORY[] = "../%{JS: Util.asciify(\"build-%{CurrentProject:Name}-%{CurrentKit:FileSystemName}-%{CurrentBuild:Name}\")}";
const int TARGET_ICON_SIZE = 32; const int TARGET_ICON_SIZE = 32;
const int DEFAULT_MAX_LINE_COUNT = 100000;
} // namespace Constants } // namespace Constants
} // namespace Core } // namespace Core

View File

@@ -64,7 +64,7 @@ public:
bool mousePressed = false; bool mousePressed = false;
bool m_zoomEnabled = false; bool m_zoomEnabled = false;
float m_originalFontSize = 0.; float m_originalFontSize = 0.;
int maxLineCount = 100000; int maxLineCount = Core::Constants::DEFAULT_MAX_LINE_COUNT;
QTextCursor cursor; QTextCursor cursor;
}; };

View File

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

View File

@@ -82,7 +82,7 @@ public:
void flush(); void flush();
private: private:
void updateWordWrapMode(); void updateFromSettings();
void updateZoomEnabled(); void updateZoomEnabled();
CompileOutputTextEdit *m_outputWindow; CompileOutputTextEdit *m_outputWindow;

View File

@@ -1241,7 +1241,9 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
dd->m_projectExplorerSettings.prompToStopRunControl = dd->m_projectExplorerSettings.prompToStopRunControl =
s->value(QLatin1String("ProjectExplorer/Settings/PromptToStopRunControl"), false).toBool(); s->value(QLatin1String("ProjectExplorer/Settings/PromptToStopRunControl"), false).toBool();
dd->m_projectExplorerSettings.maxAppOutputLines = dd->m_projectExplorerSettings.maxAppOutputLines =
s->value(QLatin1String("ProjectExplorer/Settings/MaxAppOutputLines"), 100000).toInt(); s->value(QLatin1String("ProjectExplorer/Settings/MaxAppOutputLines"), Core::Constants::DEFAULT_MAX_LINE_COUNT).toInt();
dd->m_projectExplorerSettings.maxBuildOutputLines =
s->value(QLatin1String("ProjectExplorer/Settings/MaxBuildOutputLines"), Core::Constants::DEFAULT_MAX_LINE_COUNT).toInt();
dd->m_projectExplorerSettings.environmentId = dd->m_projectExplorerSettings.environmentId =
QUuid(s->value(QLatin1String("ProjectExplorer/Settings/EnvironmentId")).toByteArray()); QUuid(s->value(QLatin1String("ProjectExplorer/Settings/EnvironmentId")).toByteArray());
if (dd->m_projectExplorerSettings.environmentId.isNull()) if (dd->m_projectExplorerSettings.environmentId.isNull())
@@ -1757,6 +1759,7 @@ void ProjectExplorerPluginPrivate::savePersistentSettings()
s->setValue(QLatin1String("ProjectExplorer/Settings/AutoRestoreLastSession"), dd->m_projectExplorerSettings.autorestoreLastSession); s->setValue(QLatin1String("ProjectExplorer/Settings/AutoRestoreLastSession"), dd->m_projectExplorerSettings.autorestoreLastSession);
s->setValue(QLatin1String("ProjectExplorer/Settings/PromptToStopRunControl"), dd->m_projectExplorerSettings.prompToStopRunControl); s->setValue(QLatin1String("ProjectExplorer/Settings/PromptToStopRunControl"), dd->m_projectExplorerSettings.prompToStopRunControl);
s->setValue(QLatin1String("ProjectExplorer/Settings/MaxAppOutputLines"), dd->m_projectExplorerSettings.maxAppOutputLines); s->setValue(QLatin1String("ProjectExplorer/Settings/MaxAppOutputLines"), dd->m_projectExplorerSettings.maxAppOutputLines);
s->setValue(QLatin1String("ProjectExplorer/Settings/MaxBuildOutputLines"), dd->m_projectExplorerSettings.maxBuildOutputLines);
s->setValue(QLatin1String("ProjectExplorer/Settings/EnvironmentId"), dd->m_projectExplorerSettings.environmentId.toByteArray()); s->setValue(QLatin1String("ProjectExplorer/Settings/EnvironmentId"), dd->m_projectExplorerSettings.environmentId.toByteArray());
s->setValue(QLatin1String("ProjectExplorer/Settings/StopBeforeBuild"), dd->m_projectExplorerSettings.stopBeforeBuild); s->setValue(QLatin1String("ProjectExplorer/Settings/StopBeforeBuild"), dd->m_projectExplorerSettings.stopBeforeBuild);
} }

View File

@@ -25,6 +25,8 @@
#pragma once #pragma once
#include <coreplugin/coreconstants.h>
#include <QUuid> #include <QUuid>
namespace ProjectExplorer { namespace ProjectExplorer {
@@ -47,7 +49,8 @@ public:
bool useJom = true; bool useJom = true;
bool autorestoreLastSession = false; // This option is set in the Session Manager! bool autorestoreLastSession = false; // This option is set in the Session Manager!
bool prompToStopRunControl = false; bool prompToStopRunControl = false;
int maxAppOutputLines = 100000; int maxAppOutputLines = Core::Constants::DEFAULT_MAX_LINE_COUNT;
int maxBuildOutputLines = Core::Constants::DEFAULT_MAX_LINE_COUNT;
StopBeforeBuild stopBeforeBuild = StopBeforeBuild::StopNone; StopBeforeBuild stopBeforeBuild = StopBeforeBuild::StopNone;
// Add a UUid which is used to identify the development environment. // Add a UUid which is used to identify the development environment.
@@ -71,6 +74,7 @@ inline bool operator==(const ProjectExplorerSettings &p1, const ProjectExplorerS
&& p1.autorestoreLastSession == p2.autorestoreLastSession && p1.autorestoreLastSession == p2.autorestoreLastSession
&& p1.prompToStopRunControl == p2.prompToStopRunControl && p1.prompToStopRunControl == p2.prompToStopRunControl
&& p1.maxAppOutputLines == p2.maxAppOutputLines && p1.maxAppOutputLines == p2.maxAppOutputLines
&& p1.maxBuildOutputLines == p2.maxBuildOutputLines
&& p1.environmentId == p2.environmentId && p1.environmentId == p2.environmentId
&& p1.stopBeforeBuild == p2.stopBeforeBuild; && p1.stopBeforeBuild == p2.stopBeforeBuild;
} }

View File

@@ -109,6 +109,7 @@ ProjectExplorerSettings ProjectExplorerSettingsWidget::settings() const
m_settings.useJom = m_ui.jomCheckbox->isChecked(); m_settings.useJom = m_ui.jomCheckbox->isChecked();
m_settings.prompToStopRunControl = m_ui.promptToStopRunControlCheckBox->isChecked(); m_settings.prompToStopRunControl = m_ui.promptToStopRunControlCheckBox->isChecked();
m_settings.maxAppOutputLines = m_ui.maxAppOutputBox->value(); m_settings.maxAppOutputLines = m_ui.maxAppOutputBox->value();
m_settings.maxBuildOutputLines = m_ui.maxBuildOutputBox->value();
m_settings.stopBeforeBuild = static_cast<ProjectExplorerSettings::StopBeforeBuild>(m_ui.stopBeforeBuildComboBox->currentIndex()); m_settings.stopBeforeBuild = static_cast<ProjectExplorerSettings::StopBeforeBuild>(m_ui.stopBeforeBuildComboBox->currentIndex());
return m_settings; return m_settings;
} }
@@ -128,7 +129,8 @@ void ProjectExplorerSettingsWidget::setSettings(const ProjectExplorerSettings &
m_ui.jomCheckbox->setChecked(m_settings.useJom); m_ui.jomCheckbox->setChecked(m_settings.useJom);
m_ui.promptToStopRunControlCheckBox->setChecked(m_settings.prompToStopRunControl); m_ui.promptToStopRunControlCheckBox->setChecked(m_settings.prompToStopRunControl);
m_ui.maxAppOutputBox->setValue(m_settings.maxAppOutputLines); m_ui.maxAppOutputBox->setValue(m_settings.maxAppOutputLines);
m_ui.stopBeforeBuildComboBox->setCurrentIndex(static_cast<int>(pes.stopBeforeBuild)); m_ui.maxBuildOutputBox->setValue(m_settings.maxBuildOutputLines);
m_ui.stopBeforeBuildComboBox->setCurrentIndex(static_cast<int>(m_settings.stopBeforeBuild));
} }
QString ProjectExplorerSettingsWidget::projectsDirectory() const QString ProjectExplorerSettingsWidget::projectsDirectory() const

View File

@@ -105,6 +105,61 @@
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="3" column="1">
<widget class="QWidget" name="widget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="limitBuildOutputLabel">
<property name="text">
<string>Limit build output to </string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="maxBuildOutputBox">
<property name="minimum">
<number>500</number>
</property>
<property name="maximum">
<number>1000000</number>
</property>
<property name="singleStep">
<number>500</number>
</property>
<property name="value">
<number>100000</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="limitBuildOutputLabel_2">
<property name="text">
<string>lines</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="showRunOutputCheckBox">
<property name="text">
<string>Open Application Output pane on output when running</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QWidget" name="widget" native="true"> <widget class="QWidget" name="widget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin"> <property name="leftMargin">
@@ -152,13 +207,6 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="4" column="0">
<widget class="QCheckBox" name="showRunOutputCheckBox">
<property name="text">
<string>Open Application Output pane on output when running</string>
</property>
</widget>
</item>
<item row="5" column="0"> <item row="5" column="0">
<widget class="QCheckBox" name="showDebugOutputCheckBox"> <widget class="QCheckBox" name="showDebugOutputCheckBox">
<property name="text"> <property name="text">