diff options
Diffstat (limited to 'Swift/QtUI/QtChatView.h')
-rw-r--r-- | Swift/QtUI/QtChatView.h | 115 |
1 files changed, 43 insertions, 72 deletions
diff --git a/Swift/QtUI/QtChatView.h b/Swift/QtUI/QtChatView.h index fdbdd5a..2454672 100644 --- a/Swift/QtUI/QtChatView.h +++ b/Swift/QtUI/QtChatView.h @@ -1,86 +1,57 @@ /* - * Copyright (c) 2010 Remko Tronçon - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. + * Copyright (c) 2012 Thilo Cestonaro + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. */ #ifndef SWIFT_QtChatView_H #define SWIFT_QtChatView_H -#include <QString> +#include "QtChatWindow.h" #include <QWidget> -#include <QList> -#include <QWebElement> - -#include <boost/shared_ptr.hpp> - -#include "ChatSnippet.h" - -#include <Swift/Controllers/UIInterfaces/ChatWindow.h> - -class QWebPage; -class QUrl; +#include <QKeyEvent> 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 addLastSeenLine(); - void replaceLastMessage(const QString& newMessage); - void replaceLastMessage(const QString& newMessage, const QString& note); - void replaceMessage(const QString& newMessage, const QString& id, const QDateTime& time); - void rememberScrolledToBottom(); - void setAckXML(const QString& id, const QString& xml); - void setReceiptXML(const QString& id, const QString& xml); - void displayReceiptInfo(const QString& id, bool showIt); - - QString getLastSentMessage(); - void addToJSEnvironment(const QString&, QObject*); - void setFileTransferProgress(QString id, const int percentageDone); - void setFileTransferStatus(QString id, const ChatWindow::FileTransferState state, const QString& msg); - void setMUCInvitationJoined(QString id); - void showEmoticons(bool show); - signals: - void gotFocus(); - void fontResized(int); - void logCleared(); - - public slots: - void copySelectionToClipboard(); - void scrollToBottom(); - void handleLinkClicked(const QUrl&); - void handleKeyPressEvent(QKeyEvent* event); - void resetView(); - void increaseFontSize(int numSteps = 1); - void decreaseFontSize(); - void resizeFont(int fontSizeSteps); - - private slots: - void handleViewLoadFinished(bool); - void handleFrameSizeChanged(); - void handleClearRequested(); - - private: - void headerEncode(); - void messageEncode(); - void addToDOM(boost::shared_ptr<ChatSnippet> snippet); - QWebElement snippetToDOM(boost::shared_ptr<ChatSnippet> snippet); - - bool viewReady_; - bool isAtBottom_; - QtWebView* webView_; - QWebPage* webPage_; - int fontSizeSteps_; - QtChatTheme* theme_; - QWebElement newInsertPoint_; - QWebElement lineSeparator_; - QWebElement lastElement_; - QWebElement document_; + public: + QtChatView(QWidget* parent); + virtual ~QtChatView(); + + + virtual void setFileTransferStatus(QString id, const ChatWindow::FileTransferState state, const QString& msg) = 0; + virtual void setFileTransferProgress(QString id, const int percentageDone) = 0; + virtual void addToJSEnvironment(const QString&, QObject*) = 0; + virtual void setAckState(std::string const& id, ChatWindow::AckState) = 0; + virtual void setMessageReceiptState(const std::string& id, ChatWindow::ReceiptState state) = 0; + virtual 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) = 0; + virtual void setChatWindowHasFocus(bool focus) = 0; + virtual 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) = 0; + virtual std::string addFileTransfer(const std::string& senderName, bool senderIsSelf, const std::string& filename, const boost::uintmax_t sizeInBytes) = 0; + virtual void addErrorMessage(const std::string& errorMessage) = 0; + virtual void addSystemMessage(const std::string& message) = 0; + virtual void replaceMessage(const std::string& newMessage, const QString& id, const QDateTime& time, const QString& style) = 0; + virtual void replaceLastMessage(const QString& newMessage) = 0; + virtual void replaceWithAction(const std::string& message, const std::string& id, const boost::posix_time::ptime& time) = 0; + virtual void addPresenceMessage(const std::string& message) = 0; + virtual void setMUCInvitationJoined(QString id) = 0; + virtual void addMUCInvitation(const std::string& senderName, const JID& jid, const std::string& reason, const std::string& password, bool direct) = 0; + virtual void showEmoticons(bool show) = 0; + + signals: + void logCleared(); + void onFileTransferAccept(std::string, std::string); + void onFileTransferStart(std::string, std::string); + void onFileTransferCancel(std::string); + void gotFocus(); + void fontResized(int); + + public slots: + virtual void scrollToBottom() = 0; + virtual void resizeFont(int fontSizeSteps) = 0; + virtual void handleKeyPressEvent(QKeyEvent* event) = 0; }; } -#endif +#endif // #ifndef SWIFT_QtWebKitChatView_H + |