forked from qt-creator/qt-creator
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:
@@ -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 int TARGET_ICON_SIZE = 32;
|
||||
const int DEFAULT_MAX_LINE_COUNT = 100000;
|
||||
|
||||
} // namespace Constants
|
||||
} // namespace Core
|
||||
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
bool mousePressed = false;
|
||||
bool m_zoomEnabled = false;
|
||||
float m_originalFontSize = 0.;
|
||||
int maxLineCount = 100000;
|
||||
int maxLineCount = Core::Constants::DEFAULT_MAX_LINE_COUNT;
|
||||
QTextCursor cursor;
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -82,7 +82,7 @@ public:
|
||||
void flush();
|
||||
|
||||
private:
|
||||
void updateWordWrapMode();
|
||||
void updateFromSettings();
|
||||
void updateZoomEnabled();
|
||||
|
||||
CompileOutputTextEdit *m_outputWindow;
|
||||
|
||||
@@ -1241,7 +1241,9 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
||||
dd->m_projectExplorerSettings.prompToStopRunControl =
|
||||
s->value(QLatin1String("ProjectExplorer/Settings/PromptToStopRunControl"), false).toBool();
|
||||
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 =
|
||||
QUuid(s->value(QLatin1String("ProjectExplorer/Settings/EnvironmentId")).toByteArray());
|
||||
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/PromptToStopRunControl"), dd->m_projectExplorerSettings.prompToStopRunControl);
|
||||
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/StopBeforeBuild"), dd->m_projectExplorerSettings.stopBeforeBuild);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
|
||||
#include <QUuid>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
@@ -47,7 +49,8 @@ public:
|
||||
bool useJom = true;
|
||||
bool autorestoreLastSession = false; // This option is set in the Session Manager!
|
||||
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;
|
||||
|
||||
// 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.prompToStopRunControl == p2.prompToStopRunControl
|
||||
&& p1.maxAppOutputLines == p2.maxAppOutputLines
|
||||
&& p1.maxBuildOutputLines == p2.maxBuildOutputLines
|
||||
&& p1.environmentId == p2.environmentId
|
||||
&& p1.stopBeforeBuild == p2.stopBeforeBuild;
|
||||
}
|
||||
|
||||
@@ -109,6 +109,7 @@ ProjectExplorerSettings ProjectExplorerSettingsWidget::settings() const
|
||||
m_settings.useJom = m_ui.jomCheckbox->isChecked();
|
||||
m_settings.prompToStopRunControl = m_ui.promptToStopRunControlCheckBox->isChecked();
|
||||
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());
|
||||
return m_settings;
|
||||
}
|
||||
@@ -128,7 +129,8 @@ void ProjectExplorerSettingsWidget::setSettings(const ProjectExplorerSettings &
|
||||
m_ui.jomCheckbox->setChecked(m_settings.useJom);
|
||||
m_ui.promptToStopRunControlCheckBox->setChecked(m_settings.prompToStopRunControl);
|
||||
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
|
||||
|
||||
@@ -105,6 +105,61 @@
|
||||
</widget>
|
||||
</item>
|
||||
<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">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
@@ -152,13 +207,6 @@
|
||||
</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="5" column="0">
|
||||
<widget class="QCheckBox" name="showDebugOutputCheckBox">
|
||||
<property name="text">
|
||||
|
||||
Reference in New Issue
Block a user