mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Fix #671
This commit is contained in:
parent
1c952f280a
commit
e1b95105bc
@ -28,6 +28,7 @@ ChatAreaWidget::ChatAreaWidget(QWidget *parent)
|
||||
: QTextBrowser(parent)
|
||||
, tableFrmt(nullptr)
|
||||
, nameWidth(75)
|
||||
, empty{true}
|
||||
{
|
||||
setReadOnly(true);
|
||||
viewport()->setCursor(Qt::ArrowCursor);
|
||||
@ -114,11 +115,13 @@ void ChatAreaWidget::insertMessage(ChatActionPtr msgAction, QTextCursor::MoveOpe
|
||||
|
||||
if (msgAction->isInteractive())
|
||||
messages.append(msgAction);
|
||||
|
||||
empty = false;
|
||||
}
|
||||
|
||||
int ChatAreaWidget::getNumberOfMessages()
|
||||
bool ChatAreaWidget::isEmpty()
|
||||
{
|
||||
return messages.size();
|
||||
return empty;
|
||||
}
|
||||
|
||||
void ChatAreaWidget::onSliderRangeChanged()
|
||||
@ -179,6 +182,7 @@ void ChatAreaWidget::clearChatArea()
|
||||
}
|
||||
messages.clear();
|
||||
this->clear();
|
||||
empty = true;
|
||||
|
||||
for (ChatActionPtr message : newMsgs)
|
||||
{
|
||||
@ -194,4 +198,6 @@ void ChatAreaWidget::insertMessagesTop(QList<ChatActionPtr> &list)
|
||||
{
|
||||
insertMessage(it, QTextCursor::Start);
|
||||
}
|
||||
|
||||
empty = false;
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
|
||||
int nameColWidth() {return nameWidth;}
|
||||
void setNameColWidth(int w);
|
||||
int getNumberOfMessages();
|
||||
bool isEmpty();
|
||||
|
||||
public slots:
|
||||
void clearChatArea();
|
||||
@ -59,6 +59,7 @@ private:
|
||||
int sliderPosition;
|
||||
int nameWidth;
|
||||
QTextBlockFormat nameFormat, dateFormat;
|
||||
bool empty;
|
||||
};
|
||||
|
||||
#endif // CHATAREAWIDGET_H
|
||||
|
@ -34,6 +34,8 @@
|
||||
#include "src/friendlist.h"
|
||||
#include "src/friend.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
GenericChatForm::GenericChatForm(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
earliestMessage(nullptr)
|
||||
@ -151,9 +153,9 @@ GenericChatForm::GenericChatForm(QWidget *parent) :
|
||||
headWidget->setStyleSheet(Style::getStylesheet(":/ui/chatArea/chatHead.css"));
|
||||
}
|
||||
|
||||
int GenericChatForm::getNumberOfMessages()
|
||||
bool GenericChatForm::isEmpty()
|
||||
{
|
||||
return chatWidget->getNumberOfMessages();
|
||||
return chatWidget->isEmpty();
|
||||
}
|
||||
|
||||
void GenericChatForm::setName(const QString &newName)
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
void addSystemInfoMessage(const QString &message, const QString &type, const QDateTime &datetime);
|
||||
void addAlertMessage(const QString& author, QString message, QDateTime datetime); ///< Deprecated
|
||||
void addAlertMessage(const ToxID& author, QString message, QDateTime datetime);
|
||||
int getNumberOfMessages();
|
||||
bool isEmpty();
|
||||
|
||||
signals:
|
||||
void sendMessage(int, QString);
|
||||
|
@ -665,7 +665,7 @@ void Widget::onFriendStatusChanged(int friendId, Status status)
|
||||
f->getFriendWidget()->updateStatusLight();
|
||||
|
||||
//won't print the message if there were no messages before
|
||||
if(f->getChatForm()->getNumberOfMessages() != 0
|
||||
if(!f->getChatForm()->isEmpty()
|
||||
&& Settings::getInstance().getStatusChangeNotificationEnabled() == true)
|
||||
{
|
||||
QString fStatus = "";
|
||||
|
Loading…
x
Reference in New Issue
Block a user