summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Maudsley <richard.maudsley@isode.com>2014-02-20 16:08:28 (GMT)
committerSwift Review <review@swift.im>2014-02-22 16:05:34 (GMT)
commitbe45135a1b1051eab02003fe54ee7e87f5f1558e (patch)
tree773e8f4aa2eb16a48d55d94d294e18e4679a5661
parentcef2e5062022907dcf70ca23fbd345fdf545dbb9 (diff)
downloadswift-contrib-be45135a1b1051eab02003fe54ee7e87f5f1558e.zip
swift-contrib-be45135a1b1051eab02003fe54ee7e87f5f1558e.tar.bz2
Added timestamps to debug log.
Change-Id: I2024ebf4d97be8683cf563d9c151f97319bba880
-rw-r--r--Swift/QtUI/QtXMLConsoleWidget.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/Swift/QtUI/QtXMLConsoleWidget.cpp b/Swift/QtUI/QtXMLConsoleWidget.cpp
index 284f3c3..609c6a2 100644
--- a/Swift/QtUI/QtXMLConsoleWidget.cpp
+++ b/Swift/QtUI/QtXMLConsoleWidget.cpp
@@ -1,17 +1,19 @@
/*
* Copyright (c) 2010-2013 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#include "QtXMLConsoleWidget.h"
+#include <Swiften/Base/format.h>
+
#include <QCloseEvent>
#include <QTextEdit>
#include <QVBoxLayout>
#include <QPushButton>
#include <QScrollBar>
#include <QCheckBox>
#include "QtSwiftUtil.h"
#include <string>
@@ -69,23 +71,27 @@ 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" + safeByteArrayToString(data) + "\n", QColor(33,98,33));
+ boost::posix_time::ptime now = boost::posix_time::second_clock::local_time();
+ std::string tag = str(format(std::string(QT_TRANSLATE_NOOP("", "<!-- IN %1% -->"))) % std::string(boost::posix_time::to_iso_extended_string(now)));
+ appendTextIfEnabled(tag + "\n" + safeByteArrayToString(data) + "\n", QColor(33,98,33));
}
void QtXMLConsoleWidget::handleDataWritten(const SafeByteArray& data) {
- appendTextIfEnabled(std::string(tr("<!-- OUT -->").toUtf8()) + "\n" + safeByteArrayToString(data) + "\n", QColor(155,1,0));
+ boost::posix_time::ptime now = boost::posix_time::second_clock::local_time();
+ std::string tag = str(format(std::string(QT_TRANSLATE_NOOP("", "<!-- OUT %1% -->"))) % std::string(boost::posix_time::to_iso_extended_string(now)));
+ appendTextIfEnabled(tag + "\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();