From d6591625c3cb3bcbd226ffdaa55e1a1c2851de66 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Mon, 26 Sep 2016 23:40:25 +0200 Subject: [PATCH] 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 --- src/plugins/coreplugin/coreconstants.h | 1 + src/plugins/coreplugin/outputwindow.cpp | 2 +- .../projectexplorer/compileoutputwindow.cpp | 13 ++-- .../projectexplorer/compileoutputwindow.h | 2 +- .../projectexplorer/projectexplorer.cpp | 5 +- .../projectexplorer/projectexplorersettings.h | 6 +- .../projectexplorersettingspage.cpp | 4 +- .../projectexplorersettingspage.ui | 62 ++++++++++++++++--- 8 files changed, 77 insertions(+), 18 deletions(-) diff --git a/src/plugins/coreplugin/coreconstants.h b/src/plugins/coreplugin/coreconstants.h index 78c7ae6011a..e5a612d5949 100644 --- a/src/plugins/coreplugin/coreconstants.h +++ b/src/plugins/coreplugin/coreconstants.h @@ -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 diff --git a/src/plugins/coreplugin/outputwindow.cpp b/src/plugins/coreplugin/outputwindow.cpp index a457b573a24..3daacb209c0 100644 --- a/src/plugins/coreplugin/outputwindow.cpp +++ b/src/plugins/coreplugin/outputwindow.cpp @@ -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; }; diff --git a/src/plugins/projectexplorer/compileoutputwindow.cpp b/src/plugins/projectexplorer/compileoutputwindow.cpp index e7a175fe272..7f15decb549 100644 --- a/src/plugins/projectexplorer/compileoutputwindow.cpp +++ b/src/plugins/projectexplorer/compileoutputwindow.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -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; diff --git a/src/plugins/projectexplorer/compileoutputwindow.h b/src/plugins/projectexplorer/compileoutputwindow.h index 043b07001b1..3e9e3b0b517 100644 --- a/src/plugins/projectexplorer/compileoutputwindow.h +++ b/src/plugins/projectexplorer/compileoutputwindow.h @@ -82,7 +82,7 @@ public: void flush(); private: - void updateWordWrapMode(); + void updateFromSettings(); void updateZoomEnabled(); CompileOutputTextEdit *m_outputWindow; diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index ef387ea3025..7b106d89ee4 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -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); } diff --git a/src/plugins/projectexplorer/projectexplorersettings.h b/src/plugins/projectexplorer/projectexplorersettings.h index a2759d66e3d..e0d4b8088c1 100644 --- a/src/plugins/projectexplorer/projectexplorersettings.h +++ b/src/plugins/projectexplorer/projectexplorersettings.h @@ -25,6 +25,8 @@ #pragma once +#include + #include 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; } diff --git a/src/plugins/projectexplorer/projectexplorersettingspage.cpp b/src/plugins/projectexplorer/projectexplorersettingspage.cpp index 115413b47a5..35496776429 100644 --- a/src/plugins/projectexplorer/projectexplorersettingspage.cpp +++ b/src/plugins/projectexplorer/projectexplorersettingspage.cpp @@ -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(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(pes.stopBeforeBuild)); + m_ui.maxBuildOutputBox->setValue(m_settings.maxBuildOutputLines); + m_ui.stopBeforeBuildComboBox->setCurrentIndex(static_cast(m_settings.stopBeforeBuild)); } QString ProjectExplorerSettingsWidget::projectsDirectory() const diff --git a/src/plugins/projectexplorer/projectexplorersettingspage.ui b/src/plugins/projectexplorer/projectexplorersettingspage.ui index 7ea652cc174..877fbd7f84f 100644 --- a/src/plugins/projectexplorer/projectexplorersettingspage.ui +++ b/src/plugins/projectexplorer/projectexplorersettingspage.ui @@ -105,6 +105,61 @@ + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Limit build output to + + + + + + + 500 + + + 1000000 + + + 500 + + + 100000 + + + + + + + lines + + + + + + + + + + Open Application Output pane on output when running + + + + @@ -152,13 +207,6 @@ - - - - Open Application Output pane on output when running - - -