summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/QtBarriersFreeChatView.cpp')
-rw-r--r--Swift/QtUI/QtBarriersFreeChatView.cpp128
1 files changed, 128 insertions, 0 deletions
diff --git a/Swift/QtUI/QtBarriersFreeChatView.cpp b/Swift/QtUI/QtBarriersFreeChatView.cpp
new file mode 100644
index 0000000..eef58ad
--- /dev/null
+++ b/Swift/QtUI/QtBarriersFreeChatView.cpp
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2012 Thilo Cestonaro
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+#include "QtBarriersFreeChatView.h"
+#include "QtSwiftUtil.h"
+
+#include <Swiften/Base/Log.h>
+#include <Swift/Controllers/UIEvents/UIEventStream.h>
+#include <QDateTime>
+#include <QDebug>
+
+namespace Swift {
+ QtBarriersFreeChatView::QtBarriersFreeChatView(QtChatTheme*, QWidget* parent, UIEventStream* eventStream, SettingsProvider* settings, QMap<QString, QString> emoticons) : QtChatView(parent), eventStream_(eventStream), settings_(settings), emoticons_(emoticons) {
+
+ QVBoxLayout* mainLayout = new QVBoxLayout(this);
+ mainLayout->setSpacing(0);
+ mainLayout->setContentsMargins(0,0,0,0);
+ textEdit_ = new QTextEdit();
+ textEdit_->setReadOnly(true);
+
+ mainLayout->addWidget(textEdit_);
+
+ idCounter_ = 0;
+ }
+
+ QtBarriersFreeChatView::~QtBarriersFreeChatView() {
+
+ }
+
+ void QtBarriersFreeChatView::replaceLastMessage(const QString& newMessage) {
+
+ }
+
+ void QtBarriersFreeChatView::setFileTransferStatus(QString id, const ChatWindow::FileTransferState state, const QString& msg) {
+
+ }
+
+ void QtBarriersFreeChatView::setFileTransferProgress(QString id, const int percentageDone) {
+
+ }
+
+ void QtBarriersFreeChatView::addToJSEnvironment(const QString&, QObject*) {
+
+ }
+
+ void QtBarriersFreeChatView::setAckState(std::string const& id, ChatWindow::AckState) {
+
+ }
+
+ void QtBarriersFreeChatView::setMessageReceiptState(const std::string& id, ChatWindow::ReceiptState state) {
+
+ }
+
+ std::string QtBarriersFreeChatView::addMessage(const std::string &message, const std::string &senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const QString& style, const boost::posix_time::ptime& time) {
+ SWIFT_LOG(debug) << "[QtBarriersFreeChatView::addMessage] - entered" << std::endl;
+ std::string id = "id" + boost::lexical_cast<std::string>(idCounter_++);
+ textEdit_->append("[" + B2QDATE(time).toString("hh:mm:ss") + "] <" + Qt::escape(P2QSTRING(senderName)) + "> " + Qt::escape(P2QSTRING(message)));
+ SWIFT_LOG(debug) << "[QtBarriersFreeChatView::addMessage] - return: " << id << std::endl;
+ return id;
+ }
+
+ void QtBarriersFreeChatView::setChatWindowHasFocus(bool focus) {
+
+ }
+
+ std::string QtBarriersFreeChatView::addAction(const std::string &message, const std::string &senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) {
+ return "";
+ }
+
+ std::string QtBarriersFreeChatView::addFileTransfer(const std::string& senderName, bool senderIsSelf, const std::string& filename, const boost::uintmax_t sizeInBytes) {
+ return "";
+ }
+
+ void QtBarriersFreeChatView::addErrorMessage(const std::string& errorMessage) {
+
+ }
+
+ void QtBarriersFreeChatView::addSystemMessage(const std::string& message) {
+
+ }
+
+ void QtBarriersFreeChatView::replaceWithAction(const std::string& message, const std::string& id, const boost::posix_time::ptime& time) {
+ replaceMessage(" *" + P2QSTRING(message) + "*", P2QSTRING(id), B2QDATE(time), "font-style:italic ");
+ }
+
+ void QtBarriersFreeChatView::replaceMessage(const QString& newMessage, const QString& id, const QDateTime& time, const QString& style) {
+
+ }
+
+ void QtBarriersFreeChatView::addPresenceMessage(const std::string& message) {
+
+ }
+
+ void QtBarriersFreeChatView::scrollToBottom() {
+ if(textEdit_->isReadOnly()) {
+ QKeyEvent endPressed(QEvent::KeyPress, Qt::Key_End, Qt::NoModifier);
+ handleKeyPressEvent(&endPressed);
+ }
+ else {
+ QKeyEvent endPressed(QEvent::KeyPress, Qt::Key_End, Qt::ControlModifier);
+ handleKeyPressEvent(&endPressed);
+ }
+ }
+
+ void QtBarriersFreeChatView::resizeFont(int fontSizeSteps) {
+ qreal currentSize = textEdit_->fontPointSize();
+ qDebug() << "resizeFont: changing current font point size " << currentSize << " with fontSizeSteps " << fontSizeSteps << " to :" << currentSize + fontSizeSteps;
+ textEdit_->setFontPointSize( currentSize + fontSizeSteps );
+ }
+
+ void QtBarriersFreeChatView::handleKeyPressEvent(QKeyEvent* event) {
+ event->ignore();
+ }
+
+ void QtBarriersFreeChatView::setMUCInvitationJoined(QString id) {
+
+ }
+
+ void QtBarriersFreeChatView::addMUCInvitation(const std::string& senderName, const JID& jid, const std::string& reason, const std::string& password, bool direct) {
+
+ }
+
+ void QtBarriersFreeChatView::showEmoticons(bool) {
+
+ }
+}