Commit f391988e authored by Leandro Melo's avatar Leandro Melo

Add option for the word-wrap mode of the application output.

Task-number: QTCREATORBUG-2190
Reviewed-by: dt
parent b2d69946
......@@ -482,6 +482,8 @@ OutputWindow::OutputWindow(QWidget *parent)
//setCenterOnScroll(false);
setFrameShape(QFrame::NoFrame);
setMouseTracking(true);
if (!ProjectExplorerPlugin::instance()->projectExplorerSettings().wrapAppOutput)
setWordWrapMode(QTextOption::NoWrap);
static uint usedIds = 0;
Core::ICore *core = Core::ICore::instance();
......@@ -520,6 +522,9 @@ OutputWindow::OutputWindow(QWidget *parent)
redoAction->setEnabled(false);
cutAction->setEnabled(false);
copyAction->setEnabled(false);
connect(ProjectExplorerPlugin::instance(), SIGNAL(settingsChanged()),
this, SLOT(updateWordWrapMode()));
}
OutputWindow::~OutputWindow()
......@@ -738,5 +743,13 @@ void OutputWindow::enableUndoRedo()
setUndoRedoEnabled(true);
}
void OutputWindow::updateWordWrapMode()
{
if (ProjectExplorerPlugin::instance()->projectExplorerSettings().wrapAppOutput)
setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
else
setWordWrapMode(QTextOption::NoWrap);
}
} // namespace Internal
} // namespace ProjectExplorer
......@@ -176,6 +176,9 @@ protected:
virtual void mouseReleaseEvent(QMouseEvent *e);
virtual void mouseMoveEvent(QMouseEvent *e);
private slots:
void updateWordWrapMode();
private:
void enableUndoRedo();
QString doNewlineEnfocement(const QString &out);
......
......@@ -797,6 +797,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
d->m_projectExplorerSettings.saveBeforeBuild = s->value("ProjectExplorer/Settings/SaveBeforeBuild", false).toBool();
d->m_projectExplorerSettings.showCompilerOutput = s->value("ProjectExplorer/Settings/ShowCompilerOutput", false).toBool();
d->m_projectExplorerSettings.cleanOldAppOutput = s->value("ProjectExplorer/Settings/CleanOldAppOutput", 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.environmentId = QUuid(s->value("ProjectExplorer/Settings/EnvironmentId").toString());
if (d->m_projectExplorerSettings.environmentId.isNull())
......@@ -1050,6 +1051,7 @@ void ProjectExplorerPlugin::savePersistentSettings()
s->setValue("ProjectExplorer/Settings/SaveBeforeBuild", d->m_projectExplorerSettings.saveBeforeBuild);
s->setValue("ProjectExplorer/Settings/ShowCompilerOutput", d->m_projectExplorerSettings.showCompilerOutput);
s->setValue("ProjectExplorer/Settings/CleanOldAppOutput", d->m_projectExplorerSettings.cleanOldAppOutput);
s->setValue("ProjectExplorer/Settings/WrapAppOutput", d->m_projectExplorerSettings.wrapAppOutput);
s->setValue("ProjectExplorer/Settings/UseJom", d->m_projectExplorerSettings.useJom);
s->setValue("ProjectExplorer/Settings/EnvironmentId", d->m_projectExplorerSettings.environmentId.toString());
}
......
......@@ -37,14 +37,16 @@ namespace Internal {
struct ProjectExplorerSettings
{
ProjectExplorerSettings() : buildBeforeDeploy(true), deployBeforeRun(true), saveBeforeBuild(false),
showCompilerOutput(false), cleanOldAppOutput(false), useJom(true) {}
ProjectExplorerSettings() : buildBeforeDeploy(true), deployBeforeRun(true),
saveBeforeBuild(false), showCompilerOutput(false),
cleanOldAppOutput(false), wrapAppOutput(true), useJom(true) {}
bool buildBeforeDeploy;
bool deployBeforeRun;
bool saveBeforeBuild;
bool showCompilerOutput;
bool cleanOldAppOutput;
bool wrapAppOutput;
bool useJom;
// Add a UUid which is used to identify the development environment.
// This is used to warn the user when he is trying to open a .user file that was created
......@@ -59,6 +61,7 @@ inline bool operator==(const ProjectExplorerSettings &p1, const ProjectExplorerS
&& p1.saveBeforeBuild == p2.saveBeforeBuild
&& p1.showCompilerOutput == p2.showCompilerOutput
&& p1.cleanOldAppOutput == p2.cleanOldAppOutput
&& p1.wrapAppOutput == p2.wrapAppOutput
&& p1.useJom == p2.useJom;
}
......
......@@ -70,6 +70,7 @@ ProjectExplorerSettings ProjectExplorerSettingsWidget::settings() const
pes.saveBeforeBuild = m_ui.saveAllFilesCheckBox->isChecked();
pes.showCompilerOutput = m_ui.showCompileOutputCheckBox->isChecked();
pes.cleanOldAppOutput = m_ui.cleanOldAppOutputCheckBox->isChecked();
pes.wrapAppOutput = m_ui.wrapAppOutputCheckBox->isChecked();
pes.useJom = m_ui.jomCheckbox->isChecked();
return pes;
}
......@@ -81,6 +82,7 @@ void ProjectExplorerSettingsWidget::setSettings(const ProjectExplorerSettings &
m_ui.saveAllFilesCheckBox->setChecked(pes.saveBeforeBuild);
m_ui.showCompileOutputCheckBox->setChecked(pes.showCompilerOutput);
m_ui.cleanOldAppOutputCheckBox->setChecked(pes.cleanOldAppOutput);
m_ui.wrapAppOutputCheckBox->setChecked(pes.wrapAppOutput);
m_ui.jomCheckbox->setChecked(pes.useJom);
}
......
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>437</width>
<height>343</height>
<height>389</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
......@@ -90,6 +90,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="wrapAppOutputCheckBox">
<property name="text">
<string>Word-wrap application output</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
......
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