|
|
|
@ -356,6 +356,7 @@ GenericChatForm::GenericChatForm(const Contact* contact, IChatLog& chatLog,
@@ -356,6 +356,7 @@ GenericChatForm::GenericChatForm(const Contact* contact, IChatLog& chatLog,
|
|
|
|
|
&GenericChatForm::onChatContextMenuRequested); |
|
|
|
|
connect(chatWidget, &ChatLog::firstVisibleLineChanged, this, &GenericChatForm::updateShowDateInfo); |
|
|
|
|
connect(chatWidget, &ChatLog::loadHistoryLower, this, &GenericChatForm::loadHistoryLower); |
|
|
|
|
connect(chatWidget, &ChatLog::loadHistoryUpper, this, &GenericChatForm::loadHistoryUpper); |
|
|
|
|
|
|
|
|
|
connect(searchForm, &SearchForm::searchInBegin, this, &GenericChatForm::searchInBegin); |
|
|
|
|
connect(searchForm, &SearchForm::searchUp, this, &GenericChatForm::onSearchUp); |
|
|
|
@ -812,7 +813,10 @@ void GenericChatForm::onLoadHistory()
@@ -812,7 +813,10 @@ void GenericChatForm::onLoadHistory()
|
|
|
|
|
if (dlg.exec()) { |
|
|
|
|
QDateTime time = dlg.getFromDate(); |
|
|
|
|
auto idx = firstItemAfterDate(dlg.getFromDate().date(), chatLog); |
|
|
|
|
renderMessages(idx, chatLog.getNextIdx()); |
|
|
|
|
auto end = ChatLogIdx(idx.get() + 100); |
|
|
|
|
chatWidget->clear(); |
|
|
|
|
messages.clear(); |
|
|
|
|
renderMessages(idx, end); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -993,6 +997,18 @@ void GenericChatForm::loadHistoryLower()
@@ -993,6 +997,18 @@ void GenericChatForm::loadHistoryLower()
|
|
|
|
|
renderMessages(begin, chatLog.getNextIdx()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void GenericChatForm::loadHistoryUpper() |
|
|
|
|
{ |
|
|
|
|
auto begin = messages.end()->first; |
|
|
|
|
|
|
|
|
|
int add = 100; |
|
|
|
|
if (begin.get() + 100 > chatLog.getNextIdx().get()) { |
|
|
|
|
add = chatLog.getNextIdx().get() - (begin.get() + 100); |
|
|
|
|
} |
|
|
|
|
auto end = ChatLogIdx(begin.get() + add); |
|
|
|
|
renderMessages(begin, end); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void GenericChatForm::updateShowDateInfo(const ChatLine::Ptr& line) |
|
|
|
|
{ |
|
|
|
|
const auto date = getTime(line); |
|
|
|
|