mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
revert(chatlog): "load messages from the database after date"
This reverts commit b705ac806059717d98cfd60b1b2f1abdaa84e6a9.
This commit is contained in:
parent
31346423e1
commit
041b697e77
@ -391,22 +391,6 @@ void ChatLog::insertChatlineAtBottom(ChatLine::Ptr l)
|
|||||||
updateTypingNotification();
|
updateTypingNotification();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatLog::insertChatlineAtBottom(const QList<ChatLine::Ptr>& newLines)
|
|
||||||
{
|
|
||||||
if (newLines.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (ChatLine::Ptr l : newLines) {
|
|
||||||
l->setRow(lines.size());
|
|
||||||
l->addToScene(scene);
|
|
||||||
l->visibilityChanged(false);
|
|
||||||
lines.append(l);
|
|
||||||
}
|
|
||||||
|
|
||||||
layout(lines.last()->getRow(), lines.size(), useableWidth());
|
|
||||||
startResizeWorker();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ChatLog::insertChatlineOnTop(ChatLine::Ptr l)
|
void ChatLog::insertChatlineOnTop(ChatLine::Ptr l)
|
||||||
{
|
{
|
||||||
if (!l.get())
|
if (!l.get())
|
||||||
@ -729,12 +713,8 @@ void ChatLog::checkVisibility(bool causedByScroll)
|
|||||||
emit firstVisibleLineChanged(lastLineBeforeVisible, visibleLines.at(0));
|
emit firstVisibleLineChanged(lastLineBeforeVisible, visibleLines.at(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (causedByScroll) {
|
if (causedByScroll && lowerBound != lines.cend() && lowerBound->get()->row == 0) {
|
||||||
if (lowerBound != lines.cend() && lowerBound->get()->row == 0) {
|
|
||||||
emit loadHistoryLower();
|
emit loadHistoryLower();
|
||||||
} else if (upperBound != lines.cend() && upperBound->get()->row >= lines.size() - 10) {
|
|
||||||
emit loadHistoryUpper();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,6 @@ public:
|
|||||||
virtual ~ChatLog();
|
virtual ~ChatLog();
|
||||||
|
|
||||||
void insertChatlineAtBottom(ChatLine::Ptr l);
|
void insertChatlineAtBottom(ChatLine::Ptr l);
|
||||||
void insertChatlineAtBottom(const QList<ChatLine::Ptr>& newLines);
|
|
||||||
void insertChatlineOnTop(ChatLine::Ptr l);
|
void insertChatlineOnTop(ChatLine::Ptr l);
|
||||||
void insertChatlinesOnTop(const QList<ChatLine::Ptr>& newLines);
|
void insertChatlinesOnTop(const QList<ChatLine::Ptr>& newLines);
|
||||||
void clearSelection();
|
void clearSelection();
|
||||||
@ -68,7 +67,6 @@ signals:
|
|||||||
void workerTimeoutFinished();
|
void workerTimeoutFinished();
|
||||||
void firstVisibleLineChanged(const ChatLine::Ptr& prevLine, const ChatLine::Ptr& firstLine);
|
void firstVisibleLineChanged(const ChatLine::Ptr& prevLine, const ChatLine::Ptr& firstLine);
|
||||||
void loadHistoryLower();
|
void loadHistoryLower();
|
||||||
void loadHistoryUpper();
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void forceRelayout();
|
void forceRelayout();
|
||||||
|
@ -343,7 +343,6 @@ GenericChatForm::GenericChatForm(const Core& _core, const Contact* contact, ICha
|
|||||||
&GenericChatForm::onChatContextMenuRequested);
|
&GenericChatForm::onChatContextMenuRequested);
|
||||||
connect(chatWidget, &ChatLog::firstVisibleLineChanged, this, &GenericChatForm::updateShowDateInfo);
|
connect(chatWidget, &ChatLog::firstVisibleLineChanged, this, &GenericChatForm::updateShowDateInfo);
|
||||||
connect(chatWidget, &ChatLog::loadHistoryLower, this, &GenericChatForm::loadHistoryLower);
|
connect(chatWidget, &ChatLog::loadHistoryLower, this, &GenericChatForm::loadHistoryLower);
|
||||||
connect(chatWidget, &ChatLog::loadHistoryUpper, this, &GenericChatForm::loadHistoryUpper);
|
|
||||||
|
|
||||||
connect(searchForm, &SearchForm::searchInBegin, this, &GenericChatForm::searchInBegin);
|
connect(searchForm, &SearchForm::searchInBegin, this, &GenericChatForm::searchInBegin);
|
||||||
connect(searchForm, &SearchForm::searchUp, this, &GenericChatForm::onSearchUp);
|
connect(searchForm, &SearchForm::searchUp, this, &GenericChatForm::onSearchUp);
|
||||||
@ -824,10 +823,7 @@ void GenericChatForm::onLoadHistory()
|
|||||||
if (dlg.exec()) {
|
if (dlg.exec()) {
|
||||||
QDateTime time = dlg.getFromDate();
|
QDateTime time = dlg.getFromDate();
|
||||||
auto idx = firstItemAfterDate(dlg.getFromDate().date(), chatLog);
|
auto idx = firstItemAfterDate(dlg.getFromDate().date(), chatLog);
|
||||||
auto end = ChatLogIdx(idx.get() + 100);
|
renderMessages(idx, chatLog.getNextIdx());
|
||||||
chatWidget->clear();
|
|
||||||
messages.clear();
|
|
||||||
renderMessages(idx, end);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1045,18 +1041,6 @@ void GenericChatForm::loadHistoryLower()
|
|||||||
renderMessages(begin, chatLog.getNextIdx());
|
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& prevLine, const ChatLine::Ptr& topLine)
|
void GenericChatForm::updateShowDateInfo(const ChatLine::Ptr& prevLine, const ChatLine::Ptr& topLine)
|
||||||
{
|
{
|
||||||
// If the dateInfo is visible we need to pretend the top line is the one
|
// If the dateInfo is visible we need to pretend the top line is the one
|
||||||
|
@ -120,7 +120,6 @@ protected slots:
|
|||||||
std::function<void(void)> onCompletion = std::function<void(void)>());
|
std::function<void(void)> onCompletion = std::function<void(void)>());
|
||||||
|
|
||||||
void loadHistoryLower();
|
void loadHistoryLower();
|
||||||
void loadHistoryUpper();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user