bundling timeouts from same user
This commit is contained in:
@@ -104,6 +104,8 @@ ChannelView::~ChannelView()
|
||||
this->messageRemovedConnection.disconnect();
|
||||
this->repaintGifsConnection.disconnect();
|
||||
this->layoutConnection.disconnect();
|
||||
this->messageAddedAtStartConnection.disconnect();
|
||||
this->messageReplacedConnection.disconnect();
|
||||
}
|
||||
|
||||
void ChannelView::queueUpdate()
|
||||
@@ -429,6 +431,15 @@ void ChannelView::setChannel(std::shared_ptr<Channel> newChannel)
|
||||
this->layoutMessages();
|
||||
});
|
||||
|
||||
// on message replaced
|
||||
this->messageReplacedConnection =
|
||||
newChannel->messageReplaced.connect([this](size_t index, SharedMessage replacement) {
|
||||
SharedMessageRef newItem(new MessageRef(replacement));
|
||||
|
||||
this->messages.replaceItem(this->messages.getSnapshot()[index], newItem);
|
||||
this->layoutMessages();
|
||||
});
|
||||
|
||||
auto snapshot = newChannel->getMessageSnapshot();
|
||||
|
||||
for (size_t i = 0; i < snapshot.getLength(); i++) {
|
||||
|
||||
@@ -117,6 +117,7 @@ private:
|
||||
boost::signals2::connection messageAppendedConnection;
|
||||
boost::signals2::connection messageAddedAtStartConnection;
|
||||
boost::signals2::connection messageRemovedConnection;
|
||||
boost::signals2::connection messageReplacedConnection;
|
||||
boost::signals2::connection repaintGifsConnection;
|
||||
boost::signals2::connection layoutConnection;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user