diff options
author | Peter Burgess <pete.burgess@isode.com> | 2018-02-26 18:01:43 (GMT) |
---|---|---|
committer | Peter Burgess <pete.burgess@isode.com> | 2018-02-27 12:15:55 (GMT) |
commit | 3a540816280691e7ca3191867d3c73beba465674 (patch) | |
tree | 25508e9fc836b0350adab57cc4e3265ad370c36c /Swift/QtUI/QtWebKitChatView.h | |
parent | 85a144fe80d0fe89b5fed852013b6986b44978d4 (diff) | |
download | swift-3a540816280691e7ca3191867d3c73beba465674.zip swift-3a540816280691e7ca3191867d3c73beba465674.tar.bz2 |
Divide differently marked msgs and elide msgs matching room
If consecutive message from the same user have differing security
markings, then mark them as non continuing to show clearer seperation
of messages with different security markings. They are seperated in the
same way as consecutive messages from different users are.
Further to this, there is a new scheme for displaying message security
markings. Messages with a security marking matching the room security
marking will not be marked, aside from the first in a series of
consecutive messages marked with the same security marking. Unmarked
messages in a room with a security marking will be marked as such.
This new marking display system can be turned on and off via an xml
setting "mucMarkingElision".
Test-Information:
Unit tests written and passed in MUCControllerTest, runs as expected.
Change-Id: Id2b66417f363c49c131d27e738ce786755d65203
Diffstat (limited to 'Swift/QtUI/QtWebKitChatView.h')
-rw-r--r-- | Swift/QtUI/QtWebKitChatView.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Swift/QtUI/QtWebKitChatView.h b/Swift/QtUI/QtWebKitChatView.h index f816942..a2eafe6 100644 --- a/Swift/QtUI/QtWebKitChatView.h +++ b/Swift/QtUI/QtWebKitChatView.h @@ -1,75 +1,76 @@ /* * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include <memory> #include <QList> #include <QString> #include <QWebElement> #include <QWidget> #include <Swift/Controllers/UIInterfaces/ChatWindow.h> #include <Swift/QtUI/ChatSnippet.h> #include <Swift/QtUI/QtChatView.h> class QWebPage; class QUrl; class QDate; namespace Swift { class QtWebView; class QtChatTheme; class QtChatWindowJSBridge; class UIEventStream; class QtChatWindow; + class SettingsProvider; class QtWebKitChatView : public QtChatView { Q_OBJECT public: static const QString ButtonWhiteboardSessionCancel; static const QString ButtonWhiteboardSessionAcceptRequest; static const QString ButtonWhiteboardShowWindow; static const QString ButtonFileTransferCancel; static const QString ButtonFileTransferSetDescription; static const QString ButtonFileTransferSendRequest; static const QString ButtonFileTransferAcceptRequest; static const QString ButtonFileTransferOpenFile; static const QString ButtonMUCInvite; public: - QtWebKitChatView(QtChatWindow* window, UIEventStream* eventStream, QtChatTheme* theme, QWidget* parent, bool disableAutoScroll = false); + QtWebKitChatView(QtChatWindow* window, UIEventStream* eventStream, QtChatTheme* theme, QWidget* parent, SettingsProvider* settings, bool disableAutoScroll = false); ~QtWebKitChatView() override; /** Add message to window. * @return id of added message (for acks). */ virtual std::string addMessage(const ChatWindow::ChatMessage& message, const std::string& senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) override; /** Adds action to window. * @return id of added message (for acks); */ virtual std::string addAction(const ChatWindow::ChatMessage& message, const std::string& senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) override; virtual std::string addSystemMessage(const ChatWindow::ChatMessage& message, ChatWindow::Direction direction) override; virtual void addPresenceMessage(const ChatWindow::ChatMessage& message, ChatWindow::Direction direction) override; virtual void addErrorMessage(const ChatWindow::ChatMessage& message) override; virtual void replaceMessage(const ChatWindow::ChatMessage& message, const std::string& id, const boost::posix_time::ptime& time) override; virtual void replaceSystemMessage(const ChatWindow::ChatMessage& message, const std::string& id, ChatWindow::TimestampBehaviour timestampBehaviour) override; virtual void replaceWithAction(const ChatWindow::ChatMessage& message, const std::string& id, const boost::posix_time::ptime& time) override; virtual void replaceLastMessage(const ChatWindow::ChatMessage& message, const ChatWindow::TimestampBehaviour timestampBehaviour) override; virtual void setAckState(const std::string& id, ChatWindow::AckState state) override; virtual std::string addFileTransfer(const std::string& senderName, const std::string& avatarPath, bool senderIsSelf, const std::string& filename, const boost::uintmax_t sizeInBytes, const std::string& description) override; virtual void setFileTransferProgress(std::string, const int percentageDone) override; virtual void setFileTransferStatus(std::string, const ChatWindow::FileTransferState state, const std::string& msg = "") override; virtual void addMUCInvitation(const std::string& senderName, const JID& jid, const std::string& reason, const std::string& password, bool direct, bool isImpromptu, bool isContinuation) override; virtual std::string addWhiteboardRequest(const QString& contact, bool senderIsSelf) override; virtual void setWhiteboardSessionStatus(const std::string& id, const ChatWindow::WhiteboardSessionState state) override; virtual void setMessageReceiptState(const std::string& id, ChatWindow::ReceiptState state) override; virtual void showEmoticons(bool show) override; @@ -123,71 +124,73 @@ namespace Swift { void handleFrameSizeChanged(); void handleClearRequested(); void handleHTMLButtonClicked(QString id, QString arg1, QString arg2, QString arg3, QString arg4, QString arg5); void handleVerticalScrollBarPositionChanged(double position); private: enum PreviousMessageKind { PreviosuMessageWasNone, PreviousMessageWasMessage, PreviousMessageWasSystem, PreviousMessageWasPresence, PreviousMessageWasFileTransfer, PreviousMessageWasMUCInvite }; std::string addMessage( const QString& message, const std::string& senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const QString& style, const boost::posix_time::ptime& time, const HighlightAction& highlight, ChatSnippet::Direction direction); void replaceMessage( const QString& message, const std::string& id, const boost::posix_time::ptime& time, const QString& style, const HighlightAction& highlight); - bool appendToPreviousCheck(PreviousMessageKind messageKind, const std::string& senderName, bool senderIsSelf); + bool appendToPreviousCheck(PreviousMessageKind messageKind, const std::string& senderName, bool senderIsSelf, const std::shared_ptr<SecurityLabel>& label = nullptr); static ChatSnippet::Direction getActualDirection(const ChatWindow::ChatMessage& message, ChatWindow::Direction direction); QString getHighlightSpanStart(const std::string& text, const std::string& background); QString getHighlightSpanStart(const HighlightAction& highlight); QString chatMessageToHTML(const ChatWindow::ChatMessage& message); static QString buildChatWindowButton(const QString& name, const QString& id, const QString& arg1 = QString(), const QString& arg2 = QString(), const QString& arg3 = QString(), const QString& arg4 = QString(), const QString& arg5 = QString()); protected: void resizeEvent(QResizeEvent* event) override; private: void headerEncode(); void messageEncode(); void addToDOM(std::shared_ptr<ChatSnippet> snippet); QtChatWindow* window_; UIEventStream* eventStream_; bool viewReady_; bool isAtBottom_; bool topMessageAdded_; int scrollBarMaximum_; QtWebView* webView_; QWebPage* webPage_; int fontSizeSteps_; QtChatTheme* theme_; QWebElement lineSeparator_; QWebElement lastElement_; QWebElement firstElement_; QWebElement document_; bool disableAutoScroll_; QtChatWindowJSBridge* jsBridge; PreviousMessageKind previousMessageKind_; bool previousMessageWasSelf_; bool showEmoticons_; bool insertingLastLine_; int idCounter_; QString previousSenderName_; std::map<QString, QString> descriptions_; std::map<QString, QString> filePaths_; + std::string previousMessageDisplayMarking_; + SettingsProvider* settings_ = nullptr; }; } |