forked from qt-creator/qt-creator
Output panes: Do not allocate extra standard formatters
The OutputWindow base class has a functioning default formatter these days. Change-Id: I0a75d0a081cdd2cfdd913388419483df836a53e9 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -40,7 +40,7 @@
|
|||||||
#include <texteditor/texteditorsettings.h>
|
#include <texteditor/texteditorsettings.h>
|
||||||
#include <texteditor/fontsettings.h>
|
#include <texteditor/fontsettings.h>
|
||||||
#include <texteditor/behaviorsettings.h>
|
#include <texteditor/behaviorsettings.h>
|
||||||
#include <utils/outputformatter.h>
|
#include <utils/outputformat.h>
|
||||||
#include <utils/proxyaction.h>
|
#include <utils/proxyaction.h>
|
||||||
#include <utils/theme/theme.h>
|
#include <utils/theme/theme.h>
|
||||||
#include <utils/utilsicons.h>
|
#include <utils/utilsicons.h>
|
||||||
@@ -125,8 +125,7 @@ private:
|
|||||||
|
|
||||||
CompileOutputWindow::CompileOutputWindow(QAction *cancelBuildAction) :
|
CompileOutputWindow::CompileOutputWindow(QAction *cancelBuildAction) :
|
||||||
m_cancelBuildButton(new QToolButton),
|
m_cancelBuildButton(new QToolButton),
|
||||||
m_settingsButton(new QToolButton),
|
m_settingsButton(new QToolButton)
|
||||||
m_formatter(new Utils::OutputFormatter)
|
|
||||||
{
|
{
|
||||||
Core::Context context(C_COMPILE_OUTPUT);
|
Core::Context context(C_COMPILE_OUTPUT);
|
||||||
m_outputWindow = new CompileOutputTextEdit(context);
|
m_outputWindow = new CompileOutputTextEdit(context);
|
||||||
@@ -135,7 +134,6 @@ CompileOutputWindow::CompileOutputWindow(QAction *cancelBuildAction) :
|
|||||||
m_outputWindow->setReadOnly(true);
|
m_outputWindow->setReadOnly(true);
|
||||||
m_outputWindow->setUndoRedoEnabled(false);
|
m_outputWindow->setUndoRedoEnabled(false);
|
||||||
m_outputWindow->setMaxCharCount(Core::Constants::DEFAULT_MAX_CHAR_COUNT);
|
m_outputWindow->setMaxCharCount(Core::Constants::DEFAULT_MAX_CHAR_COUNT);
|
||||||
m_outputWindow->setFormatters({m_formatter});
|
|
||||||
|
|
||||||
// Let selected text be colored as if the text edit was editable,
|
// Let selected text be colored as if the text edit was editable,
|
||||||
// otherwise the highlight for searching is too light
|
// otherwise the highlight for searching is too light
|
||||||
@@ -198,7 +196,6 @@ CompileOutputWindow::~CompileOutputWindow()
|
|||||||
delete m_handler;
|
delete m_handler;
|
||||||
delete m_cancelBuildButton;
|
delete m_cancelBuildButton;
|
||||||
delete m_settingsButton;
|
delete m_settingsButton;
|
||||||
delete m_formatter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompileOutputWindow::updateFromSettings()
|
void CompileOutputWindow::updateFromSettings()
|
||||||
@@ -333,7 +330,7 @@ void CompileOutputWindow::showPositionOf(const Task &task)
|
|||||||
|
|
||||||
void CompileOutputWindow::flush()
|
void CompileOutputWindow::flush()
|
||||||
{
|
{
|
||||||
m_formatter->flush();
|
m_outputWindow->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompileOutputWindow::setSettings(const CompileOutputSettings &settings)
|
void CompileOutputWindow::setSettings(const CompileOutputSettings &settings)
|
||||||
|
|||||||
@@ -34,20 +34,13 @@
|
|||||||
#include <QPair>
|
#include <QPair>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QPlainTextEdit;
|
|
||||||
class QTextCharFormat;
|
|
||||||
class QToolButton;
|
class QToolButton;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Utils { class OutputFormatter; }
|
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
class BuildManager;
|
|
||||||
class Task;
|
class Task;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class ShowOutputTaskHandler;
|
class ShowOutputTaskHandler;
|
||||||
class CompileOutputTextEdit;
|
class CompileOutputTextEdit;
|
||||||
|
|
||||||
@@ -98,7 +91,6 @@ private:
|
|||||||
ShowOutputTaskHandler *m_handler;
|
ShowOutputTaskHandler *m_handler;
|
||||||
QToolButton *m_cancelBuildButton;
|
QToolButton *m_cancelBuildButton;
|
||||||
QToolButton * const m_settingsButton;
|
QToolButton * const m_settingsButton;
|
||||||
Utils::OutputFormatter *m_formatter;
|
|
||||||
CompileOutputSettings m_settings;
|
CompileOutputSettings m_settings;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -135,11 +135,6 @@ bool SerialControl::canReUseOutputPane(const SerialControl *other) const
|
|||||||
return other->portName() == portName();
|
return other->portName() == portName();
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::OutputFormatter *SerialControl::outputFormatter()
|
|
||||||
{
|
|
||||||
return new Utils::OutputFormatter(); // TODO: custom formatter?
|
|
||||||
}
|
|
||||||
|
|
||||||
void SerialControl::appendMessage(const QString &msg, Utils::OutputFormat format)
|
void SerialControl::appendMessage(const QString &msg, Utils::OutputFormat format)
|
||||||
{
|
{
|
||||||
emit appendMessageRequested(this, msg, format);
|
emit appendMessageRequested(this, msg, format);
|
||||||
|
|||||||
@@ -59,8 +59,6 @@ public:
|
|||||||
|
|
||||||
bool canReUseOutputPane(const SerialControl *other) const;
|
bool canReUseOutputPane(const SerialControl *other) const;
|
||||||
|
|
||||||
Utils::OutputFormatter *outputFormatter();
|
|
||||||
|
|
||||||
void appendMessage(const QString &msg, Utils::OutputFormat format);
|
void appendMessage(const QString &msg, Utils::OutputFormat format);
|
||||||
|
|
||||||
QString portName() const;
|
QString portName() const;
|
||||||
|
|||||||
@@ -291,7 +291,9 @@ void SerialOutputPane::createNewOutputWindow(SerialControl *rc)
|
|||||||
|
|
||||||
connect(rc, &SerialControl::finished,
|
connect(rc, &SerialControl::finished,
|
||||||
[this, rc]() {
|
[this, rc]() {
|
||||||
rc->outputFormatter()->flush();
|
const int tabIndex = indexOf(rc);
|
||||||
|
if (tabIndex != -1)
|
||||||
|
m_serialControlTabs[tabIndex].window->flush();
|
||||||
if (isCurrent(rc))
|
if (isCurrent(rc))
|
||||||
enableButtons(rc, false);
|
enableButtons(rc, false);
|
||||||
});
|
});
|
||||||
@@ -299,8 +301,6 @@ void SerialOutputPane::createNewOutputWindow(SerialControl *rc)
|
|||||||
connect(rc, &SerialControl::appendMessageRequested,
|
connect(rc, &SerialControl::appendMessageRequested,
|
||||||
this, &SerialOutputPane::appendMessage);
|
this, &SerialOutputPane::appendMessage);
|
||||||
|
|
||||||
Utils::OutputFormatter *formatter = rc->outputFormatter();
|
|
||||||
|
|
||||||
// Create new
|
// Create new
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
Core::Id contextId = Core::Id(Constants::C_SERIAL_OUTPUT).withSuffix(counter++);
|
Core::Id contextId = Core::Id(Constants::C_SERIAL_OUTPUT).withSuffix(counter++);
|
||||||
@@ -315,7 +315,6 @@ void SerialOutputPane::createNewOutputWindow(SerialControl *rc)
|
|||||||
this, fontSettingsChanged);
|
this, fontSettingsChanged);
|
||||||
fontSettingsChanged();
|
fontSettingsChanged();
|
||||||
ow->setWindowTitle(tr("Serial Terminal Window"));
|
ow->setWindowTitle(tr("Serial Terminal Window"));
|
||||||
ow->setFormatters({formatter});
|
|
||||||
// TODO: wordwrap, maxLineCount, zoom/wheelZoom (add to settings)
|
// TODO: wordwrap, maxLineCount, zoom/wheelZoom (add to settings)
|
||||||
|
|
||||||
auto controlTab = SerialControlTab(rc, ow);
|
auto controlTab = SerialControlTab(rc, ow);
|
||||||
|
|||||||
Reference in New Issue
Block a user