1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

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

This reverts commit 38df897e02.
This commit is contained in:
Anthony Bilinski 2020-04-04 22:45:36 -07:00
parent efff8d53c9
commit 4cd443ae7b
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
2 changed files with 4 additions and 15 deletions

View File

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

View File

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