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:
parent
5fc273da94
commit
146d93e159
|
@ -685,11 +685,6 @@ QDateTime GenericChatForm::getTime(const ChatLine::Ptr &chatLine) const
|
|||
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)
|
||||
{
|
||||
chatWidget->clear();
|
||||
|
@ -705,10 +700,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)
|
||||
{
|
||||
chatWidget->setScroll(false);
|
||||
|
@ -735,11 +726,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)
|
||||
{
|
||||
chatWidget->setScroll(false);
|
||||
|
@ -750,17 +736,19 @@ bool GenericChatForm::loadHistoryFrom(const QDateTime &time)
|
|||
begin = firstItemAfterDate(time.date(), chatLog);
|
||||
}
|
||||
|
||||
const auto end = chatLog.getNextIdx() < begin + DEF_NUM_MSG_TO_LOAD
|
||||
? chatLog.getNextIdx()
|
||||
: begin + DEF_NUM_MSG_TO_LOAD;
|
||||
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();
|
||||
}
|
||||
|
||||
// The chatLog.getNextIdx() is usually 1 more than the idx on last "messages" item
|
||||
// so if we have nothing to load, "add" is equal 1
|
||||
if (end - begin <= 1) {
|
||||
if (add <= 1) {
|
||||
chatWidget->setScroll(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
auto end = ChatLogIdx(begin.get() + add);
|
||||
|
||||
renderMessages(begin, end);
|
||||
|
||||
return true;
|
||||
|
@ -1219,17 +1207,11 @@ void GenericChatForm::goToCurrentDate()
|
|||
renderMessages(begin, end);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief GenericChatForm::loadHistoryLower load history after scrolling chatlog before first "messages" item
|
||||
*/
|
||||
void GenericChatForm::loadHistoryLower()
|
||||
{
|
||||
loadHistoryTo(QDateTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief GenericChatForm::loadHistoryUpper load history after scrolling chatlog after last "messages" item
|
||||
*/
|
||||
void GenericChatForm::loadHistoryUpper()
|
||||
{
|
||||
if (messages.empty()) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user