diff options
author | Tobias Markmann <tm@ayena.de> | 2016-03-31 14:57:35 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2016-03-31 14:57:35 (GMT) |
commit | cfbdb43d2cadd40aa87338d41548e4bf89e146e6 (patch) | |
tree | 18d94153a302445196fc0c18586abf44a1ce4a38 /Swift/QtUI/QtXMLConsoleWidget.cpp | |
parent | 1d545a4a7fb877f021508094b88c1f17b30d8b4e (diff) | |
download | swift-cfbdb43d2cadd40aa87338d41548e4bf89e146e6.zip swift-cfbdb43d2cadd40aa87338d41548e4bf89e146e6.tar.bz2 |
Convert tabs to 4 spaces for all source files
Removed trailing spaces and whitespace on empty lines
in the process.
Changed CheckTabs.py tool to disallow hard tabs in source
files.
Test-Information:
Manually checked 30 random files that the conversion worked
as expected.
Change-Id: I874f99d617bd3d2bb55f02d58f22f58f9b094480
Diffstat (limited to 'Swift/QtUI/QtXMLConsoleWidget.cpp')
-rw-r--r-- | Swift/QtUI/QtXMLConsoleWidget.cpp | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/Swift/QtUI/QtXMLConsoleWidget.cpp b/Swift/QtUI/QtXMLConsoleWidget.cpp index 1fbad8f..a7f9702 100644 --- a/Swift/QtUI/QtXMLConsoleWidget.cpp +++ b/Swift/QtUI/QtXMLConsoleWidget.cpp @@ -22,99 +22,99 @@ namespace Swift { QtXMLConsoleWidget::QtXMLConsoleWidget() { - setWindowTitle(tr("Console")); + setWindowTitle(tr("Console")); - QVBoxLayout* layout = new QVBoxLayout(this); - layout->setSpacing(0); - layout->setContentsMargins(0,0,0,0); + QVBoxLayout* layout = new QVBoxLayout(this); + layout->setSpacing(0); + layout->setContentsMargins(0,0,0,0); - textEdit = new QTextEdit(this); - textEdit->setReadOnly(true); - layout->addWidget(textEdit); + textEdit = new QTextEdit(this); + textEdit->setReadOnly(true); + layout->addWidget(textEdit); - QWidget* bottom = new QWidget(this); - layout->addWidget(bottom); - bottom->setAutoFillBackground(true); + QWidget* bottom = new QWidget(this); + layout->addWidget(bottom); + bottom->setAutoFillBackground(true); - QHBoxLayout* buttonLayout = new QHBoxLayout(bottom); - buttonLayout->setContentsMargins(10,0,20,0); - buttonLayout->setSpacing(0); + QHBoxLayout* buttonLayout = new QHBoxLayout(bottom); + buttonLayout->setContentsMargins(10,0,20,0); + buttonLayout->setSpacing(0); - enabled = new QCheckBox(tr("Trace input/output"), bottom); - enabled->setChecked(true); - buttonLayout->addWidget(enabled); + enabled = new QCheckBox(tr("Trace input/output"), bottom); + enabled->setChecked(true); + buttonLayout->addWidget(enabled); - buttonLayout->addStretch(); + buttonLayout->addStretch(); - QPushButton* clearButton = new QPushButton(tr("Clear"), bottom); - connect(clearButton, SIGNAL(clicked()), textEdit, SLOT(clear())); - buttonLayout->addWidget(clearButton); + QPushButton* clearButton = new QPushButton(tr("Clear"), bottom); + connect(clearButton, SIGNAL(clicked()), textEdit, SLOT(clear())); + buttonLayout->addWidget(clearButton); - setWindowTitle(tr("Debug Console")); - emit titleUpdated(); + setWindowTitle(tr("Debug Console")); + emit titleUpdated(); } QtXMLConsoleWidget::~QtXMLConsoleWidget() { } void QtXMLConsoleWidget::showEvent(QShowEvent* event) { - emit windowOpening(); - emit titleUpdated(); /* This just needs to be somewhere after construction */ - QWidget::showEvent(event); + emit windowOpening(); + emit titleUpdated(); /* This just needs to be somewhere after construction */ + QWidget::showEvent(event); } void QtXMLConsoleWidget::show() { - QWidget::show(); - emit windowOpening(); + QWidget::show(); + emit windowOpening(); } void QtXMLConsoleWidget::activate() { - emit wantsToActivate(); + emit wantsToActivate(); } void QtXMLConsoleWidget::closeEvent(QCloseEvent* event) { - emit windowClosing(); - event->accept(); + emit windowClosing(); + event->accept(); } void QtXMLConsoleWidget::handleDataRead(const SafeByteArray& data) { - boost::posix_time::ptime now = boost::posix_time::second_clock::local_time(); - std::string tag = Q2PSTRING(tr("<!-- IN %1 -->").arg(P2QSTRING(boost::posix_time::to_iso_extended_string(now)))); - appendTextIfEnabled(tag + "\n" + safeByteArrayToString(data) + "\n", QColor(33,98,33)); + boost::posix_time::ptime now = boost::posix_time::second_clock::local_time(); + std::string tag = Q2PSTRING(tr("<!-- IN %1 -->").arg(P2QSTRING(boost::posix_time::to_iso_extended_string(now)))); + appendTextIfEnabled(tag + "\n" + safeByteArrayToString(data) + "\n", QColor(33,98,33)); } void QtXMLConsoleWidget::handleDataWritten(const SafeByteArray& data) { - boost::posix_time::ptime now = boost::posix_time::second_clock::local_time(); - std::string tag = Q2PSTRING(tr("<!-- OUT %1 -->").arg(P2QSTRING(boost::posix_time::to_iso_extended_string(now)))); - appendTextIfEnabled(tag + "\n" + safeByteArrayToString(data) + "\n", QColor(155,1,0)); + boost::posix_time::ptime now = boost::posix_time::second_clock::local_time(); + std::string tag = Q2PSTRING(tr("<!-- OUT %1 -->").arg(P2QSTRING(boost::posix_time::to_iso_extended_string(now)))); + appendTextIfEnabled(tag + "\n" + safeByteArrayToString(data) + "\n", QColor(155,1,0)); } std::string QtXMLConsoleWidget::getID() const { - return "QtXMLConsoleWidget"; + return "QtXMLConsoleWidget"; } 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(); - cursor.movePosition(QTextCursor::End); - QTextCharFormat format; - format.setForeground(QBrush(color)); - cursor.mergeCharFormat(format); - cursor.insertText(P2QSTRING(data)); - cursor.endEditBlock(); - - // Checking for the scrollbar again, because it could have appeared after inserting text. - // In practice, I suspect that the scrollbar is always there, but hidden, but since we were - // explicitly testing for this already above, I'm leaving the code in. - scrollBar = textEdit->verticalScrollBar(); - if (scrollToBottom && scrollBar) { - scrollBar->setValue(scrollBar->maximum()); - } - } + if (enabled->isChecked()) { + QScrollBar* scrollBar = textEdit->verticalScrollBar(); + bool scrollToBottom = (!scrollBar || scrollBar->value() == scrollBar->maximum()); + + QTextCursor cursor(textEdit->document()); + cursor.beginEditBlock(); + cursor.movePosition(QTextCursor::End); + QTextCharFormat format; + format.setForeground(QBrush(color)); + cursor.mergeCharFormat(format); + cursor.insertText(P2QSTRING(data)); + cursor.endEditBlock(); + + // Checking for the scrollbar again, because it could have appeared after inserting text. + // In practice, I suspect that the scrollbar is always there, but hidden, but since we were + // explicitly testing for this already above, I'm leaving the code in. + scrollBar = textEdit->verticalScrollBar(); + if (scrollToBottom && scrollBar) { + scrollBar->setValue(scrollBar->maximum()); + } + } } } |