summaryrefslogtreecommitdiffstats
blob: c5b3fdc5b1cddacdb5c54f0e829908bf59dd2d6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
 * Copyright (c) 2012 Thilo Cestonaro
 * Licensed under the simplified BSD license.
 * See Documentation/Licenses/BSD-simplified.txt for more information.
 */

#pragma once

#include "QtChatView.h"
#include <QTextEdit>

namespace Swift {
	class UIEventStream;
	class QtBarriersFreeChatView : public QtChatView {
		public:
			QtBarriersFreeChatView(QtChatTheme* theme, QWidget* parent, UIEventStream* eventStream, SettingsProvider* settings, QMap<QString, QString> emoticons);
			virtual ~QtBarriersFreeChatView();

			// QtChatView Implementation
			void replaceLastMessage(const QString& newMessage);
			void replaceWithAction(const std::string& message, const std::string& id, const boost::posix_time::ptime& time);
			void setFileTransferStatus(QString id, const ChatWindow::FileTransferState state, const QString& msg);
			void setFileTransferProgress(QString id, const int percentageDone);
			void addToJSEnvironment(const QString&, QObject*);
			void setAckState(std::string const& id, ChatWindow::AckState);
			void setMessageReceiptState(const std::string& id, ChatWindow::ReceiptState state);
			std::string 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);
			void setChatWindowHasFocus(bool focus);
			std::string 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);
			std::string addFileTransfer(const std::string& senderName, bool senderIsSelf, const std::string& filename, const boost::uintmax_t sizeInBytes);
			void addErrorMessage(const std::string& errorMessage);
			void addSystemMessage(const std::string& message);
			void replaceMessage(const std::string& message, const QString& id, const QDateTime& time, const QString& style) {
				replaceMessage(P2QSTRING(message), id, time, style);
			}
			void replaceMessage(const QString& newMessage, const QString& id, const QDateTime& time, const QString& style);
			void addPresenceMessage(const std::string& message);
			void showEmoticons(bool);
			void setMUCInvitationJoined(QString id);
			void addMUCInvitation(const std::string& senderName, const JID& jid, const std::string& reason, const std::string& password, bool direct);
		public slots:
			// QtChatView Implementation
			void scrollToBottom();
			void resizeFont(int fontSizeSteps);
			void handleKeyPressEvent(QKeyEvent* event);

		private:
			QTextEdit *textEdit_;
			int idCounter_;
			UIEventStream* eventStream_;
			SettingsProvider* settings_;
			QMap<QString, QString> emoticons_;
	};
}