diff --git a/doc/src/howto/creator-only/creator-ui.qdoc b/doc/src/howto/creator-only/creator-ui.qdoc index a9b6af4390e..7c0c7da42f9 100644 --- a/doc/src/howto/creator-only/creator-ui.qdoc +++ b/doc/src/howto/creator-only/creator-ui.qdoc @@ -260,7 +260,7 @@ To specify settings for displaying application output, select \uicontrol Tools > \uicontrol Options > \uicontrol {Build & Run} > - \uicontrol General. You can select whether to open the + \uicontrol Application Output. You can select whether to open the \uicontrol{Application Output} pane on output when running or debugging applications, to clear old output on a new run, to word-wrap output, and to limit output to the specified number of lines. @@ -280,9 +280,9 @@ To specify whether to open the \uicontrol {Compile Output} pane on output when building applications, select \uicontrol Tools > \uicontrol Options > - \uicontrol {Build & Run} > \uicontrol General, and then select the - \uicontrol {Open Compile Output pane when building} check box. - In the \uicontrol {Limit build output to} field, you can specify the maximum + \uicontrol {Build & Run} > \uicontrol Compile Output, and then select the + \uicontrol {Open pane when building} check box. + In the \uicontrol {Limit output to} field, you can specify the maximum amount of build output lines to display in the pane. \section2 To-Do Entries diff --git a/src/plugins/projectexplorer/applicationlauncher.cpp b/src/plugins/projectexplorer/applicationlauncher.cpp index 79f093d0985..c0defc548bc 100644 --- a/src/plugins/projectexplorer/applicationlauncher.cpp +++ b/src/plugins/projectexplorer/applicationlauncher.cpp @@ -126,7 +126,7 @@ public: ApplicationLauncherPrivate::ApplicationLauncherPrivate(ApplicationLauncher *parent) : q(parent), m_outputCodec(QTextCodec::codecForLocale()) { - if (ProjectExplorerPlugin::projectExplorerSettings().mergeStdErrAndStdOut){ + if (ProjectExplorerPlugin::appOutputSettings().mergeChannels) { m_guiProcess.setProcessChannelMode(QProcess::MergedChannels); } else { m_guiProcess.setProcessChannelMode(QProcess::SeparateChannels); diff --git a/src/plugins/projectexplorer/appoutputpane.cpp b/src/plugins/projectexplorer/appoutputpane.cpp index 34f71efc240..3a6e1a77ccd 100644 --- a/src/plugins/projectexplorer/appoutputpane.cpp +++ b/src/plugins/projectexplorer/appoutputpane.cpp @@ -25,8 +25,8 @@ #include "appoutputpane.h" #include "projectexplorer.h" +#include "projectexplorerconstants.h" #include "projectexplorericons.h" -#include "projectexplorersettings.h" #include "runconfiguration.h" #include "session.h" #include "windebuginterface.h" @@ -49,11 +49,15 @@ #include #include -#include +#include +#include +#include +#include +#include +#include #include #include -#include -#include +#include #include @@ -86,6 +90,12 @@ static void replaceAllChildWidgets(QLayout *layout, const QList &newC namespace { const char SETTINGS_KEY[] = "ProjectExplorer/AppOutput/Zoom"; const char C_APP_OUTPUT[] = "ProjectExplorer.ApplicationOutput"; +const char POP_UP_FOR_RUN_OUTPUT_KEY[] = "ProjectExplorer/Settings/ShowRunOutput"; +const char POP_UP_FOR_DEBUG_OUTPUT_KEY[] = "ProjectExplorer/Settings/ShowDebugOutput"; +const char CLEAN_OLD_OUTPUT_KEY[] = "ProjectExplorer/Settings/CleanOldAppOutput"; +const char MERGE_CHANNELS_KEY[] = "ProjectExplorer/Settings/MergeStdErrAndStdOut"; +const char WRAP_OUTPUT_KEY[] = "ProjectExplorer/Settings/WrapAppOutput"; +const char MAX_LINES_KEY[] = "ProjectExplorer/Settings/MaxAppOutputLines"; } namespace ProjectExplorer { @@ -169,6 +179,7 @@ AppOutputPane::AppOutputPane() : m_formatterWidget(new QWidget) { setObjectName(QLatin1String("AppOutputPane")); // Used in valgrind engine + loadSettings(); // Rerun m_reRunButton->setIcon(Utils::Icons::RUN_SMALL_TOOLBAR.icon()); @@ -244,14 +255,9 @@ AppOutputPane::AppOutputPane() : connect(SessionManager::instance(), &SessionManager::aboutToUnloadSession, this, &AppOutputPane::aboutToUnloadSession); - connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::settingsChanged, - this, &AppOutputPane::updateFromSettings); - - QSettings *settings = Core::ICore::settings(); - m_zoom = settings->value(QLatin1String(SETTINGS_KEY), 0).toFloat(); connect(Core::ICore::instance(), &Core::ICore::saveSettingsRequested, - this, &AppOutputPane::saveSettings); + this, &AppOutputPane::storeZoomFactor); } AppOutputPane::~AppOutputPane() @@ -266,7 +272,7 @@ AppOutputPane::~AppOutputPane() delete m_mainWidget; } -void AppOutputPane::saveSettings() +void AppOutputPane::storeZoomFactor() { QSettings *settings = Core::ICore::settings(); settings->setValue(QLatin1String(SETTINGS_KEY), m_zoom); @@ -446,8 +452,8 @@ void AppOutputPane::createNewOutputWindow(RunControl *rc) Core::OutputWindow *ow = new Core::OutputWindow(context, m_tabWidget); ow->setWindowTitle(tr("Application Output Window")); ow->setWindowIcon(Icons::WINDOW.icon()); - ow->setWordWrapEnabled(ProjectExplorerPlugin::projectExplorerSettings().wrapAppOutput); - ow->setMaxCharCount(ProjectExplorerPlugin::projectExplorerSettings().maxAppOutputChars); + ow->setWordWrapEnabled(m_settings.wrapOutput); + ow->setMaxCharCount(m_settings.maxCharCount); ow->setWheelZoomEnabled(TextEditor::TextEditorSettings::behaviorSettings().m_scrollWheelZooming); ow->setBaseFont(TextEditor::TextEditorSettings::fontSettings().font()); ow->setFontZoom(m_zoom); @@ -470,7 +476,7 @@ void AppOutputPane::createNewOutputWindow(RunControl *rc) void AppOutputPane::handleOldOutput(Core::OutputWindow *window) const { - if (ProjectExplorerPlugin::projectExplorerSettings().cleanOldAppOutput) + if (m_settings.cleanOldOutput) window->clear(); else window->grayOutOldContent(); @@ -479,8 +485,8 @@ void AppOutputPane::handleOldOutput(Core::OutputWindow *window) const void AppOutputPane::updateFromSettings() { foreach (const RunControlTab &tab, m_runControlTabs) { - tab.window->setWordWrapEnabled(ProjectExplorerPlugin::projectExplorerSettings().wrapAppOutput); - tab.window->setMaxCharCount(ProjectExplorerPlugin::projectExplorerSettings().maxAppOutputChars); + tab.window->setWordWrapEnabled(m_settings.wrapOutput); + tab.window->setMaxCharCount(m_settings.maxCharCount); } } @@ -505,6 +511,37 @@ void AppOutputPane::appendMessage(RunControl *rc, const QString &out, Utils::Out } } +void AppOutputPane::setSettings(const AppOutputSettings &settings) +{ + m_settings = settings; + storeSettings(); + updateFromSettings(); +} + +void AppOutputPane::storeSettings() const +{ + QSettings * const s = Core::ICore::settings(); + s->setValue(POP_UP_FOR_RUN_OUTPUT_KEY, m_settings.popUpForRunOutput); + s->setValue(POP_UP_FOR_DEBUG_OUTPUT_KEY, m_settings.popUpForDebugOutput); + s->setValue(CLEAN_OLD_OUTPUT_KEY, m_settings.cleanOldOutput); + s->setValue(MERGE_CHANNELS_KEY, m_settings.mergeChannels); + s->setValue(WRAP_OUTPUT_KEY, m_settings.wrapOutput); + s->setValue(MAX_LINES_KEY, m_settings.maxCharCount / 100); +} + +void AppOutputPane::loadSettings() +{ + QSettings * const s = Core::ICore::settings(); + m_settings.popUpForRunOutput = s->value(POP_UP_FOR_RUN_OUTPUT_KEY, true).toBool(); + m_settings.popUpForDebugOutput = s->value(POP_UP_FOR_DEBUG_OUTPUT_KEY, false).toBool(); + m_settings.cleanOldOutput = s->value(CLEAN_OLD_OUTPUT_KEY, false).toBool(); + m_settings.mergeChannels = s->value(MERGE_CHANNELS_KEY, false).toBool(); + m_settings.wrapOutput = s->value(WRAP_OUTPUT_KEY, true).toBool(); + m_settings.maxCharCount = s->value(MAX_LINES_KEY, + Core::Constants::DEFAULT_MAX_CHAR_COUNT).toInt() * 100; + m_zoom = s->value(SETTINGS_KEY, 0).toFloat(); +} + void AppOutputPane::showTabFor(RunControl *rc) { m_tabWidget->setCurrentIndex(tabWidgetIndexOf(indexOf(rc))); @@ -773,5 +810,85 @@ bool AppOutputPane::canNavigate() const return false; } +class AppOutputSettingsPage::SettingsWidget : public QWidget +{ + Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::Internal::AppOutputSettingsPage) +public: + SettingsWidget() + { + const AppOutputSettings &settings = ProjectExplorerPlugin::appOutputSettings(); + m_wrapOutputCheckBox.setText(tr("Word-wrap output")); + m_wrapOutputCheckBox.setChecked(settings.wrapOutput); + m_cleanOldOutputCheckBox.setText(tr("Clear old output on a new run")); + m_cleanOldOutputCheckBox.setChecked(settings.cleanOldOutput); + m_mergeChannelsCheckBox.setText(tr("Merge stderr and stdout")); + m_mergeChannelsCheckBox.setChecked(settings.mergeChannels); + m_popUpForRunOutputCheckBox.setText(tr("Open pane on output when running")); + m_popUpForRunOutputCheckBox.setChecked(settings.popUpForRunOutput); + m_popUpForDebugOutputCheckBox.setText(tr("Open pane on output when debugging")); + m_popUpForDebugOutputCheckBox.setChecked(settings.popUpForDebugOutput); + m_maxCharsBox.setMaximum(100000000); + m_maxCharsBox.setValue(settings.maxCharCount); + const auto layout = new QVBoxLayout(this); + layout->addWidget(&m_wrapOutputCheckBox); + layout->addWidget(&m_cleanOldOutputCheckBox); + layout->addWidget(&m_mergeChannelsCheckBox); + layout->addWidget(&m_popUpForRunOutputCheckBox); + layout->addWidget(&m_popUpForDebugOutputCheckBox); + const auto maxCharsLayout = new QHBoxLayout; + maxCharsLayout->addWidget(new QLabel(tr("Limit output to"))); // TODO: This looks problematic i18n-wise + maxCharsLayout->addWidget(&m_maxCharsBox); + maxCharsLayout->addWidget(new QLabel(tr("characters"))); + maxCharsLayout->addStretch(1); + layout->addLayout(maxCharsLayout); + layout->addStretch(1); + } + + AppOutputSettings settings() const + { + AppOutputSettings s; + s.wrapOutput = m_wrapOutputCheckBox.isChecked(); + s.cleanOldOutput = m_cleanOldOutputCheckBox.isChecked(); + s.mergeChannels = m_mergeChannelsCheckBox.isChecked(); + s.popUpForRunOutput = m_popUpForRunOutputCheckBox.isChecked(); + s.popUpForDebugOutput = m_popUpForDebugOutputCheckBox.isChecked(); + s.maxCharCount = m_maxCharsBox.value(); + return s; + } + +private: + QCheckBox m_wrapOutputCheckBox; + QCheckBox m_cleanOldOutputCheckBox; + QCheckBox m_mergeChannelsCheckBox; + QCheckBox m_popUpForRunOutputCheckBox; + QCheckBox m_popUpForDebugOutputCheckBox; + QSpinBox m_maxCharsBox; +}; + +AppOutputSettingsPage::AppOutputSettingsPage() +{ + setId("B.ProjectExplorer.AppOutputOptions"); + setDisplayName(tr("Application Output")); + setCategory(Constants::BUILD_AND_RUN_SETTINGS_CATEGORY); +} + +QWidget *AppOutputSettingsPage::widget() +{ + if (!m_widget) + m_widget = new SettingsWidget; + return m_widget; +} + +void AppOutputSettingsPage::apply() +{ + if (m_widget) + ProjectExplorerPlugin::setAppOutputSettings(m_widget->settings()); +} + +void AppOutputSettingsPage::finish() +{ + delete m_widget; +} + #include "appoutputpane.moc" diff --git a/src/plugins/projectexplorer/appoutputpane.h b/src/plugins/projectexplorer/appoutputpane.h index fc7ac6e05eb..582ad653d9a 100644 --- a/src/plugins/projectexplorer/appoutputpane.h +++ b/src/plugins/projectexplorer/appoutputpane.h @@ -25,13 +25,16 @@ #pragma once -#include -#include +#include "projectexplorersettings.h" #include +#include #include +#include +#include + QT_BEGIN_NAMESPACE class QTabWidget; class QToolButton; @@ -98,6 +101,9 @@ public: void appendMessage(ProjectExplorer::RunControl *rc, const QString &out, Utils::OutputFormat format); + const AppOutputSettings &settings() const { return m_settings; } + void setSettings(const AppOutputSettings &settings); + private: void reRunRunControl(); void stopRunControl(); @@ -137,9 +143,12 @@ private: void handleOldOutput(Core::OutputWindow *window) const; void updateCloseActions(); void updateFontSettings(); - void saveSettings(); + void storeZoomFactor(); void updateBehaviorSettings(); + void loadSettings(); + void storeSettings() const; + QWidget *m_mainWidget; TabWidget *m_tabWidget; QVector m_runControlTabs; @@ -155,6 +164,23 @@ private: QToolButton *m_zoomOutButton; QWidget *m_formatterWidget; float m_zoom; + AppOutputSettings m_settings; +}; + +class AppOutputSettingsPage : public Core::IOptionsPage +{ + Q_OBJECT + +public: + AppOutputSettingsPage(); + +private: + QWidget *widget() override; + void apply() override; + void finish() override; + + class SettingsWidget; + QPointer m_widget; }; } // namespace Internal diff --git a/src/plugins/projectexplorer/buildmanager.cpp b/src/plugins/projectexplorer/buildmanager.cpp index 6018659c7e4..23460955f84 100644 --- a/src/plugins/projectexplorer/buildmanager.cpp +++ b/src/plugins/projectexplorer/buildmanager.cpp @@ -186,6 +186,16 @@ int BuildManager::getErrorTaskCount() return errors; } +void BuildManager::setCompileOutputSettings(const Internal::CompileOutputSettings &settings) +{ + d->m_outputWindow->setSettings(settings); +} + +const Internal::CompileOutputSettings &BuildManager::compileOutputSettings() +{ + return d->m_outputWindow->settings(); +} + void BuildManager::cancel() { if (d->m_running) { @@ -511,7 +521,7 @@ bool BuildManager::buildLists(QList bsls, const QStringList &pr return false; } - if (ProjectExplorerPlugin::projectExplorerSettings().showCompilerOutput) + if (d->m_outputWindow->settings().popUp) d->m_outputWindow->popup(IOutputPane::NoModeSwitch); startBuildQueue(); return true; @@ -524,7 +534,7 @@ void BuildManager::appendStep(BuildStep *step, const QString &name) d->m_outputWindow->popup(IOutputPane::NoModeSwitch); return; } - if (ProjectExplorerPlugin::projectExplorerSettings().showCompilerOutput) + if (d->m_outputWindow->settings().popUp) d->m_outputWindow->popup(IOutputPane::NoModeSwitch); startBuildQueue(); } diff --git a/src/plugins/projectexplorer/buildmanager.h b/src/plugins/projectexplorer/buildmanager.h index fc23bc851af..fe452d6965e 100644 --- a/src/plugins/projectexplorer/buildmanager.h +++ b/src/plugins/projectexplorer/buildmanager.h @@ -32,6 +32,7 @@ #include namespace ProjectExplorer { +namespace Internal { class CompileOutputSettings; } class Task; class Project; @@ -64,6 +65,9 @@ public: static int getErrorTaskCount(); + static void setCompileOutputSettings(const Internal::CompileOutputSettings &settings); + static const Internal::CompileOutputSettings &compileOutputSettings(); + public slots: static void cancel(); // Shows without focus diff --git a/src/plugins/projectexplorer/compileoutputwindow.cpp b/src/plugins/projectexplorer/compileoutputwindow.cpp index a76ea49ea7d..305d6ca6e2f 100644 --- a/src/plugins/projectexplorer/compileoutputwindow.cpp +++ b/src/plugins/projectexplorer/compileoutputwindow.cpp @@ -45,12 +45,17 @@ #include #include +#include +#include #include -#include -#include -#include +#include #include +#include +#include +#include +#include #include +#include using namespace ProjectExplorer; using namespace ProjectExplorer::Internal; @@ -58,6 +63,9 @@ using namespace ProjectExplorer::Internal; namespace { const char SETTINGS_KEY[] = "ProjectExplorer/CompileOutput/Zoom"; const char C_COMPILE_OUTPUT[] = "ProjectExplorer.CompileOutput"; +const char POP_UP_KEY[] = "ProjectExplorer/Settings/ShowCompilerOutput"; +const char WRAP_OUTPUT_KEY[] = "ProjectExplorer/Settings/WrapBuildOutput"; +const char MAX_LINES_KEY[] = "ProjectExplorer/Settings/MaxBuildOutputLines"; } namespace ProjectExplorer { @@ -199,8 +207,7 @@ CompileOutputWindow::CompileOutputWindow(QAction *cancelBuildAction) : m_handler = new ShowOutputTaskHandler(this); ExtensionSystem::PluginManager::addObject(m_handler); - connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::settingsChanged, - this, &CompileOutputWindow::updateFromSettings); + loadSettings(); updateFromSettings(); } @@ -226,8 +233,8 @@ void CompileOutputWindow::updateZoomEnabled() void CompileOutputWindow::updateFromSettings() { - m_outputWindow->setWordWrapEnabled(ProjectExplorerPlugin::projectExplorerSettings().wrapAppOutput); - m_outputWindow->setMaxCharCount(ProjectExplorerPlugin::projectExplorerSettings().maxBuildOutputChars); + m_outputWindow->setWordWrapEnabled(m_settings.wrapOutput); + m_outputWindow->setMaxCharCount(m_settings.maxCharCount); } bool CompileOutputWindow::hasFocus() const @@ -359,4 +366,93 @@ void CompileOutputWindow::flush() m_formatter->flush(); } +void CompileOutputWindow::setSettings(const CompileOutputSettings &settings) +{ + m_settings = settings; + storeSettings(); + updateFromSettings(); +} + +void CompileOutputWindow::loadSettings() +{ + QSettings * const s = Core::ICore::settings(); + m_settings.popUp = s->value(POP_UP_KEY, false).toBool(); + m_settings.wrapOutput = s->value(WRAP_OUTPUT_KEY, true).toBool(); + m_settings.maxCharCount = s->value(MAX_LINES_KEY, + Core::Constants::DEFAULT_MAX_CHAR_COUNT).toInt() * 100; +} + +void CompileOutputWindow::storeSettings() const +{ + QSettings * const s = Core::ICore::settings(); + s->setValue(POP_UP_KEY, m_settings.popUp); + s->setValue(WRAP_OUTPUT_KEY, m_settings.wrapOutput); + s->setValue(MAX_LINES_KEY, m_settings.maxCharCount / 100); +} + +class CompileOutputSettingsPage::SettingsWidget : public QWidget +{ + Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::Internal::CompileOutputSettingsPage) +public: + SettingsWidget() + { + const CompileOutputSettings &settings = BuildManager::compileOutputSettings(); + m_wrapOutputCheckBox.setText(tr("Word-wrap output")); + m_wrapOutputCheckBox.setChecked(settings.wrapOutput); + m_popUpCheckBox.setText(tr("Open pane when building")); + m_popUpCheckBox.setChecked(settings.popUp); + m_maxCharsBox.setMaximum(100000000); + m_maxCharsBox.setValue(settings.maxCharCount); + const auto layout = new QVBoxLayout(this); + layout->addWidget(&m_wrapOutputCheckBox); + layout->addWidget(&m_popUpCheckBox); + const auto maxCharsLayout = new QHBoxLayout; + maxCharsLayout->addWidget(new QLabel(tr("Limit output to"))); // TODO: This looks problematic i18n-wise + maxCharsLayout->addWidget(&m_maxCharsBox); + maxCharsLayout->addWidget(new QLabel(tr("characters"))); + maxCharsLayout->addStretch(1); + layout->addLayout(maxCharsLayout); + layout->addStretch(1); + } + + CompileOutputSettings settings() const + { + CompileOutputSettings s; + s.wrapOutput = m_wrapOutputCheckBox.isChecked(); + s.popUp = m_popUpCheckBox.isChecked(); + s.maxCharCount = m_maxCharsBox.value(); + return s; + } + +private: + QCheckBox m_wrapOutputCheckBox; + QCheckBox m_popUpCheckBox; + QSpinBox m_maxCharsBox; +}; + +CompileOutputSettingsPage::CompileOutputSettingsPage() +{ + setId("C.ProjectExplorer.CompileOutputOptions"); + setDisplayName(tr("Compile Output")); + setCategory(Constants::BUILD_AND_RUN_SETTINGS_CATEGORY); +} + +QWidget *CompileOutputSettingsPage::widget() +{ + if (!m_widget) + m_widget = new SettingsWidget; + return m_widget; +} + +void CompileOutputSettingsPage::apply() +{ + if (m_widget) + BuildManager::setCompileOutputSettings(m_widget->settings()); +} + +void CompileOutputSettingsPage::finish() +{ + delete m_widget; +} + #include "compileoutputwindow.moc" diff --git a/src/plugins/projectexplorer/compileoutputwindow.h b/src/plugins/projectexplorer/compileoutputwindow.h index 9ff9c8ac92e..e2376c2b3f1 100644 --- a/src/plugins/projectexplorer/compileoutputwindow.h +++ b/src/plugins/projectexplorer/compileoutputwindow.h @@ -26,10 +26,13 @@ #pragma once #include "buildstep.h" +#include "projectexplorersettings.h" +#include #include #include #include +#include QT_BEGIN_NAMESPACE class QPlainTextEdit; @@ -81,7 +84,12 @@ public: void flush(); + const CompileOutputSettings &settings() const { return m_settings; } + void setSettings(const CompileOutputSettings &settings); + private: + void loadSettings(); + void storeSettings() const; void updateFromSettings(); void updateZoomEnabled(); @@ -92,6 +100,23 @@ private: QToolButton *m_zoomInButton; QToolButton *m_zoomOutButton; Utils::OutputFormatter *m_formatter; + CompileOutputSettings m_settings; +}; + +class CompileOutputSettingsPage : public Core::IOptionsPage +{ + Q_OBJECT + +public: + CompileOutputSettingsPage(); + +private: + QWidget *widget() override; + void apply() override; + void finish() override; + + class SettingsWidget; + QPointer m_widget; }; } // namespace Internal diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index ad588a12bd9..c57f3a19c50 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -25,7 +25,9 @@ #include "projectexplorer.h" +#include "appoutputpane.h" #include "buildsteplist.h" +#include "compileoutputwindow.h" #include "configtaskhandler.h" #include "customexecutablerunconfiguration.h" #include "customwizard/customwizard.h" @@ -546,6 +548,8 @@ public: // Settings pages ProjectExplorerSettingsPage m_projectExplorerSettingsPage; + AppOutputSettingsPage m_appOutputSettingsPage; + CompileOutputSettingsPage m_compileOutputSettingsPage; DeviceSettingsPage m_deviceSettingsPage; SshSettingsPage m_sshSettingsPage; @@ -1302,18 +1306,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er s->value(QLatin1String("ProjectExplorer/Settings/DeployBeforeRun"), true).toBool(); dd->m_projectExplorerSettings.saveBeforeBuild = s->value(QLatin1String("ProjectExplorer/Settings/SaveBeforeBuild"), false).toBool(); - dd->m_projectExplorerSettings.showCompilerOutput = - s->value(QLatin1String("ProjectExplorer/Settings/ShowCompilerOutput"), false).toBool(); - dd->m_projectExplorerSettings.showRunOutput = - s->value(QLatin1String("ProjectExplorer/Settings/ShowRunOutput"), true).toBool(); - dd->m_projectExplorerSettings.showDebugOutput = - s->value(QLatin1String("ProjectExplorer/Settings/ShowDebugOutput"), false).toBool(); - dd->m_projectExplorerSettings.cleanOldAppOutput = - s->value(QLatin1String("ProjectExplorer/Settings/CleanOldAppOutput"), false).toBool(); - dd->m_projectExplorerSettings.mergeStdErrAndStdOut = - s->value(QLatin1String("ProjectExplorer/Settings/MergeStdErrAndStdOut"), false).toBool(); - dd->m_projectExplorerSettings.wrapAppOutput = - s->value(QLatin1String("ProjectExplorer/Settings/WrapAppOutput"), true).toBool(); dd->m_projectExplorerSettings.useJom = s->value(QLatin1String("ProjectExplorer/Settings/UseJom"), true).toBool(); dd->m_projectExplorerSettings.autorestoreLastSession = @@ -1324,12 +1316,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er s->value(QLatin1String("ProjectExplorer/Settings/PromptToStopRunControl"), false).toBool(); dd->m_projectExplorerSettings.automaticallyCreateRunConfigurations = s->value(QLatin1String("ProjectExplorer/Settings/AutomaticallyCreateRunConfigurations"), true).toBool(); - dd->m_projectExplorerSettings.maxAppOutputChars = - s->value(QLatin1String("ProjectExplorer/Settings/MaxAppOutputLines"), - Core::Constants::DEFAULT_MAX_CHAR_COUNT).toInt() * 100; - dd->m_projectExplorerSettings.maxBuildOutputChars = - s->value(QLatin1String("ProjectExplorer/Settings/MaxBuildOutputLines"), - Core::Constants::DEFAULT_MAX_CHAR_COUNT).toInt() * 100; dd->m_projectExplorerSettings.environmentId = QUuid(s->value(QLatin1String("ProjectExplorer/Settings/EnvironmentId")).toByteArray()); if (dd->m_projectExplorerSettings.environmentId.isNull()) @@ -1918,20 +1904,12 @@ void ProjectExplorerPluginPrivate::savePersistentSettings() s->setValue(QLatin1String("ProjectExplorer/Settings/BuildBeforeDeploy"), dd->m_projectExplorerSettings.buildBeforeDeploy); s->setValue(QLatin1String("ProjectExplorer/Settings/DeployBeforeRun"), dd->m_projectExplorerSettings.deployBeforeRun); s->setValue(QLatin1String("ProjectExplorer/Settings/SaveBeforeBuild"), dd->m_projectExplorerSettings.saveBeforeBuild); - s->setValue(QLatin1String("ProjectExplorer/Settings/ShowCompilerOutput"), dd->m_projectExplorerSettings.showCompilerOutput); - s->setValue(QLatin1String("ProjectExplorer/Settings/ShowRunOutput"), dd->m_projectExplorerSettings.showRunOutput); - s->setValue(QLatin1String("ProjectExplorer/Settings/ShowDebugOutput"), dd->m_projectExplorerSettings.showDebugOutput); - s->setValue(QLatin1String("ProjectExplorer/Settings/CleanOldAppOutput"), dd->m_projectExplorerSettings.cleanOldAppOutput); - s->setValue(QLatin1String("ProjectExplorer/Settings/MergeStdErrAndStdOut"), dd->m_projectExplorerSettings.mergeStdErrAndStdOut); - s->setValue(QLatin1String("ProjectExplorer/Settings/WrapAppOutput"), dd->m_projectExplorerSettings.wrapAppOutput); s->setValue(QLatin1String("ProjectExplorer/Settings/UseJom"), dd->m_projectExplorerSettings.useJom); s->setValue(QLatin1String("ProjectExplorer/Settings/AutoRestoreLastSession"), dd->m_projectExplorerSettings.autorestoreLastSession); s->setValue(QLatin1String("ProjectExplorer/Settings/AddLibraryPathsToRunEnv"), dd->m_projectExplorerSettings.addLibraryPathsToRunEnv); s->setValue(QLatin1String("ProjectExplorer/Settings/PromptToStopRunControl"), dd->m_projectExplorerSettings.prompToStopRunControl); s->setValue(QLatin1String("ProjectExplorer/Settings/AutomaticallyCreateRunConfigurations"), dd->m_projectExplorerSettings.automaticallyCreateRunConfigurations); - s->setValue(QLatin1String("ProjectExplorer/Settings/MaxAppOutputLines"), dd->m_projectExplorerSettings.maxAppOutputChars / 100); - s->setValue(QLatin1String("ProjectExplorer/Settings/MaxBuildOutputLines"), dd->m_projectExplorerSettings.maxBuildOutputChars / 100); s->setValue(QLatin1String("ProjectExplorer/Settings/EnvironmentId"), dd->m_projectExplorerSettings.environmentId.toByteArray()); s->setValue(QLatin1String("ProjectExplorer/Settings/StopBeforeBuild"), dd->m_projectExplorerSettings.stopBeforeBuild); @@ -2244,8 +2222,8 @@ void ProjectExplorerPluginPrivate::startRunControl(RunControl *runControl) m_outputPane.flash(); // one flash for starting m_outputPane.showTabFor(runControl); Core::Id runMode = runControl->runMode(); - bool popup = (runMode == Constants::NORMAL_RUN_MODE && dd->m_projectExplorerSettings.showRunOutput) - || (runMode == Constants::DEBUG_RUN_MODE && m_projectExplorerSettings.showDebugOutput); + bool popup = (runMode == Constants::NORMAL_RUN_MODE && m_outputPane.settings().popUpForRunOutput) + || (runMode == Constants::DEBUG_RUN_MODE && m_outputPane.settings().popUpForDebugOutput); m_outputPane.setBehaviorOnOutput(runControl, popup ? AppOutputPane::Popup : AppOutputPane::Flash); connect(runControl, &QObject::destroyed, this, &ProjectExplorerPluginPrivate::checkForShutdown, Qt::QueuedConnection); @@ -3729,6 +3707,16 @@ const ProjectExplorerSettings &ProjectExplorerPlugin::projectExplorerSettings() return dd->m_projectExplorerSettings; } +void ProjectExplorerPlugin::setAppOutputSettings(const AppOutputSettings &settings) +{ + dd->m_outputPane.setSettings(settings); +} + +const AppOutputSettings &ProjectExplorerPlugin::appOutputSettings() +{ + return dd->m_outputPane.settings(); +} + QStringList ProjectExplorerPlugin::projectFilePatterns() { QStringList patterns; diff --git a/src/plugins/projectexplorer/projectexplorer.h b/src/plugins/projectexplorer/projectexplorer.h index ed9b8766b50..ab843ebae93 100644 --- a/src/plugins/projectexplorer/projectexplorer.h +++ b/src/plugins/projectexplorer/projectexplorer.h @@ -56,7 +56,10 @@ class Node; class FolderNode; class FileNode; -namespace Internal { class ProjectExplorerSettings; } +namespace Internal { +class AppOutputSettings; +class ProjectExplorerSettings; +} class PROJECTEXPLORER_EXPORT ProjectExplorerPlugin : public ExtensionSystem::IPlugin { @@ -129,6 +132,9 @@ public: static void setProjectExplorerSettings(const Internal::ProjectExplorerSettings &pes); static const Internal::ProjectExplorerSettings &projectExplorerSettings(); + static void setAppOutputSettings(const Internal::AppOutputSettings &settings); + static const Internal::AppOutputSettings &appOutputSettings(); + static void startRunControl(RunControl *runControl); static void showRunErrorMessage(const QString &errorMessage); diff --git a/src/plugins/projectexplorer/projectexplorersettings.h b/src/plugins/projectexplorer/projectexplorersettings.h index 13277e9736a..f0ddf6fa112 100644 --- a/src/plugins/projectexplorer/projectexplorersettings.h +++ b/src/plugins/projectexplorer/projectexplorersettings.h @@ -41,19 +41,11 @@ public: bool buildBeforeDeploy = true; bool deployBeforeRun = true; bool saveBeforeBuild = false; - bool showCompilerOutput = false; - bool showRunOutput = true; - bool showDebugOutput = false; - bool cleanOldAppOutput = false; - bool mergeStdErrAndStdOut = false; - bool wrapAppOutput = true; bool useJom = true; bool autorestoreLastSession = false; // This option is set in the Session Manager! bool prompToStopRunControl = false; bool automaticallyCreateRunConfigurations = true; bool addLibraryPathsToRunEnv = true; - int maxAppOutputChars = Core::Constants::DEFAULT_MAX_CHAR_COUNT; - int maxBuildOutputChars = Core::Constants::DEFAULT_MAX_CHAR_COUNT; StopBeforeBuild stopBeforeBuild = StopBeforeBuild::StopNone; QString buildDirectoryTemplate; @@ -68,23 +60,34 @@ inline bool operator==(const ProjectExplorerSettings &p1, const ProjectExplorerS return p1.buildBeforeDeploy == p2.buildBeforeDeploy && p1.deployBeforeRun == p2.deployBeforeRun && p1.saveBeforeBuild == p2.saveBeforeBuild - && p1.showCompilerOutput == p2.showCompilerOutput - && p1.showRunOutput == p2.showRunOutput - && p1.showDebugOutput == p2.showDebugOutput - && p1.cleanOldAppOutput == p2.cleanOldAppOutput - && p1.mergeStdErrAndStdOut == p2.mergeStdErrAndStdOut - && p1.wrapAppOutput == p2.wrapAppOutput && p1.useJom == p2.useJom && p1.autorestoreLastSession == p2.autorestoreLastSession && p1.prompToStopRunControl == p2.prompToStopRunControl && p1.automaticallyCreateRunConfigurations == p2.automaticallyCreateRunConfigurations && p1.addLibraryPathsToRunEnv == p2.addLibraryPathsToRunEnv - && p1.maxAppOutputChars == p2.maxAppOutputChars - && p1.maxBuildOutputChars == p2.maxBuildOutputChars && p1.environmentId == p2.environmentId && p1.stopBeforeBuild == p2.stopBeforeBuild && p1.buildDirectoryTemplate == p2.buildDirectoryTemplate; } +class AppOutputSettings +{ +public: + bool popUpForRunOutput = true; + bool popUpForDebugOutput = false; + bool cleanOldOutput = false; + bool mergeChannels = false; + bool wrapOutput = false; + int maxCharCount = Core::Constants::DEFAULT_MAX_CHAR_COUNT; +}; + +class CompileOutputSettings +{ +public: + bool popUp = false; + bool wrapOutput = false; + int maxCharCount = Core::Constants::DEFAULT_MAX_CHAR_COUNT; +}; + } // namespace ProjectExplorer } // namespace Internal diff --git a/src/plugins/projectexplorer/projectexplorersettingspage.cpp b/src/plugins/projectexplorer/projectexplorersettingspage.cpp index 6ba1ce5cdf9..8f2ea84986f 100644 --- a/src/plugins/projectexplorer/projectexplorersettingspage.cpp +++ b/src/plugins/projectexplorer/projectexplorersettingspage.cpp @@ -100,18 +100,10 @@ ProjectExplorerSettings ProjectExplorerSettingsWidget::settings() const m_settings.buildBeforeDeploy = m_ui.buildProjectBeforeDeployCheckBox->isChecked(); m_settings.deployBeforeRun = m_ui.deployProjectBeforeRunCheckBox->isChecked(); m_settings.saveBeforeBuild = m_ui.saveAllFilesCheckBox->isChecked(); - m_settings.showCompilerOutput = m_ui.showCompileOutputCheckBox->isChecked(); - m_settings.showRunOutput = m_ui.showRunOutputCheckBox->isChecked(); - m_settings.showDebugOutput = m_ui.showDebugOutputCheckBox->isChecked(); - m_settings.cleanOldAppOutput = m_ui.cleanOldAppOutputCheckBox->isChecked(); - m_settings.mergeStdErrAndStdOut = m_ui.mergeStdErrAndStdOutCheckBox->isChecked(); - m_settings.wrapAppOutput = m_ui.wrapAppOutputCheckBox->isChecked(); m_settings.useJom = m_ui.jomCheckbox->isChecked(); m_settings.addLibraryPathsToRunEnv = m_ui.addLibraryPathsToRunEnvCheckBox->isChecked(); m_settings.prompToStopRunControl = m_ui.promptToStopRunControlCheckBox->isChecked(); m_settings.automaticallyCreateRunConfigurations = m_ui.automaticallyCreateRunConfiguration->isChecked(); - m_settings.maxAppOutputChars = m_ui.maxAppOutputBox->value(); - m_settings.maxBuildOutputChars = m_ui.maxBuildOutputBox->value(); m_settings.stopBeforeBuild = static_cast(m_ui.stopBeforeBuildComboBox->currentIndex()); m_settings.buildDirectoryTemplate = buildDirectoryTemplate(); return m_settings; @@ -123,18 +115,10 @@ void ProjectExplorerSettingsWidget::setSettings(const ProjectExplorerSettings & m_ui.buildProjectBeforeDeployCheckBox->setChecked(m_settings.buildBeforeDeploy); m_ui.deployProjectBeforeRunCheckBox->setChecked(m_settings.deployBeforeRun); m_ui.saveAllFilesCheckBox->setChecked(m_settings.saveBeforeBuild); - m_ui.showCompileOutputCheckBox->setChecked(m_settings.showCompilerOutput); - m_ui.showRunOutputCheckBox->setChecked(m_settings.showRunOutput); - m_ui.showDebugOutputCheckBox->setChecked(m_settings.showDebugOutput); - m_ui.cleanOldAppOutputCheckBox->setChecked(m_settings.cleanOldAppOutput); - m_ui.mergeStdErrAndStdOutCheckBox->setChecked(m_settings.mergeStdErrAndStdOut); - m_ui.wrapAppOutputCheckBox->setChecked(m_settings.wrapAppOutput); m_ui.jomCheckbox->setChecked(m_settings.useJom); m_ui.addLibraryPathsToRunEnvCheckBox->setChecked(m_settings.addLibraryPathsToRunEnv); m_ui.promptToStopRunControlCheckBox->setChecked(m_settings.prompToStopRunControl); m_ui.automaticallyCreateRunConfiguration->setChecked(m_settings.automaticallyCreateRunConfigurations); - m_ui.maxAppOutputBox->setValue(m_settings.maxAppOutputChars); - m_ui.maxBuildOutputBox->setValue(m_settings.maxBuildOutputChars); m_ui.stopBeforeBuildComboBox->setCurrentIndex(static_cast(m_settings.stopBeforeBuild)); setBuildDirectoryTemplate(pes.buildDirectoryTemplate); } diff --git a/src/plugins/projectexplorer/projectexplorersettingspage.ui b/src/plugins/projectexplorer/projectexplorersettingspage.ui index 7fecbfb38ef..1f9239e789b 100644 --- a/src/plugins/projectexplorer/projectexplorersettingspage.ui +++ b/src/plugins/projectexplorer/projectexplorersettingspage.ui @@ -6,8 +6,8 @@ 0 0 - 831 - 520 + 963 + 564 @@ -52,176 +52,7 @@ Build and Run - - - - Save all files before build - - - - - - - Clear old application output on a new run - - - - - - - Always build project before deploying it - - - - - - - Enabling this option ensures that the order of interleaved messages from stdout and stderr is preserved, at the cost of disabling highlighting of stderr. - - - Merge stderr and stdout - - - - - - - Always deploy project before running it - - - - - - - Word-wrap application output - - - - - - - Add linker library search paths to run environment - - - - - - - Open Compile Output pane when building - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Limit build output to - - - - - - - 5000 - - - 100000000 - - - 5000 - - - 10000000 - - - - - - - characters - - - - - - - - - - Open Application Output pane on output when running - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Limit application output to - - - - - - - 5000 - - - 100000000 - - - 5000 - - - 10000000 - - - - - - - characters - - - - - - - - - Open Application Output pane on output when debugging - - - - Asks before terminating the running application in response to clicking the stop button in Application Output. @@ -231,17 +62,40 @@ - - - - Creates suitable run configurations automatically when setting up a new kit. - - - Create suitable run configurations automatically - - - + + + 0 + + + + + + + + Use jom instead of nmake + + + + + + + <i>jom</i> is a drop-in replacement for <i>nmake</i> which distributes the compilation process to multiple CPU cores. The latest binary is available at <a href="http://download.qt.io/official_releases/jom/">http://download.qt.io/official_releases/jom/</a>. Disable it if you experience problems with your builds. + + + true + + + 20 + + + true + + + + + + @@ -289,40 +143,24 @@ - - - - 0 + + + + Add linker library search paths to run environment - - - - - - - Use jom instead of nmake - - - - - - - <i>jom</i> is a drop-in replacement for <i>nmake</i> which distributes the compilation process to multiple CPU cores. The latest binary is available at <a href="http://download.qt.io/official_releases/jom/">http://download.qt.io/official_releases/jom/</a>. Disable it if you experience problems with your builds. - - - true - - - 20 - - - true - - - - + - + + + + Creates suitable run configurations automatically when setting up a new kit. + + + Create suitable run configurations automatically + + + + 12 @@ -346,18 +184,53 @@ + + + + Always build project before deploying it + + + + + + + Save all files before build + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + Always deploy project before running it + + + + widget_1 + automaticallyCreateRunConfiguration saveAllFilesCheckBox buildProjectBeforeDeployCheckBox deployProjectBeforeRunCheckBox - showCompileOutputCheckBox - cleanOldAppOutputCheckBox - mergeStdErrAndStdOutCheckBox - wrapAppOutputCheckBox - widget promptToStopRunControlCheckBox - showRunOutputCheckBox - showDebugOutputCheckBox + addLibraryPathsToRunEnvCheckBox