diff options
author | Tobias Markmann <tm@ayena.de> | 2016-03-08 13:36:27 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2016-03-29 14:13:20 (GMT) |
commit | 74e51310d27e9d9a66d2d790360549c48abec8d1 (patch) | |
tree | d350bf7cd62c144e561841b4a228b0f60cb76957 /Swift/QtUI/QtChatWindow.cpp | |
parent | c26314684cd4e6140e5ea882285c2076505bd53d (diff) | |
download | swift-74e51310d27e9d9a66d2d790360549c48abec8d1.zip swift-74e51310d27e9d9a66d2d790360549c48abec8d1.tar.bz2 |
Refactored keyword highlighting
This commit changes the ChatWindow/ChatView APIs to not pass
highlights actions as additional parameters but instead they
are now part of the ChatWindow::ChatMessage and its parts.
This allows the controllers to do highlighting in one single
place and play sound actions on the highlighted message in
a single place.
On a highlighted message only unique sounds are played and
they are played in sequence of the rules that matched
the message.
Test-Information:
Adjusted the existing unit tests accordingly. Added unit
tests that check reduplication of highlight action sounds
and that the sound actions are emitted correctly.
Manually verified that highlight sound actions with and
without duplicated sounds are audible on OS X 10.11.3.
Change-Id: I68c88e0d285d79d87b2997ed29d92b140480b394
Diffstat (limited to 'Swift/QtUI/QtChatWindow.cpp')
-rw-r--r-- | Swift/QtUI/QtChatWindow.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp index 5c4723d..7649256 100644 --- a/Swift/QtUI/QtChatWindow.cpp +++ b/Swift/QtUI/QtChatWindow.cpp @@ -866,14 +866,14 @@ void QtChatWindow::addMUCInvitation(const std::string& senderName, const JID& ji messageLog_->addMUCInvitation(senderName, jid, reason, password, direct, isImpromptu, isContinuation); } -std::string QtChatWindow::addMessage(const ChatMessage& message, const std::string& senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time, const HighlightAction& highlight) { +std::string QtChatWindow::addMessage(const ChatMessage& message, const std::string& senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) { handleAppendedToLog(); - return messageLog_->addMessage(message, senderName, senderIsSelf, label, avatarPath, time, highlight); + return messageLog_->addMessage(message, senderName, senderIsSelf, label, avatarPath, time); } -std::string QtChatWindow::addAction(const ChatMessage& message, const std::string& senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time, const HighlightAction& highlight) { +std::string QtChatWindow::addAction(const ChatMessage& message, const std::string& senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) { handleAppendedToLog(); - return messageLog_->addAction(message, senderName, senderIsSelf, label, avatarPath, time, highlight); + return messageLog_->addAction(message, senderName, senderIsSelf, label, avatarPath, time); } @@ -893,14 +893,14 @@ void QtChatWindow::addErrorMessage(const ChatMessage& message) { } -void QtChatWindow::replaceMessage(const ChatMessage& message, const std::string& id, const boost::posix_time::ptime& time, const HighlightAction& highlight) { +void QtChatWindow::replaceMessage(const ChatMessage& message, const std::string& id, const boost::posix_time::ptime& time) { handleAppendedToLog(); - messageLog_->replaceMessage(message, id, time, highlight); + messageLog_->replaceMessage(message, id, time); } -void QtChatWindow::replaceWithAction(const ChatMessage& message, const std::string& id, const boost::posix_time::ptime& time, const HighlightAction& highlight) { +void QtChatWindow::replaceWithAction(const ChatMessage& message, const std::string& id, const boost::posix_time::ptime& time) { handleAppendedToLog(); - messageLog_->replaceWithAction(message, id, time, highlight); + messageLog_->replaceWithAction(message, id, time); } std::string QtChatWindow::addFileTransfer(const std::string& senderName, bool senderIsSelf, const std::string& filename, const boost::uintmax_t sizeInBytes, const std::string& description) { |