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

revert(chatlog): "prohibition to remove messages in group chat"

This reverts commit 5aeac56b76.
This commit is contained in:
Anthony Bilinski 2020-04-04 22:54:17 -07:00
parent db3eaa8872
commit af3e0183b6
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
6 changed files with 5 additions and 13 deletions

View File

@ -400,7 +400,7 @@ void ChatLog::insertChatlineAtBottom(const QList<ChatLine::Ptr>& newLines)
if (newLines.isEmpty())
return;
if (lines.size() + static_cast<int>(DEF_NUM_MSG_TO_LOAD) >= maxMessages) {
if (lines.size() + DEF_NUM_MSG_TO_LOAD >= maxMessages) {
removeFirsts(DEF_NUM_MSG_TO_LOAD);
}
@ -451,7 +451,7 @@ void ChatLog::insertChatlinesOnTop(const QList<ChatLine::Ptr>& newLines)
combLines.push_back(l);
}
if (lines.size() + static_cast<int>(DEF_NUM_MSG_TO_LOAD) >= maxMessages) {
if (lines.size() + DEF_NUM_MSG_TO_LOAD >= maxMessages) {
removeLasts(DEF_NUM_MSG_TO_LOAD);
}
@ -801,6 +801,7 @@ void ChatLog::checkVisibility(bool causedWheelEvent)
}
if (causedWheelEvent) {
qDebug() << "causedWheelEvent";
if (lowerBound != lines.cend() && lowerBound->get()->row == 0) {
emit loadHistoryLower();
} else if (upperBound == lines.cend()) {

View File

@ -36,8 +36,6 @@ public:
virtual void setEventFlag(bool flag) = 0;
virtual bool getEventFlag() const = 0;
virtual bool useHistory() const = 0; // TODO: remove after added history in group chat
signals:
void displayedNameChanged(const QString& newName);
};

View File

@ -192,9 +192,6 @@ Status::Status Friend::getStatus() const
return isNegotiating ? Status::Status::Negotiating : friendStatus;
}
bool Friend::useHistory() const
{
return true;
}
void Friend::setExtendedMessageSupport(bool supported)
@ -225,5 +222,4 @@ void Friend::onNegotiationComplete() {
if (Status::isOnline(getStatus())) {
emit onlineOfflineChanged(friendPk, true);
}
}
}

View File

@ -202,7 +202,4 @@ QString Group::getSelfName() const
return selfName;
}
bool Group::useHistory() const
{
return false;
}

View File

@ -61,7 +61,6 @@ public:
QString getSelfName() const;
bool useHistory() const final;
signals:
void titleChangedByUser(const QString& title);
void titleChanged(const QString& author, const QString& title);

View File

@ -734,6 +734,7 @@ void GenericChatForm::loadHistoryFrom(const QDateTime &time)
int add = DEF_NUM_MSG_TO_LOAD;
if (begin.get() + DEF_NUM_MSG_TO_LOAD > chatLog.getNextIdx().get()) {
auto aTest = chatLog.getNextIdx().get();
add = chatLog.getNextIdx().get() - begin.get();
}
auto end = ChatLogIdx(begin.get() + add);