mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
number of messages is more reliable then activities
This commit is contained in:
parent
fea3fa3ac7
commit
8788931f36
|
@ -118,6 +118,11 @@ void ChatAreaWidget::insertMessage(ChatAction *msgAction)
|
||||||
messages.append(msgAction);
|
messages.append(msgAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ChatAreaWidget::getNumberOfMessages()
|
||||||
|
{
|
||||||
|
return messages.size();
|
||||||
|
}
|
||||||
|
|
||||||
void ChatAreaWidget::onSliderRangeChanged()
|
void ChatAreaWidget::onSliderRangeChanged()
|
||||||
{
|
{
|
||||||
QScrollBar* scroll = verticalScrollBar();
|
QScrollBar* scroll = verticalScrollBar();
|
||||||
|
|
|
@ -33,6 +33,7 @@ public:
|
||||||
|
|
||||||
int nameColWidth() {return nameWidth;}
|
int nameColWidth() {return nameWidth;}
|
||||||
void setNameColWidth(int w);
|
void setNameColWidth(int w);
|
||||||
|
int getNumberOfMessages();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void onFileTranfertInterract(QString widgetName, QString buttonName);
|
void onFileTranfertInterract(QString widgetName, QString buttonName);
|
||||||
|
|
|
@ -127,6 +127,11 @@ GenericChatForm::GenericChatForm(QWidget *parent) :
|
||||||
connect(chatWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onChatContextMenuRequested(QPoint)));
|
connect(chatWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onChatContextMenuRequested(QPoint)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GenericChatForm::getNumberOfMessages()
|
||||||
|
{
|
||||||
|
return chatWidget->getNumberOfMessages();
|
||||||
|
}
|
||||||
|
|
||||||
void GenericChatForm::setName(const QString &newName)
|
void GenericChatForm::setName(const QString &newName)
|
||||||
{
|
{
|
||||||
nameLabel->setText(newName);
|
nameLabel->setText(newName);
|
||||||
|
|
|
@ -46,7 +46,8 @@ public:
|
||||||
virtual void show(Ui::MainWindow &ui);
|
virtual void show(Ui::MainWindow &ui);
|
||||||
void addMessage(QString author, QString message, bool isAction = false, QDateTime datetime=QDateTime::currentDateTime());
|
void addMessage(QString author, QString message, bool isAction = false, QDateTime datetime=QDateTime::currentDateTime());
|
||||||
void addSystemInfoMessage(const QString &message, const QString &type, const QDateTime &datetime=QDateTime::currentDateTime());
|
void addSystemInfoMessage(const QString &message, const QString &type, const QDateTime &datetime=QDateTime::currentDateTime());
|
||||||
|
int getNumberOfMessages();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sendMessage(int, QString);
|
void sendMessage(int, QString);
|
||||||
void sendAction(int, QString);
|
void sendAction(int, QString);
|
||||||
|
|
|
@ -550,9 +550,9 @@ void Widget::onFriendStatusChanged(int friendId, Status status)
|
||||||
default:
|
default:
|
||||||
fStatus = "online"; break;
|
fStatus = "online"; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//won't print the message if there were no messages before
|
//won't print the message if there were no messages before
|
||||||
if(f->chatForm->actions().size() != 0
|
if(f->chatForm->getNumberOfMessages() != 0
|
||||||
&& Settings::getInstance().getStatusChangeNotificationEnabled() == true)
|
&& Settings::getInstance().getStatusChangeNotificationEnabled() == true)
|
||||||
f->chatForm->addSystemInfoMessage(f->getName() + " has changed status to " + fStatus, "white");
|
f->chatForm->addSystemInfoMessage(f->getName() + " has changed status to " + fStatus, "white");
|
||||||
}
|
}
|
||||||
|
@ -568,10 +568,6 @@ void Widget::onFriendSignIn(int friendId, Status status)
|
||||||
f->friendStatus = status;
|
f->friendStatus = status;
|
||||||
f->widget->updateStatusLight();
|
f->widget->updateStatusLight();
|
||||||
|
|
||||||
//won't print the message if there were no messages before
|
|
||||||
if(f->chatForm->actions().size() != 0
|
|
||||||
&& Settings::getInstance().getSignInNotificationEnabled() == true)
|
|
||||||
f->chatForm->addSystemInfoMessage(f->getName() + " has became online", "white");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::onFriendStatusMessageChanged(int friendId, const QString& message)
|
void Widget::onFriendStatusMessageChanged(int friendId, const QString& message)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user