Browse Source

revert(chatlog): "scroll bar stuck to bottom (fix #5755)"

This reverts commit 38df897e02.
reviewable/pr6374/r3
Anthony Bilinski 5 years ago
parent
commit
335ce790e9
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
  1. 17
      src/widget/form/genericchatform.cpp
  2. 2
      src/widget/form/genericchatform.h

17
src/widget/form/genericchatform.cpp

@ -726,7 +726,7 @@ void GenericChatForm::loadHistoryTo(const QDateTime &time) @@ -726,7 +726,7 @@ void GenericChatForm::loadHistoryTo(const QDateTime &time)
}
}
bool GenericChatForm::loadHistoryFrom(const QDateTime &time)
void GenericChatForm::loadHistoryFrom(const QDateTime &time)
{
chatWidget->setScroll(false);
auto begin = chatLog.getFirstIdx();
@ -738,20 +738,10 @@ bool GenericChatForm::loadHistoryFrom(const QDateTime &time) @@ -738,20 +738,10 @@ bool GenericChatForm::loadHistoryFrom(const QDateTime &time)
int add = DEF_NUM_MSG_TO_LOAD;
if (begin.get() + DEF_NUM_MSG_TO_LOAD > chatLog.getNextIdx().get()) {
auto t = chatLog.getNextIdx();
add = chatLog.getNextIdx().get() - begin.get();
}
if (add <= 1) {
chatWidget->setScroll(true);
return false;
}
auto end = ChatLogIdx(begin.get() + add);
renderMessages(begin, end);
return true;
}
void GenericChatForm::removeFirstsMessages(const int num)
@ -1219,9 +1209,8 @@ void GenericChatForm::loadHistoryUpper() @@ -1219,9 +1209,8 @@ void GenericChatForm::loadHistoryUpper()
}
auto msg = messages.crbegin()->second;
if (loadHistoryFrom(QDateTime())) {
chatWidget->scrollToLine(msg);
}
loadHistoryFrom(QDateTime());
chatWidget->scrollToLine(msg);
}
void GenericChatForm::updateShowDateInfo(const ChatLine::Ptr& prevLine, const ChatLine::Ptr& topLine)

2
src/widget/form/genericchatform.h

@ -130,7 +130,7 @@ private: @@ -130,7 +130,7 @@ private:
QDateTime getTime(const ChatLine::Ptr& chatLine) const;
void loadHistory(const QDateTime& time, const LoadHistoryDialog::LoadType type);
void loadHistoryTo(const QDateTime& time);
bool loadHistoryFrom(const QDateTime& time);
void loadHistoryFrom(const QDateTime& time);
void removeFirstsMessages(const int num);
void removeLastsMessages(const int num);

Loading…
Cancel
Save