Implement split clear chat

Fix #55
This commit is contained in:
Rasmus Karlsson 2017-07-02 14:40:36 +02:00
parent ddf886eaf1
commit 323cdc5561
2 changed files with 9 additions and 6 deletions

View file

@ -112,8 +112,7 @@ void ChatWidget::setChannelName(const QString &_newChannelName)
this->header.updateChannelText();
// update view
this->view.layoutMessages();
this->view.update();
this->layoutMessages(true);
}
void ChatWidget::setChannel(std::shared_ptr<Channel> _newChannel)
@ -177,9 +176,9 @@ void ChatWidget::showChangeChannelPopup()
}
}
void ChatWidget::layoutMessages()
void ChatWidget::layoutMessages(bool forceUpdate)
{
if (this->view.layoutMessages()) {
if (this->view.layoutMessages() || forceUpdate) {
this->view.update();
}
}
@ -249,7 +248,11 @@ void ChatWidget::doPopup()
void ChatWidget::doClearChat()
{
qDebug() << "[UNIMPLEMENTED] Clear chat";
// Clear all stored messages in this chat widget
this->messages.clear();
// Layout chat widget messages, and force an update regardless if there are no messages
this->layoutMessages(true);
}
void ChatWidget::doOpenChannel()

View file

@ -51,7 +51,7 @@ public:
void showChangeChannelPopup();
messages::LimitedQueueSnapshot<messages::SharedMessageRef> getMessagesSnapshot();
void layoutMessages();
void layoutMessages(bool forceUpdate = false);
void updateGifEmotes();
void giveFocus();