diff --git a/src/widget/form/genericchatform.cpp b/src/widget/form/genericchatform.cpp index 88cc8b877..3fbce045c 100644 --- a/src/widget/form/genericchatform.cpp +++ b/src/widget/form/genericchatform.cpp @@ -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); auto begin = ChatLogIdx(0); @@ -702,20 +702,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) @@ -1163,9 +1153,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) diff --git a/src/widget/form/genericchatform.h b/src/widget/form/genericchatform.h index ba4d813c3..51df5cefb 100644 --- a/src/widget/form/genericchatform.h +++ b/src/widget/form/genericchatform.h @@ -137,7 +137,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);