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

revert(chatlog): "add comments for functions that load history"

This reverts commit 5fc1afbab5.
This commit is contained in:
Anthony Bilinski 2020-04-04 22:45:30 -07:00
parent 5d44cd773f
commit efff8d53c9
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C

View File

@ -649,11 +649,6 @@ QDateTime GenericChatForm::getTime(const ChatLine::Ptr &chatLine) const
return QDateTime(); return QDateTime();
} }
/**
* @brief GenericChatForm::loadHistory load history
* @param time start date
* @param type indicates the direction of loading history
*/
void GenericChatForm::loadHistory(const QDateTime &time, const LoadHistoryDialog::LoadType type) void GenericChatForm::loadHistory(const QDateTime &time, const LoadHistoryDialog::LoadType type)
{ {
chatWidget->clear(); chatWidget->clear();
@ -669,10 +664,6 @@ void GenericChatForm::loadHistory(const QDateTime &time, const LoadHistoryDialog
} }
} }
/**
* @brief GenericChatForm::loadHistoryTo load history before to date "time" or before the first "messages" item
* @param time start date
*/
void GenericChatForm::loadHistoryTo(const QDateTime &time) void GenericChatForm::loadHistoryTo(const QDateTime &time)
{ {
chatWidget->setScroll(false); chatWidget->setScroll(false);
@ -699,11 +690,6 @@ void GenericChatForm::loadHistoryTo(const QDateTime &time)
} }
} }
/**
* @brief GenericChatForm::loadHistoryFrom load history starting from date "time" or from the last "messages" item
* @param time start date
* @return true if function loaded history else false
*/
bool GenericChatForm::loadHistoryFrom(const QDateTime &time) bool GenericChatForm::loadHistoryFrom(const QDateTime &time)
{ {
chatWidget->setScroll(false); chatWidget->setScroll(false);
@ -716,12 +702,11 @@ 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();
} }
// The chatLog.getNextIdx() is usually 1 more than the idx on last "messages" item if (add <= 1) {
// so if we have nothing to load, "add" is equal 1
if (add <= 1) {
chatWidget->setScroll(true); chatWidget->setScroll(true);
return false; return false;
} }
@ -1166,17 +1151,11 @@ void GenericChatForm::goToCurrentDate()
renderMessages(begin, end); renderMessages(begin, end);
} }
/**
* @brief GenericChatForm::loadHistoryLower load history after scrolling chatlog before first "messages" item
*/
void GenericChatForm::loadHistoryLower() void GenericChatForm::loadHistoryLower()
{ {
loadHistoryTo(QDateTime()); loadHistoryTo(QDateTime());
} }
/**
* @brief GenericChatForm::loadHistoryUpper load history after scrolling chatlog after last "messages" item
*/
void GenericChatForm::loadHistoryUpper() void GenericChatForm::loadHistoryUpper()
{ {
if (messages.empty()) { if (messages.empty()) {