|
|
|
@ -36,7 +36,7 @@
@@ -36,7 +36,7 @@
|
|
|
|
|
#include "src/widget/contentlayout.h" |
|
|
|
|
#include "src/widget/emoticonswidget.h" |
|
|
|
|
#include "src/widget/form/chatform.h" |
|
|
|
|
#include "src/widget/gui.h" |
|
|
|
|
#include "src/widget/form/loadhistorydialog.h" |
|
|
|
|
#include "src/widget/maskablepixmapwidget.h" |
|
|
|
|
#include "src/widget/searchform.h" |
|
|
|
|
#include "src/widget/style.h" |
|
|
|
@ -676,23 +676,6 @@ QDateTime GenericChatForm::getTime(const ChatLine::Ptr &chatLine) const
@@ -676,23 +676,6 @@ QDateTime GenericChatForm::getTime(const ChatLine::Ptr &chatLine) const
|
|
|
|
|
return QDateTime(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void GenericChatForm::loadHistory(const QDateTime &time, const LoadHistoryDialog::LoadType type) |
|
|
|
|
{ |
|
|
|
|
chatWidget->clear(); |
|
|
|
|
messages.clear(); |
|
|
|
|
|
|
|
|
|
auto begin = firstItemAfterDate(time.date(), chatLog); |
|
|
|
|
auto end = ChatLogIdx(begin.get() + 1); |
|
|
|
|
|
|
|
|
|
renderMessages(begin, end); |
|
|
|
|
|
|
|
|
|
if (type == LoadHistoryDialog::from) { |
|
|
|
|
loadHistoryUpper(); |
|
|
|
|
} else { |
|
|
|
|
loadHistoryLower(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void GenericChatForm::disableSearchText() |
|
|
|
|
{ |
|
|
|
@ -839,10 +822,22 @@ void GenericChatForm::onLoadHistory()
@@ -839,10 +822,22 @@ void GenericChatForm::onLoadHistory()
|
|
|
|
|
{ |
|
|
|
|
LoadHistoryDialog dlg(&chatLog); |
|
|
|
|
if (dlg.exec()) { |
|
|
|
|
chatWidget->clear(); |
|
|
|
|
messages.clear(); |
|
|
|
|
|
|
|
|
|
QDateTime time = dlg.getFromDate(); |
|
|
|
|
auto type = dlg.getLoadType(); |
|
|
|
|
|
|
|
|
|
loadHistory(time, type); |
|
|
|
|
auto begin = firstItemAfterDate(dlg.getFromDate().date(), chatLog); |
|
|
|
|
auto end = ChatLogIdx(begin.get() + 1); |
|
|
|
|
|
|
|
|
|
renderMessages(begin, end); |
|
|
|
|
|
|
|
|
|
if (type == LoadHistoryDialog::from) { |
|
|
|
|
loadHistoryUpper(); |
|
|
|
|
} else { |
|
|
|
|
loadHistoryLower(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -889,12 +884,6 @@ void GenericChatForm::searchInBegin(const QString& phrase, const ParameterSearch
@@ -889,12 +884,6 @@ void GenericChatForm::searchInBegin(const QString& phrase, const ParameterSearch
|
|
|
|
|
{ |
|
|
|
|
disableSearchText(); |
|
|
|
|
|
|
|
|
|
if (!parameter.time.isNull()) { |
|
|
|
|
LoadHistoryDialog::LoadType type = (parameter.period == PeriodSearch::BeforeDate) |
|
|
|
|
? LoadHistoryDialog::to : LoadHistoryDialog::from; |
|
|
|
|
loadHistory(parameter.time, type); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool bForwardSearch = false; |
|
|
|
|
switch (parameter.period) { |
|
|
|
|
case PeriodSearch::WithTheFirst: { |
|
|
|
@ -912,13 +901,13 @@ void GenericChatForm::searchInBegin(const QString& phrase, const ParameterSearch
@@ -912,13 +901,13 @@ void GenericChatForm::searchInBegin(const QString& phrase, const ParameterSearch
|
|
|
|
|
} |
|
|
|
|
case PeriodSearch::AfterDate: { |
|
|
|
|
bForwardSearch = true; |
|
|
|
|
searchPos.logIdx = firstItemAfterDate(parameter.time.date(), chatLog); |
|
|
|
|
searchPos.logIdx = firstItemAfterDate(parameter.date, chatLog); |
|
|
|
|
searchPos.numMatches = 0; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
case PeriodSearch::BeforeDate: { |
|
|
|
|
bForwardSearch = false; |
|
|
|
|
searchPos.logIdx = firstItemAfterDate(parameter.time.date(), chatLog); |
|
|
|
|
searchPos.logIdx = firstItemAfterDate(parameter.date, chatLog); |
|
|
|
|
searchPos.numMatches = 0; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
@ -1066,7 +1055,7 @@ void GenericChatForm::loadHistoryLower()
@@ -1066,7 +1055,7 @@ void GenericChatForm::loadHistoryLower()
|
|
|
|
|
|
|
|
|
|
void GenericChatForm::loadHistoryUpper() |
|
|
|
|
{ |
|
|
|
|
auto begin = messages.rbegin()->first; |
|
|
|
|
auto begin = messages.end()->first; |
|
|
|
|
|
|
|
|
|
int add = 100; |
|
|
|
|
if (begin.get() + 100 > chatLog.getNextIdx().get()) { |
|
|
|
|