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:
parent
3ac6b578df
commit
bd0ef5de82
|
@ -52,8 +52,8 @@ T clamp(T x, T min, T max)
|
|||
return x;
|
||||
}
|
||||
|
||||
ChatLog::ChatLog(const bool canRemove, QWidget* parent)
|
||||
: QGraphicsView(parent), canRemove(canRemove)
|
||||
ChatLog::ChatLog(QWidget* parent)
|
||||
: QGraphicsView(parent)
|
||||
{
|
||||
// Create the scene
|
||||
busyScene = new QGraphicsScene(this);
|
||||
|
@ -394,7 +394,7 @@ void ChatLog::insertChatlineAtBottom(const QList<ChatLine::Ptr>& newLines)
|
|||
if (newLines.isEmpty())
|
||||
return;
|
||||
|
||||
if (canRemove && lines.size() + DEF_NUM_MSG_TO_LOAD >= maxMessages) {
|
||||
if (lines.size() + DEF_NUM_MSG_TO_LOAD >= maxMessages) {
|
||||
removeFirsts(DEF_NUM_MSG_TO_LOAD);
|
||||
}
|
||||
|
||||
|
@ -445,7 +445,7 @@ void ChatLog::insertChatlinesOnTop(const QList<ChatLine::Ptr>& newLines)
|
|||
combLines.push_back(l);
|
||||
}
|
||||
|
||||
if (canRemove && lines.size() + DEF_NUM_MSG_TO_LOAD >= maxMessages) {
|
||||
if (lines.size() + DEF_NUM_MSG_TO_LOAD >= maxMessages) {
|
||||
removeLasts(DEF_NUM_MSG_TO_LOAD);
|
||||
}
|
||||
|
||||
|
@ -815,6 +815,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()) {
|
||||
|
|
|
@ -41,7 +41,7 @@ class ChatLog : public QGraphicsView
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ChatLog(const bool canRemove, QWidget* parent = nullptr);
|
||||
explicit ChatLog(QWidget* parent = nullptr);
|
||||
virtual ~ChatLog();
|
||||
|
||||
void insertChatlineAtBottom(ChatLine::Ptr l);
|
||||
|
@ -188,7 +188,6 @@ private:
|
|||
|
||||
int numRemove{0};
|
||||
const int maxMessages{300};
|
||||
bool canRemove;
|
||||
};
|
||||
|
||||
#endif // CHATLOG_H
|
||||
|
|
|
@ -37,8 +37,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);
|
||||
};
|
||||
|
|
|
@ -168,8 +168,3 @@ Status::Status Friend::getStatus() const
|
|||
{
|
||||
return friendStatus;
|
||||
}
|
||||
|
||||
bool Friend::useHistory() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -53,7 +53,6 @@ public:
|
|||
|
||||
void setStatus(Status::Status s);
|
||||
Status::Status getStatus() const;
|
||||
bool useHistory() const override final;
|
||||
|
||||
signals:
|
||||
void nameChanged(const ToxPk& friendId, const QString& name);
|
||||
|
|
|
@ -205,11 +205,6 @@ QString Group::getSelfName() const
|
|||
return selfName;
|
||||
}
|
||||
|
||||
bool Group::useHistory() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void Group::stopAudioOfDepartedPeers(const ToxPk& peerPk)
|
||||
{
|
||||
if (avGroupchat) {
|
||||
|
|
|
@ -61,8 +61,6 @@ public:
|
|||
void setSelfName(const QString& name);
|
||||
QString getSelfName() const;
|
||||
|
||||
bool useHistory() const override final;
|
||||
|
||||
signals:
|
||||
void titleChangedByUser(const QString& title);
|
||||
void titleChanged(const QString& author, const QString& title);
|
||||
|
|
|
@ -259,7 +259,7 @@ GenericChatForm::GenericChatForm(const Contact* contact, IChatLog& chatLog,
|
|||
headWidget = new ChatFormHeader();
|
||||
searchForm = new SearchForm();
|
||||
dateInfo = new QLabel(this);
|
||||
chatWidget = new ChatLog(contact->useHistory(), this);
|
||||
chatWidget = new ChatLog(this);
|
||||
chatWidget->setBusyNotification(ChatMessage::createBusyNotification());
|
||||
searchForm->hide();
|
||||
dateInfo->setAlignment(Qt::AlignHCenter);
|
||||
|
@ -698,6 +698,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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user