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

docs: add comments for functions that load history

This commit is contained in:
TriKriSta 2019-08-29 19:24:15 +03:00
parent 38df897e02
commit 5fc1afbab5

View File

@ -654,6 +654,11 @@ 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();
@ -669,6 +674,10 @@ 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);
@ -695,6 +704,11 @@ 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);
@ -707,11 +721,12 @@ 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) {
// 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 (add <= 1) {
chatWidget->setScroll(true);
return false;
}
@ -1157,11 +1172,17 @@ 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()) {