blob: ce1f8bc9c6123df102c4d73f2bde88b9c248e5f1 (
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
55
56
57
58
59
60
61
62
63
64
65
66
|
/*
* Copyright (c) 2010 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#ifndef SWIFT_QtChatView_H
#define SWIFT_QtChatView_H
#include <QString>
#include <QWidget>
#include <QList>
#include <QWebElement>
#include <boost/shared_ptr.hpp>
#include "ChatSnippet.h"
class QWebPage;
class QUrl;
namespace Swift {
class QtWebView;
class QtChatTheme;
class QtChatView : public QWidget {
Q_OBJECT
public:
QtChatView(QtChatTheme* theme, QWidget* parent);
void addMessage(boost::shared_ptr<ChatSnippet> snippet);
void replaceLastMessage(const QString& newMessage);
void replaceLastMessage(const QString& newMessage, const QString& note);
bool isScrolledToBottom() const;
signals:
void gotFocus();
public slots:
void copySelectionToClipboard();
void scrollToBottom();
void handleLinkClicked(const QUrl&);
void handleKeyPressEvent(QKeyEvent* event);
private slots:
void handleViewLoadFinished(bool);
private:
void headerEncode();
void messageEncode();
void addQueuedSnippets();
void addToDOM(boost::shared_ptr<ChatSnippet> snippet);
QWebElement snippetToDOM(boost::shared_ptr<ChatSnippet> snippet);
bool viewReady_;
QtWebView* webView_;
QWebPage* webPage_;
QList<boost::shared_ptr<ChatSnippet> > queuedSnippets_;
QtChatTheme* theme_;
QWebElement newInsertPoint_;
QWebElement lastElement_;
QWebElement document_;
};
}
#endif
|