mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
revert(chatlog): "feat: load messages from the database before date"
This reverts commit fb2957c5ee
.
This commit is contained in:
parent
041b697e77
commit
00ab89c3ce
|
@ -668,7 +668,7 @@ void ChatLog::forceRelayout()
|
|||
startResizeWorker();
|
||||
}
|
||||
|
||||
void ChatLog::checkVisibility(bool causedByScroll)
|
||||
void ChatLog::checkVisibility()
|
||||
{
|
||||
if (lines.empty())
|
||||
return;
|
||||
|
@ -712,16 +712,12 @@ void ChatLog::checkVisibility(bool causedByScroll)
|
|||
if (!visibleLines.isEmpty()) {
|
||||
emit firstVisibleLineChanged(lastLineBeforeVisible, visibleLines.at(0));
|
||||
}
|
||||
|
||||
if (causedByScroll && lowerBound != lines.cend() && lowerBound->get()->row == 0) {
|
||||
emit loadHistoryLower();
|
||||
}
|
||||
}
|
||||
|
||||
void ChatLog::scrollContentsBy(int dx, int dy)
|
||||
{
|
||||
QGraphicsView::scrollContentsBy(dx, dy);
|
||||
checkVisibility(true);
|
||||
checkVisibility();
|
||||
}
|
||||
|
||||
void ChatLog::resizeEvent(QResizeEvent* ev)
|
||||
|
|
|
@ -66,7 +66,6 @@ signals:
|
|||
void selectionChanged();
|
||||
void workerTimeoutFinished();
|
||||
void firstVisibleLineChanged(const ChatLine::Ptr& prevLine, const ChatLine::Ptr& firstLine);
|
||||
void loadHistoryLower();
|
||||
|
||||
public slots:
|
||||
void forceRelayout();
|
||||
|
@ -90,7 +89,7 @@ protected:
|
|||
|
||||
void reposition(int start, int end, qreal deltaY);
|
||||
void updateSceneRect();
|
||||
void checkVisibility(bool causedByScroll = false);
|
||||
void checkVisibility();
|
||||
void scrollToBottom();
|
||||
void startResizeWorker();
|
||||
|
||||
|
|
|
@ -342,7 +342,6 @@ GenericChatForm::GenericChatForm(const Core& _core, const Contact* contact, ICha
|
|||
connect(chatWidget, &ChatLog::customContextMenuRequested, this,
|
||||
&GenericChatForm::onChatContextMenuRequested);
|
||||
connect(chatWidget, &ChatLog::firstVisibleLineChanged, this, &GenericChatForm::updateShowDateInfo);
|
||||
connect(chatWidget, &ChatLog::loadHistoryLower, this, &GenericChatForm::loadHistoryLower);
|
||||
|
||||
connect(searchForm, &SearchForm::searchInBegin, this, &GenericChatForm::searchInBegin);
|
||||
connect(searchForm, &SearchForm::searchUp, this, &GenericChatForm::onSearchUp);
|
||||
|
@ -1028,19 +1027,6 @@ void GenericChatForm::renderMessages(ChatLogIdx begin, ChatLogIdx end,
|
|||
}
|
||||
}
|
||||
|
||||
void GenericChatForm::loadHistoryLower()
|
||||
{
|
||||
auto begin = messages.begin()->first;
|
||||
|
||||
if (begin.get() > 100) {
|
||||
begin = ChatLogIdx(begin.get() - 100);
|
||||
} else {
|
||||
begin = ChatLogIdx(0);
|
||||
}
|
||||
|
||||
renderMessages(begin, chatLog.getNextIdx());
|
||||
}
|
||||
|
||||
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
|
||||
|
|
|
@ -119,8 +119,6 @@ protected slots:
|
|||
void renderMessages(ChatLogIdx begin, ChatLogIdx end,
|
||||
std::function<void(void)> onCompletion = std::function<void(void)>());
|
||||
|
||||
void loadHistoryLower();
|
||||
|
||||
private:
|
||||
void retranslateUi();
|
||||
void addSystemDateMessage(const QDate& date);
|
||||
|
|
Loading…
Reference in New Issue
Block a user