diff options
| author | Manjeet Dahiya <manjeetdahiya@gmail.com> | 2010-12-11 11:42:37 +0000 |
|---|---|---|
| committer | Manjeet Dahiya <manjeetdahiya@gmail.com> | 2010-12-11 11:42:37 +0000 |
| commit | f4968ef3c88349414cc649a4f9e566dacb47b064 (patch) | |
| tree | 1885b204cdb867fcf26a89e4c23730a892dade1c /examples/GuiClient/xmlConsoleDialog.cpp | |
| parent | 97865003f7e8b4983292852d857a2b3d79c90c9b (diff) | |
| download | qxmpp-f4968ef3c88349414cc649a4f9e566dacb47b064.tar.gz | |
eol style
Diffstat (limited to 'examples/GuiClient/xmlConsoleDialog.cpp')
| -rw-r--r-- | examples/GuiClient/xmlConsoleDialog.cpp | 114 |
1 files changed, 57 insertions, 57 deletions
diff --git a/examples/GuiClient/xmlConsoleDialog.cpp b/examples/GuiClient/xmlConsoleDialog.cpp index e915d53b..dd2d4f19 100644 --- a/examples/GuiClient/xmlConsoleDialog.cpp +++ b/examples/GuiClient/xmlConsoleDialog.cpp @@ -1,57 +1,57 @@ -#include "xmlConsoleDialog.h"
-#include "ui_xmlConsoleDialog.h"
-
-#include <QDomDocument>
-#include <QTextStream>
-
-static QString s_colorHexSent("#02aa3f");
-static QString s_colorHexReceived("#aa0000");
-
-xmlConsoleDialog::xmlConsoleDialog(QWidget *parent) :
- QDialog(parent, Qt::Window),
- ui(new Ui::xmlConsoleDialog)
-{
- ui->setupUi(this);
- setWindowTitle("Debugging Console");
-
- ui->label_legend->setText(
- QString("<html><body><p><span style=\"color:%1\">Sent</span><span> | </span><span style=\"color:%2\">Received</span></p></body></html>").arg(s_colorHexSent).arg(s_colorHexReceived));
-}
-
-xmlConsoleDialog::~xmlConsoleDialog()
-{
- delete ui;
-}
-
-void xmlConsoleDialog::message(QXmppLogger::MessageType type, const QString& text)
-{
- if(!ui->checkBox_enable->isChecked())
- return;
-
- QColor color;
- switch(type)
- {
- case QXmppLogger::ReceivedMessage:
- color = QColor(s_colorHexReceived);
- break;
- case QXmppLogger::SentMessage:
- color = QColor(s_colorHexSent);
- break;
- default:
- return;
- }
-
- QDomDocument doc;
-
-// Indent XML string
- bool isXml = doc.setContent(text);
- QString formattedText;
- QTextStream stream(&formattedText);
- doc.save(stream, 2);
-
- ui->textBrowser->setTextColor(color);
- if(isXml)
- ui->textBrowser->append(formattedText);
- else
- ui->textBrowser->append(text);
-}
+#include "xmlConsoleDialog.h" +#include "ui_xmlConsoleDialog.h" + +#include <QDomDocument> +#include <QTextStream> + +static QString s_colorHexSent("#02aa3f"); +static QString s_colorHexReceived("#aa0000"); + +xmlConsoleDialog::xmlConsoleDialog(QWidget *parent) : + QDialog(parent, Qt::Window), + ui(new Ui::xmlConsoleDialog) +{ + ui->setupUi(this); + setWindowTitle("Debugging Console"); + + ui->label_legend->setText( + QString("<html><body><p><span style=\"color:%1\">Sent</span><span> | </span><span style=\"color:%2\">Received</span></p></body></html>").arg(s_colorHexSent).arg(s_colorHexReceived)); +} + +xmlConsoleDialog::~xmlConsoleDialog() +{ + delete ui; +} + +void xmlConsoleDialog::message(QXmppLogger::MessageType type, const QString& text) +{ + if(!ui->checkBox_enable->isChecked()) + return; + + QColor color; + switch(type) + { + case QXmppLogger::ReceivedMessage: + color = QColor(s_colorHexReceived); + break; + case QXmppLogger::SentMessage: + color = QColor(s_colorHexSent); + break; + default: + return; + } + + QDomDocument doc; + +// Indent XML string + bool isXml = doc.setContent(text); + QString formattedText; + QTextStream stream(&formattedText); + doc.save(stream, 2); + + ui->textBrowser->setTextColor(color); + if(isXml) + ui->textBrowser->append(formattedText); + else + ui->textBrowser->append(text); +} |
