forked from qt-creator/qt-creator
Make the buffer size for the Application Output window configurable
Task-number: QTCREATORBUG-4531
This commit is contained in:
@@ -43,8 +43,6 @@
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QScrollBar>
|
||||
|
||||
static const int MaxBlockCount = 100000;
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace Core {
|
||||
@@ -58,6 +56,7 @@ OutputWindow::OutputWindow(Core::Context context, QWidget *parent)
|
||||
, m_scrollToBottom(false)
|
||||
, m_linksActive(true)
|
||||
, m_mousePressed(false)
|
||||
, m_maxLineCount(100000)
|
||||
{
|
||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||
//setCenterOnScroll(false);
|
||||
@@ -203,11 +202,17 @@ QString OutputWindow::doNewlineEnfocement(const QString &out)
|
||||
return s;
|
||||
}
|
||||
|
||||
void OutputWindow::setMaxLineCount(int count)
|
||||
{
|
||||
m_maxLineCount = count;
|
||||
setMaximumBlockCount(m_maxLineCount);
|
||||
}
|
||||
|
||||
void OutputWindow::appendMessage(const QString &output, OutputFormat format)
|
||||
{
|
||||
QString out = output;
|
||||
out.remove(QLatin1Char('\r'));
|
||||
setMaximumBlockCount(MaxBlockCount);
|
||||
setMaximumBlockCount(m_maxLineCount);
|
||||
const bool atBottom = isScrollbarAtBottom();
|
||||
|
||||
if (format == ErrorMessageFormat || format == NormalMessageFormat) {
|
||||
@@ -254,11 +259,11 @@ void OutputWindow::appendMessage(const QString &output, OutputFormat format)
|
||||
}
|
||||
|
||||
// TODO rename
|
||||
void OutputWindow::appendText(const QString &textIn, const QTextCharFormat &format, int maxLineCount)
|
||||
void OutputWindow::appendText(const QString &textIn, const QTextCharFormat &format)
|
||||
{
|
||||
QString text = textIn;
|
||||
text.remove(QLatin1Char('\r'));
|
||||
if (maxLineCount > 0 && document()->blockCount() > maxLineCount)
|
||||
if (m_maxLineCount > 0 && document()->blockCount() > m_maxLineCount)
|
||||
return;
|
||||
const bool atBottom = isScrollbarAtBottom();
|
||||
QTextCursor cursor = QTextCursor(document());
|
||||
@@ -266,7 +271,7 @@ void OutputWindow::appendText(const QString &textIn, const QTextCharFormat &form
|
||||
cursor.beginEditBlock();
|
||||
cursor.insertText(doNewlineEnfocement(text), format);
|
||||
|
||||
if (maxLineCount > 0 && document()->blockCount() > maxLineCount) {
|
||||
if (m_maxLineCount > 0 && document()->blockCount() > m_maxLineCount) {
|
||||
QTextCharFormat tmp;
|
||||
tmp.setFontWeight(QFont::Bold);
|
||||
cursor.insertText(tr("Additional output omitted\n"), tmp);
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
|
||||
void appendMessage(const QString &out, Utils::OutputFormat format);
|
||||
/// appends a \p text using \p format without using formater
|
||||
void appendText(const QString &text, const QTextCharFormat &format = QTextCharFormat(), int maxLineCount = -1);
|
||||
void appendText(const QString &text, const QTextCharFormat &format = QTextCharFormat());
|
||||
|
||||
void grayOutOldContent();
|
||||
void clear();
|
||||
@@ -66,6 +66,9 @@ public:
|
||||
|
||||
void scrollToBottom();
|
||||
|
||||
void setMaxLineCount(int count);
|
||||
int maxLineCount() const { return m_maxLineCount; }
|
||||
|
||||
public slots:
|
||||
void setWordWrapEnabled(bool wrap);
|
||||
|
||||
@@ -89,6 +92,7 @@ private:
|
||||
bool m_scrollToBottom;
|
||||
bool m_linksActive;
|
||||
bool m_mousePressed;
|
||||
int m_maxLineCount;
|
||||
};
|
||||
|
||||
} // namespace Core
|
||||
|
||||
@@ -116,7 +116,7 @@ AppOutputPane::AppOutputPane() :
|
||||
connect(ProjectExplorerPlugin::instance()->session(), SIGNAL(aboutToUnloadSession()),
|
||||
this, SLOT(aboutToUnloadSession()));
|
||||
connect(ProjectExplorerPlugin::instance(), SIGNAL(settingsChanged()),
|
||||
this, SLOT(updateWordWrapMode()));
|
||||
this, SLOT(updateFromSettings()));
|
||||
}
|
||||
|
||||
AppOutputPane::~AppOutputPane()
|
||||
@@ -264,6 +264,7 @@ void AppOutputPane::createNewOutputWindow(RunControl *rc)
|
||||
ow->setWindowIcon(QIcon(QLatin1String(Qt4ProjectManager::Constants::ICON_WINDOW)));
|
||||
ow->setFormatter(formatter);
|
||||
ow->setWordWrapEnabled(ProjectExplorerPlugin::instance()->projectExplorerSettings().wrapAppOutput);
|
||||
ow->setMaxLineCount(ProjectExplorerPlugin::instance()->projectExplorerSettings().maxAppOutputLines);
|
||||
Aggregation::Aggregate *agg = new Aggregation::Aggregate;
|
||||
agg->add(ow);
|
||||
agg->add(new Find::BaseTextFind(ow));
|
||||
@@ -281,12 +282,13 @@ void AppOutputPane::handleOldOutput(Core::OutputWindow *window) const
|
||||
window->grayOutOldContent();
|
||||
}
|
||||
|
||||
void AppOutputPane::updateWordWrapMode()
|
||||
void AppOutputPane::updateFromSettings()
|
||||
{
|
||||
const int size = m_runControlTabs.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
RunControlTab &tab =m_runControlTabs[i];
|
||||
tab.window->setWordWrapEnabled(ProjectExplorerPlugin::instance()->projectExplorerSettings().wrapAppOutput);
|
||||
tab.window->setMaxLineCount(ProjectExplorerPlugin::instance()->projectExplorerSettings().maxAppOutputLines);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ private slots:
|
||||
void runControlFinished();
|
||||
|
||||
void aboutToUnloadSession();
|
||||
void updateWordWrapMode();
|
||||
void updateFromSettings();
|
||||
|
||||
private:
|
||||
struct RunControlTab {
|
||||
|
||||
@@ -68,6 +68,7 @@ CompileOutputWindow::CompileOutputWindow(BuildManager * /*bm*/)
|
||||
m_outputWindow->setWindowIcon(QIcon(QLatin1String(Qt4ProjectManager::Constants::ICON_WINDOW)));
|
||||
m_outputWindow->setReadOnly(true);
|
||||
m_outputWindow->setUndoRedoEnabled(false);
|
||||
m_outputWindow->setMaxLineCount(MAX_LINECOUNT);
|
||||
|
||||
Aggregation::Aggregate *agg = new Aggregation::Aggregate;
|
||||
agg->add(m_outputWindow);
|
||||
@@ -142,7 +143,7 @@ void CompileOutputWindow::appendText(const QString &text, ProjectExplorer::Build
|
||||
|
||||
}
|
||||
|
||||
m_outputWindow->appendText(text, textFormat, MAX_LINECOUNT);
|
||||
m_outputWindow->appendText(text, textFormat);
|
||||
}
|
||||
|
||||
void CompileOutputWindow::clearContents()
|
||||
|
||||
@@ -899,6 +899,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
||||
d->m_projectExplorerSettings.useJom = s->value("ProjectExplorer/Settings/UseJom", true).toBool();
|
||||
d->m_projectExplorerSettings.autorestoreLastSession = s->value("ProjectExplorer/Settings/AutoRestoreLastSession", false).toBool();
|
||||
d->m_projectExplorerSettings.prompToStopRunControl = s->value("ProjectExplorer/Settings/PromptToStopRunControl", false).toBool();
|
||||
d->m_projectExplorerSettings.maxAppOutputLines = s->value("ProjectExplorer/Settings/MaxAppOutputLines", 100000).toInt();
|
||||
d->m_projectExplorerSettings.environmentId = QUuid(s->value("ProjectExplorer/Settings/EnvironmentId").toString());
|
||||
if (d->m_projectExplorerSettings.environmentId.isNull())
|
||||
d->m_projectExplorerSettings.environmentId = QUuid::createUuid();
|
||||
@@ -1190,6 +1191,7 @@ void ProjectExplorerPlugin::savePersistentSettings()
|
||||
s->setValue("ProjectExplorer/Settings/UseJom", d->m_projectExplorerSettings.useJom);
|
||||
s->setValue("ProjectExplorer/Settings/AutoRestoreLastSession", d->m_projectExplorerSettings.autorestoreLastSession);
|
||||
s->setValue("ProjectExplorer/Settings/PromptToStopRunControl", d->m_projectExplorerSettings.prompToStopRunControl);
|
||||
s->setValue("ProjectExplorer/Settings/MaxAppOutputLines", d->m_projectExplorerSettings.maxAppOutputLines);
|
||||
s->setValue("ProjectExplorer/Settings/EnvironmentId", d->m_projectExplorerSettings.environmentId.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,8 @@ struct ProjectExplorerSettings
|
||||
saveBeforeBuild(false), showCompilerOutput(false),
|
||||
showRunOutput(true), cleanOldAppOutput(false),
|
||||
wrapAppOutput(true), useJom(true),
|
||||
autorestoreLastSession(false), prompToStopRunControl(false)
|
||||
autorestoreLastSession(false), prompToStopRunControl(false),
|
||||
maxAppOutputLines(100000)
|
||||
{ }
|
||||
|
||||
bool buildBeforeDeploy;
|
||||
@@ -58,6 +59,7 @@ struct ProjectExplorerSettings
|
||||
bool useJom;
|
||||
bool autorestoreLastSession; // This option is set in the Session Manager!
|
||||
bool prompToStopRunControl;
|
||||
int maxAppOutputLines;
|
||||
|
||||
// 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
|
||||
@@ -76,7 +78,8 @@ inline bool operator==(const ProjectExplorerSettings &p1, const ProjectExplorerS
|
||||
&& p1.wrapAppOutput == p2.wrapAppOutput
|
||||
&& p1.useJom == p2.useJom
|
||||
&& p1.autorestoreLastSession == p2.autorestoreLastSession
|
||||
&& p1.prompToStopRunControl == p2.prompToStopRunControl;
|
||||
&& p1.prompToStopRunControl == p2.prompToStopRunControl
|
||||
&& p1.maxAppOutputLines == p2.maxAppOutputLines;
|
||||
}
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
@@ -77,6 +77,7 @@ ProjectExplorerSettings ProjectExplorerSettingsWidget::settings() const
|
||||
pes.wrapAppOutput = m_ui.wrapAppOutputCheckBox->isChecked();
|
||||
pes.useJom = m_ui.jomCheckbox->isChecked();
|
||||
pes.prompToStopRunControl = m_ui.promptToStopRunControlCheckBox->isChecked();
|
||||
pes.maxAppOutputLines = m_ui.maxAppOutputBox->value();
|
||||
return pes;
|
||||
}
|
||||
|
||||
@@ -91,6 +92,7 @@ void ProjectExplorerSettingsWidget::setSettings(const ProjectExplorerSettings &
|
||||
m_ui.wrapAppOutputCheckBox->setChecked(pes.wrapAppOutput);
|
||||
m_ui.jomCheckbox->setChecked(pes.useJom);
|
||||
m_ui.promptToStopRunControlCheckBox->setChecked(pes.prompToStopRunControl);
|
||||
m_ui.maxAppOutputBox->setValue(pes.maxAppOutputLines);
|
||||
}
|
||||
|
||||
QString ProjectExplorerSettingsWidget::projectsDirectory() const
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>313</width>
|
||||
<width>447</width>
|
||||
<height>491</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -21,7 +21,7 @@
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="1" column="1">
|
||||
<widget class="Utils::PathChooser" name="projectsDirectoryPathChooser" native="true"/>
|
||||
<widget class="Utils::PathChooser" name="projectsDirectoryPathChooser"/>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QRadioButton" name="currentDirectoryRadioButton">
|
||||
@@ -29,7 +29,7 @@
|
||||
<string>Current directory</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string>directoryButtonGroup</string>
|
||||
<string notr="true">directoryButtonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -42,7 +42,7 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string>directoryButtonGroup</string>
|
||||
<string notr="true">directoryButtonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -104,6 +104,58 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Limit application output to </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="maxAppOutputBox">
|
||||
<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="label_2">
|
||||
<property name="text">
|
||||
<string>lines</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="promptToStopRunControlCheckBox">
|
||||
<property name="toolTip">
|
||||
|
||||
Reference in New Issue
Block a user