mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
revert(chatlog): "enable dynamic view range in chatlog with history disabled"
This reverts commit a7f3495956
.
This commit is contained in:
parent
9888bc2d80
commit
5da1e4b9a8
|
@ -52,8 +52,8 @@ T clamp(T x, T min, T max)
|
|||
return x;
|
||||
}
|
||||
|
||||
ChatLog::ChatLog(QWidget* parent)
|
||||
: QGraphicsView(parent)
|
||||
ChatLog::ChatLog(const bool canRemove, QWidget* parent)
|
||||
: QGraphicsView(parent), canRemove(canRemove)
|
||||
{
|
||||
// Create the scene
|
||||
busyScene = new QGraphicsScene(this);
|
||||
|
@ -394,7 +394,7 @@ void ChatLog::insertChatlineAtBottom(const QList<ChatLine::Ptr>& newLines)
|
|||
if (newLines.isEmpty())
|
||||
return;
|
||||
|
||||
if (lines.size() + DEF_NUM_MSG_TO_LOAD >= maxMessages) {
|
||||
if (canRemove && lines.size() + DEF_NUM_MSG_TO_LOAD >= maxMessages) {
|
||||
removeFirsts(DEF_NUM_MSG_TO_LOAD);
|
||||
}
|
||||
|
||||
|
@ -444,7 +444,7 @@ void ChatLog::insertChatlinesOnTop(const QList<ChatLine::Ptr>& newLines)
|
|||
combLines.push_back(l);
|
||||
}
|
||||
|
||||
if (lines.size() + DEF_NUM_MSG_TO_LOAD >= maxMessages) {
|
||||
if (canRemove && lines.size() + DEF_NUM_MSG_TO_LOAD >= maxMessages) {
|
||||
removeLasts(DEF_NUM_MSG_TO_LOAD);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ class ChatLog : public QGraphicsView
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ChatLog(QWidget* parent = nullptr);
|
||||
explicit ChatLog(const bool canRemove, QWidget* parent = nullptr);
|
||||
virtual ~ChatLog();
|
||||
|
||||
void insertChatlineAtBottom(ChatLine::Ptr l);
|
||||
|
@ -188,6 +188,7 @@ private:
|
|||
|
||||
int numRemove{0};
|
||||
const int maxMessages{300};
|
||||
bool canRemove;
|
||||
};
|
||||
|
||||
#endif // CHATLOG_H
|
||||
|
|
|
@ -259,7 +259,7 @@ GenericChatForm::GenericChatForm(const Contact* contact, IChatLog& chatLog,
|
|||
headWidget = new ChatFormHeader();
|
||||
searchForm = new SearchForm();
|
||||
dateInfo = new QLabel(this);
|
||||
chatWidget = new ChatLog(this);
|
||||
chatWidget = new ChatLog(contact->useHistory(), this);
|
||||
chatWidget->setBusyNotification(ChatMessage::createBusyNotification());
|
||||
searchForm->hide();
|
||||
dateInfo->setAlignment(Qt::AlignHCenter);
|
||||
|
|
Loading…
Reference in New Issue
Block a user