summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/QtXMLConsoleWidget.cpp8
-rw-r--r--Swift/QtUI/QtXMLConsoleWidget.h3
2 files changed, 2 insertions, 9 deletions
diff --git a/Swift/QtUI/QtXMLConsoleWidget.cpp b/Swift/QtUI/QtXMLConsoleWidget.cpp
index 0c88ce6..e674df8 100644
--- a/Swift/QtUI/QtXMLConsoleWidget.cpp
+++ b/Swift/QtUI/QtXMLConsoleWidget.cpp
@@ -1,19 +1,17 @@
/*
* Copyright (c) 2010 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#include "QtXMLConsoleWidget.h"
-#include <Swiften/Client/XMLBeautifier.h>
-
#include <QCloseEvent>
#include <QTextEdit>
#include <QVBoxLayout>
#include <QPushButton>
#include <QScrollBar>
#include <QCheckBox>
#include "QtSwiftUtil.h"
#include <string>
@@ -45,23 +43,21 @@ QtXMLConsoleWidget::QtXMLConsoleWidget() {
buttonLayout->addStretch();
QPushButton* clearButton = new QPushButton(tr("Clear"), bottom);
connect(clearButton, SIGNAL(clicked()), textEdit, SLOT(clear()));
buttonLayout->addWidget(clearButton);
setWindowTitle(tr("Debug Console"));
emit titleUpdated();
- beautifier = new XMLBeautifier(true, false);
}
QtXMLConsoleWidget::~QtXMLConsoleWidget() {
- delete beautifier;
}
void QtXMLConsoleWidget::showEvent(QShowEvent* event) {
emit windowOpening();
emit titleUpdated(); /* This just needs to be somewhere after construction */
QWidget::showEvent(event);
}
void QtXMLConsoleWidget::show() {
@@ -73,23 +69,23 @@ void QtXMLConsoleWidget::activate() {
emit wantsToActivate();
}
void QtXMLConsoleWidget::closeEvent(QCloseEvent* event) {
emit windowClosing();
event->accept();
}
void QtXMLConsoleWidget::handleDataRead(const SafeByteArray& data) {
- appendTextIfEnabled(std::string(tr("<!-- IN -->").toUtf8()) + "\n" + beautifier->beautify(safeByteArrayToString(data)) + "\n", QColor(33,98,33));
+ appendTextIfEnabled(std::string(tr("<!-- IN -->").toUtf8()) + "\n" + safeByteArrayToString(data) + "\n", QColor(33,98,33));
}
void QtXMLConsoleWidget::handleDataWritten(const SafeByteArray& data) {
- appendTextIfEnabled(std::string(tr("<!-- OUT -->").toUtf8()) + "\n" + beautifier->beautify(safeByteArrayToString(data)) + "\n", QColor(155,1,0));
+ appendTextIfEnabled(std::string(tr("<!-- OUT -->").toUtf8()) + "\n" + safeByteArrayToString(data) + "\n", QColor(155,1,0));
}
void QtXMLConsoleWidget::appendTextIfEnabled(const std::string& data, const QColor& color) {
if (enabled->isChecked()) {
QScrollBar* scrollBar = textEdit->verticalScrollBar();
bool scrollToBottom = (!scrollBar || scrollBar->value() == scrollBar->maximum());
QTextCursor cursor(textEdit->document());
cursor.beginEditBlock();
diff --git a/Swift/QtUI/QtXMLConsoleWidget.h b/Swift/QtUI/QtXMLConsoleWidget.h
index c22251f..912ad90 100644
--- a/Swift/QtUI/QtXMLConsoleWidget.h
+++ b/Swift/QtUI/QtXMLConsoleWidget.h
@@ -8,20 +8,18 @@
#include "Swift/Controllers/UIInterfaces/XMLConsoleWidget.h"
#include "QtTabbable.h"
class QTextEdit;
class QCheckBox;
class QColor;
namespace Swift {
- class XMLBeautifier;
-
class QtXMLConsoleWidget : public QtTabbable, public XMLConsoleWidget {
Q_OBJECT
public:
QtXMLConsoleWidget();
~QtXMLConsoleWidget();
void show();
void activate();
@@ -32,12 +30,11 @@ namespace Swift {
private:
virtual void closeEvent(QCloseEvent* event);
virtual void showEvent(QShowEvent* event);
void appendTextIfEnabled(const std::string& data, const QColor& color);
private:
QTextEdit* textEdit;
QCheckBox* enabled;
- XMLBeautifier* beautifier;
};
}