summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-03-31 14:57:35 (GMT)
committerTobias Markmann <tm@ayena.de>2016-03-31 14:57:35 (GMT)
commitcfbdb43d2cadd40aa87338d41548e4bf89e146e6 (patch)
tree18d94153a302445196fc0c18586abf44a1ce4a38 /Swift/QtUI/ChatView
parent1d545a4a7fb877f021508094b88c1f17b30d8b4e (diff)
downloadswift-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/ChatView')
-rw-r--r--Swift/QtUI/ChatView/main.cpp260
1 files changed, 130 insertions, 130 deletions
diff --git a/Swift/QtUI/ChatView/main.cpp b/Swift/QtUI/ChatView/main.cpp
index 4bde1ef..aa3255e 100644
--- a/Swift/QtUI/ChatView/main.cpp
+++ b/Swift/QtUI/ChatView/main.cpp
@@ -27,154 +27,154 @@ using namespace Swift;
/*
class MyNetworkReply : public QNetworkReply {
- public:
- MyNetworkReply() {
- }
-
- qint64 readData(char*, qint64) {
- return 0;
- }
-
- virtual void abort() {
- }
+ public:
+ MyNetworkReply() {
+ }
+
+ qint64 readData(char*, qint64) {
+ return 0;
+ }
+
+ virtual void abort() {
+ }
};
class MyNetworkAccessManager : public QNetworkAccessManager {
- public:
- MyNetworkAccessManager() {
- }
-
- QNetworkReply * createRequest (Operation op, const QNetworkRequest& request, QIODevice* outgoingData = 0) {
- assert(op == QNetworkAccessManager::GetOperation);
- qDebug() << "Requesting: " << request.url();
- return QNetworkAccessManager::createRequest(op, request, outgoingData);
- //return new MyNetworkReply();
- }
+ public:
+ MyNetworkAccessManager() {
+ }
+
+ QNetworkReply * createRequest (Operation op, const QNetworkRequest& request, QIODevice* outgoingData = 0) {
+ assert(op == QNetworkAccessManager::GetOperation);
+ qDebug() << "Requesting: " << request.url();
+ return QNetworkAccessManager::createRequest(op, request, outgoingData);
+ //return new MyNetworkReply();
+ }
};
- QVBoxLayout* mainLayout = new QVBoxLayout(this);
- webView_ = new QWebView(this);
-
- QFile file(":/themes/Stockholm/Contents/Resources/Incoming/Content.html");
- file.open(QIODevice::ReadOnly);
- QString content = QString::fromUtf8(file.readAll());
-
- webPage_ = new QWebPage(this);
- webPage_->setNetworkAccessManager(new MyNetworkAccessManager());
- webView_->setPage(webPage_);
- QString pagehtml =
- "<head>"
- //"<base href=\"file:///Users/remko/src/swift/resources/themes/Stockholm/Contents/Resources/\"/>"
- "<base href=\"file:///Users/remko/src/swift/resources/themes/Stockholm/Contents/Resources/\"/>"
- "<link rel=\"stylesheet\" type=\"text/css\" href=\"main.css\"/>"
- "<link rel=\"stylesheet\" type=\"text/css\" href=\"Variants/Alt Blue - Blue.css\"/>"
- "</head><body>" + content + "</body>";
- qDebug() << pagehtml;
- webPage_->mainFrame()->setHtml(pagehtml);
+ QVBoxLayout* mainLayout = new QVBoxLayout(this);
+ webView_ = new QWebView(this);
+
+ QFile file(":/themes/Stockholm/Contents/Resources/Incoming/Content.html");
+ file.open(QIODevice::ReadOnly);
+ QString content = QString::fromUtf8(file.readAll());
+
+ webPage_ = new QWebPage(this);
+ webPage_->setNetworkAccessManager(new MyNetworkAccessManager());
+ webView_->setPage(webPage_);
+ QString pagehtml =
+ "<head>"
+ //"<base href=\"file:///Users/remko/src/swift/resources/themes/Stockholm/Contents/Resources/\"/>"
+ "<base href=\"file:///Users/remko/src/swift/resources/themes/Stockholm/Contents/Resources/\"/>"
+ "<link rel=\"stylesheet\" type=\"text/css\" href=\"main.css\"/>"
+ "<link rel=\"stylesheet\" type=\"text/css\" href=\"Variants/Alt Blue - Blue.css\"/>"
+ "</head><body>" + content + "</body>";
+ qDebug() << pagehtml;
+ webPage_->mainFrame()->setHtml(pagehtml);
*/
/*
class ChatView : public QWidget {
- public:
- ChatView(QWidget* parent) : QWidget(parent) {
- setFocusPolicy(Qt::NoFocus);
-
- QVBoxLayout* mainLayout = new QVBoxLayout(this);
- mainLayout->setSpacing(0);
- mainLayout->setContentsMargins(0,0,0,0);
-
- webView_ = new QWebView(this);
- webView_->setFocusPolicy(Qt::NoFocus);
- mainLayout->addWidget(webView_);
-
- webPage_ = new QWebPage(this);
- webPage_->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
- webView_->setPage(webPage_);
- connect(webPage_, SIGNAL(selectionChanged()), SLOT(copySelectionToClipboard()));
-
- QString pageHTML = "<head></head><body><div id=\"chat\"></div></body>";
- webPage_->mainFrame()->setHtml(pageHTML);
- }
-
- void appendHTML(const QString& html) {
- webPage_->mainFrame()->evaluateJavaScript(
- "newNode = document.createElement(\"div\");"
- "newNode.innerHTML = \"" + html + "\";"
- "chatElement = document.getElementById(\"chat\");"
- "chatElement.appendChild(newNode);");
- webPage_->mainFrame()->setScrollBarValue(Qt::Vertical, webPage_->mainFrame()->scrollBarMaximum(Qt::Vertical));
- }
-
- private:
- QWebView* webView_;
- QWebPage* webPage_;
+ public:
+ ChatView(QWidget* parent) : QWidget(parent) {
+ setFocusPolicy(Qt::NoFocus);
+
+ QVBoxLayout* mainLayout = new QVBoxLayout(this);
+ mainLayout->setSpacing(0);
+ mainLayout->setContentsMargins(0,0,0,0);
+
+ webView_ = new QWebView(this);
+ webView_->setFocusPolicy(Qt::NoFocus);
+ mainLayout->addWidget(webView_);
+
+ webPage_ = new QWebPage(this);
+ webPage_->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
+ webView_->setPage(webPage_);
+ connect(webPage_, SIGNAL(selectionChanged()), SLOT(copySelectionToClipboard()));
+
+ QString pageHTML = "<head></head><body><div id=\"chat\"></div></body>";
+ webPage_->mainFrame()->setHtml(pageHTML);
+ }
+
+ void appendHTML(const QString& html) {
+ webPage_->mainFrame()->evaluateJavaScript(
+ "newNode = document.createElement(\"div\");"
+ "newNode.innerHTML = \"" + html + "\";"
+ "chatElement = document.getElementById(\"chat\");"
+ "chatElement.appendChild(newNode);");
+ webPage_->mainFrame()->setScrollBarValue(Qt::Vertical, webPage_->mainFrame()->scrollBarMaximum(Qt::Vertical));
+ }
+
+ private:
+ QWebView* webView_;
+ QWebPage* webPage_;
};
*/
class MyWidget : public QWidget {
- Q_OBJECT
-
- public:
- MyWidget() : previousWasIncoming_(false), previousWasOutgoing_(false), previousWasSystem_(false) {
- QVBoxLayout* mainLayout = new QVBoxLayout(this);
- chatView_ = new QtChatView(this);
- mainLayout->addWidget(chatView_);
- input1_ = new QLineEdit(this);
- connect(input1_, SIGNAL(returnPressed()), SLOT(addIncoming()));
- mainLayout->addWidget(input1_);
- input2_ = new QLineEdit(this);
- connect(input2_, SIGNAL(returnPressed()), SLOT(addOutgoing()));
- mainLayout->addWidget(input2_);
- input3_ = new QLineEdit(this);
- connect(input3_, SIGNAL(returnPressed()), SLOT(addSystem()));
- mainLayout->addWidget(input3_);
-
- resize(300,200);
- }
-
- public slots:
- void addIncoming() {
- chatView_->addMessage(MessageSnippet(input1_->text(), "Me", QDateTime::currentDateTime(), "qrc:/icons/avatar.png", true, previousWasIncoming_));
- previousWasIncoming_ = true;
- previousWasOutgoing_ = false;
- previousWasSystem_ = false;
- input1_->clear();
- }
-
- void addOutgoing() {
- chatView_->addMessage(MessageSnippet(input2_->text(), "You", QDateTime::currentDateTime(), "qrc:/icons/avatar.png", false, previousWasOutgoing_));
- previousWasIncoming_ = false;
- previousWasOutgoing_ = true;
- previousWasSystem_ = false;
- input2_->clear();
- }
-
- void addSystem() {
- chatView_->addMessage(SystemMessageSnippet(input3_->text(), QDateTime::currentDateTime(), previousWasSystem_));
- previousWasIncoming_ = false;
- previousWasOutgoing_ = false;
- previousWasSystem_ = true;
- input3_->clear();
- }
-
- private:
- bool previousWasIncoming_;
- bool previousWasOutgoing_;
- bool previousWasSystem_;
- QtChatView* chatView_;
- QLineEdit* input1_;
- QLineEdit* input2_;
- QLineEdit* input3_;
+ Q_OBJECT
+
+ public:
+ MyWidget() : previousWasIncoming_(false), previousWasOutgoing_(false), previousWasSystem_(false) {
+ QVBoxLayout* mainLayout = new QVBoxLayout(this);
+ chatView_ = new QtChatView(this);
+ mainLayout->addWidget(chatView_);
+ input1_ = new QLineEdit(this);
+ connect(input1_, SIGNAL(returnPressed()), SLOT(addIncoming()));
+ mainLayout->addWidget(input1_);
+ input2_ = new QLineEdit(this);
+ connect(input2_, SIGNAL(returnPressed()), SLOT(addOutgoing()));
+ mainLayout->addWidget(input2_);
+ input3_ = new QLineEdit(this);
+ connect(input3_, SIGNAL(returnPressed()), SLOT(addSystem()));
+ mainLayout->addWidget(input3_);
+
+ resize(300,200);
+ }
+
+ public slots:
+ void addIncoming() {
+ chatView_->addMessage(MessageSnippet(input1_->text(), "Me", QDateTime::currentDateTime(), "qrc:/icons/avatar.png", true, previousWasIncoming_));
+ previousWasIncoming_ = true;
+ previousWasOutgoing_ = false;
+ previousWasSystem_ = false;
+ input1_->clear();
+ }
+
+ void addOutgoing() {
+ chatView_->addMessage(MessageSnippet(input2_->text(), "You", QDateTime::currentDateTime(), "qrc:/icons/avatar.png", false, previousWasOutgoing_));
+ previousWasIncoming_ = false;
+ previousWasOutgoing_ = true;
+ previousWasSystem_ = false;
+ input2_->clear();
+ }
+
+ void addSystem() {
+ chatView_->addMessage(SystemMessageSnippet(input3_->text(), QDateTime::currentDateTime(), previousWasSystem_));
+ previousWasIncoming_ = false;
+ previousWasOutgoing_ = false;
+ previousWasSystem_ = true;
+ input3_->clear();
+ }
+
+ private:
+ bool previousWasIncoming_;
+ bool previousWasOutgoing_;
+ bool previousWasSystem_;
+ QtChatView* chatView_;
+ QLineEdit* input1_;
+ QLineEdit* input2_;
+ QLineEdit* input3_;
};
-
+
int main(int argc, char* argv[]) {
- QApplication app(argc, argv);
- MyWidget w;
- w.show();
- return app.exec();
+ QApplication app(argc, argv);
+ MyWidget w;
+ w.show();
+ return app.exec();
}
#include "main.moc"