removed autoscoll and gotobottom from emotepopup

This commit is contained in:
2017-12-28 00:48:21 +01:00
parent 4aa995c74a
commit ece0482502
3 changed files with 19 additions and 2 deletions

View file

@ -20,6 +20,9 @@ EmotePopup::EmotePopup(ColorScheme &colorScheme)
this->viewEmotes = new ChannelView();
this->viewEmojis = new ChannelView();
this->viewEmotes->setEnableScrollingToBottom(false);
this->viewEmojis->setEnableScrollingToBottom(false);
this->setLayout(new QVBoxLayout(this));
QTabWidget *tabs = new QTabWidget(this);

View file

@ -45,7 +45,8 @@ ChannelView::ChannelView(BaseWidget *parent)
this->scrollBar.getCurrentValueChanged().connect([this] {
// Whenever the scrollbar value has been changed, re-render the ChatWidgetView
this->layoutMessages();
this->goToBottom->setVisible(this->scrollBar.isVisible() && !this->scrollBar.isAtBottom());
this->goToBottom->setVisible(this->enableScrollingToBottom && this->scrollBar.isVisible() &&
!this->scrollBar.isAtBottom());
this->queueUpdate();
});
@ -178,7 +179,7 @@ void ChannelView::actuallyLayoutMessages()
this->scrollBar.setMaximum(messagesSnapshot.getLength());
if (this->showingLatestMessages && showScrollbar) {
if (this->enableScrollingToBottom && this->showingLatestMessages && showScrollbar) {
// If we were showing the latest messages and the scrollbar now wants to be rendered, scroll
// to bottom
// TODO: Do we want to check if the user is currently moving the scrollbar?
@ -329,6 +330,16 @@ void ChannelView::clearSelection()
layoutMessages();
}
void ChannelView::setEnableScrollingToBottom(bool value)
{
this->enableScrollingToBottom = value;
}
bool ChannelView::getEnableScrollingToBottom() const
{
return this->enableScrollingToBottom;
}
messages::LimitedQueueSnapshot<SharedMessageRef> ChannelView::getMessagesSnapshot()
{
return this->messages.getSnapshot();

View file

@ -95,6 +95,8 @@ public:
QString getSelectedText();
bool hasSelection();
void clearSelection();
void setEnableScrollingToBottom(bool);
bool getEnableScrollingToBottom() const;
void setChannel(std::shared_ptr<Channel> channel);
messages::LimitedQueueSnapshot<messages::SharedMessageRef> getMessagesSnapshot();
@ -147,6 +149,7 @@ private:
// This variable can be used to decide whether or not we should render the "Show latest
// messages" button
bool showingLatestMessages = true;
bool enableScrollingToBottom = true;
AccountPopupWidget userPopupWidget;
bool onlyUpdateEmotes = false;