Commit db2dd3e2 authored by Fawzi Mohamed's avatar Fawzi Mohamed

Option to merge stderr in application output

When activated shows correct interleaving of stdout and stderr messages,
but looses stderr highlighting.

Task-number: QTCREATORBUG-4821
Reviewed-by: ossi
parent 7c2afcf1
......@@ -50,6 +50,10 @@
#include <windows.h>
#endif
#include "projectexplorerconstants.h"
#include "projectexplorer.h"
#include "projectexplorersettings.h"
/*!
\class ProjectExplorer::ApplicationLauncher
......@@ -88,13 +92,17 @@ ApplicationLauncherPrivate::ApplicationLauncherPrivate() :
ApplicationLauncher::ApplicationLauncher(QObject *parent)
: QObject(parent), d(new ApplicationLauncherPrivate)
{
d->m_guiProcess.setReadChannelMode(QProcess::SeparateChannels);
connect(&d->m_guiProcess, SIGNAL(error(QProcess::ProcessError)),
this, SLOT(guiProcessError()));
if (ProjectExplorerPlugin::instance()->projectExplorerSettings().mergeStdErrAndStdOut){
d->m_guiProcess.setReadChannelMode(QProcess::MergedChannels);
} else {
d->m_guiProcess.setReadChannelMode(QProcess::SeparateChannels);
connect(&d->m_guiProcess, SIGNAL(readyReadStandardError()),
this, SLOT(readStandardError()));
}
connect(&d->m_guiProcess, SIGNAL(readyReadStandardOutput()),
this, SLOT(readStandardOutput()));
connect(&d->m_guiProcess, SIGNAL(readyReadStandardError()),
this, SLOT(readStandardError()));
connect(&d->m_guiProcess, SIGNAL(error(QProcess::ProcessError)),
this, SLOT(guiProcessError()));
connect(&d->m_guiProcess, SIGNAL(finished(int, QProcess::ExitStatus)),
this, SLOT(processDone(int, QProcess::ExitStatus)));
connect(&d->m_guiProcess, SIGNAL(started()),
......
......@@ -895,6 +895,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
d->m_projectExplorerSettings.showCompilerOutput = s->value("ProjectExplorer/Settings/ShowCompilerOutput", false).toBool();
d->m_projectExplorerSettings.showRunOutput = s->value("ProjectExplorer/Settings/ShowRunOutput", true).toBool();
d->m_projectExplorerSettings.cleanOldAppOutput = s->value("ProjectExplorer/Settings/CleanOldAppOutput", false).toBool();
d->m_projectExplorerSettings.mergeStdErrAndStdOut = s->value("ProjectExplorer/Settings/MergeStdErrAndStdOut", false).toBool();
d->m_projectExplorerSettings.wrapAppOutput = s->value("ProjectExplorer/Settings/WrapAppOutput", true).toBool();
d->m_projectExplorerSettings.useJom = s->value("ProjectExplorer/Settings/UseJom", true).toBool();
d->m_projectExplorerSettings.autorestoreLastSession = s->value("ProjectExplorer/Settings/AutoRestoreLastSession", false).toBool();
......@@ -1187,6 +1188,7 @@ void ProjectExplorerPlugin::savePersistentSettings()
s->setValue("ProjectExplorer/Settings/ShowCompilerOutput", d->m_projectExplorerSettings.showCompilerOutput);
s->setValue("ProjectExplorer/Settings/ShowRunOutput", d->m_projectExplorerSettings.showRunOutput);
s->setValue("ProjectExplorer/Settings/CleanOldAppOutput", d->m_projectExplorerSettings.cleanOldAppOutput);
s->setValue("ProjectExplorer/Settings/MergeStdErrAndStdOut", d->m_projectExplorerSettings.mergeStdErrAndStdOut);
s->setValue("ProjectExplorer/Settings/WrapAppOutput", d->m_projectExplorerSettings.wrapAppOutput);
s->setValue("ProjectExplorer/Settings/UseJom", d->m_projectExplorerSettings.useJom);
s->setValue("ProjectExplorer/Settings/AutoRestoreLastSession", d->m_projectExplorerSettings.autorestoreLastSession);
......
......@@ -43,7 +43,7 @@ struct ProjectExplorerSettings
ProjectExplorerSettings() :
buildBeforeDeploy(true), deployBeforeRun(true),
saveBeforeBuild(false), showCompilerOutput(false),
showRunOutput(true), cleanOldAppOutput(false),
showRunOutput(true), cleanOldAppOutput(false), mergeStdErrAndStdOut(false),
wrapAppOutput(true), useJom(true),
autorestoreLastSession(false), prompToStopRunControl(false),
maxAppOutputLines(100000)
......@@ -55,6 +55,7 @@ struct ProjectExplorerSettings
bool showCompilerOutput;
bool showRunOutput;
bool cleanOldAppOutput;
bool mergeStdErrAndStdOut;
bool wrapAppOutput;
bool useJom;
bool autorestoreLastSession; // This option is set in the Session Manager!
......@@ -75,6 +76,7 @@ inline bool operator==(const ProjectExplorerSettings &p1, const ProjectExplorerS
&& p1.showCompilerOutput == p2.showCompilerOutput
&& p1.showRunOutput == p2.showRunOutput
&& p1.cleanOldAppOutput == p2.cleanOldAppOutput
&& p1.mergeStdErrAndStdOut == p2.mergeStdErrAndStdOut
&& p1.wrapAppOutput == p2.wrapAppOutput
&& p1.useJom == p2.useJom
&& p1.autorestoreLastSession == p2.autorestoreLastSession
......
......@@ -74,6 +74,7 @@ ProjectExplorerSettings ProjectExplorerSettingsWidget::settings() const
pes.showCompilerOutput = m_ui.showCompileOutputCheckBox->isChecked();
pes.showRunOutput = m_ui.showRunOutputCheckBox->isChecked();
pes.cleanOldAppOutput = m_ui.cleanOldAppOutputCheckBox->isChecked();
pes.mergeStdErrAndStdOut = m_ui.mergeStdErrAndStdOutCheckBox->isChecked();
pes.wrapAppOutput = m_ui.wrapAppOutputCheckBox->isChecked();
pes.useJom = m_ui.jomCheckbox->isChecked();
pes.prompToStopRunControl = m_ui.promptToStopRunControlCheckBox->isChecked();
......@@ -89,6 +90,7 @@ void ProjectExplorerSettingsWidget::setSettings(const ProjectExplorerSettings &
m_ui.showCompileOutputCheckBox->setChecked(pes.showCompilerOutput);
m_ui.showRunOutputCheckBox->setChecked(pes.showRunOutput);
m_ui.cleanOldAppOutputCheckBox->setChecked(pes.cleanOldAppOutput);
m_ui.mergeStdErrAndStdOutCheckBox->setChecked(pes.mergeStdErrAndStdOut);
m_ui.wrapAppOutputCheckBox->setChecked(pes.wrapAppOutput);
m_ui.jomCheckbox->setChecked(pes.useJom);
m_ui.promptToStopRunControlCheckBox->setChecked(pes.prompToStopRunControl);
......@@ -136,6 +138,8 @@ QString ProjectExplorerSettingsWidget::searchKeywords() const
+ sep + m_ui.deployProjectBeforeRunCheckBox->text()
+ sep + m_ui.showCompileOutputCheckBox->text()
+ sep + m_ui.cleanOldAppOutputCheckBox->text()
+ sep + m_ui.mergeStdErrAndStdOutCheckBox->text()
+ sep + m_ui.mergeStdErrAndStdOutCheckBox->toolTip()
+ sep + m_ui.wrapAppOutputCheckBox->text()
+ sep + m_ui.jomLabel->text()
;
......
......@@ -97,6 +97,16 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="mergeStdErrAndStdOutCheckBox">
<property name="toolTip">
<string>Enabling this option ensures that the order of interleaved messages from stdout and stderr is preserved, at the cost of disabling highlighting of stderr.</string>
</property>
<property name="text">
<string>Merge stderr and stdout</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="wrapAppOutputCheckBox">
<property name="text">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment