mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge branch 'pr1470'
This commit is contained in:
commit
39fd870ef0
|
@ -58,6 +58,8 @@ public:
|
||||||
|
|
||||||
ChatLine::Ptr getTypingNotification() const;
|
ChatLine::Ptr getTypingNotification() const;
|
||||||
QVector<ChatLine::Ptr> getLines();
|
QVector<ChatLine::Ptr> getLines();
|
||||||
|
// repetition interval sender name (sec)
|
||||||
|
const uint repNameAfter = 5*60;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void selectionChanged();
|
void selectionChanged();
|
||||||
|
@ -142,6 +144,8 @@ private:
|
||||||
QMargins margins = QMargins(10,10,10,10);
|
QMargins margins = QMargins(10,10,10,10);
|
||||||
qreal lineSpacing = 5.0f;
|
qreal lineSpacing = 5.0f;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CHATLOG_H
|
#endif // CHATLOG_H
|
||||||
|
|
|
@ -845,10 +845,11 @@ void ChatForm::loadHistory(QDateTime since, bool processUndelivered)
|
||||||
authorId.isMine(),
|
authorId.isMine(),
|
||||||
QDateTime());
|
QDateTime());
|
||||||
|
|
||||||
if(!isAction && prevId == authorId)
|
if(!isAction && (prevId == authorId) && (prevMsgDateTime.secsTo(msgDateTime) < getChatLog()->repNameAfter) )
|
||||||
msg->hideSender();
|
msg->hideSender();
|
||||||
|
|
||||||
prevId = authorId;
|
prevId = authorId;
|
||||||
|
prevMsgDateTime = msgDateTime;
|
||||||
|
|
||||||
if (it.isSent || !authorId.isMine())
|
if (it.isSent || !authorId.isMine())
|
||||||
{
|
{
|
||||||
|
|
|
@ -221,10 +221,11 @@ ChatMessage::Ptr GenericChatForm::addMessage(const ToxID& author, const QString
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg = ChatMessage::createChatMessage(authorStr, message, ChatMessage::NORMAL, author.isMine());
|
msg = ChatMessage::createChatMessage(authorStr, message, ChatMessage::NORMAL, author.isMine());
|
||||||
if(author == previousId)
|
if ( (author == previousId) && (prevMsgDateTime.secsTo(QDateTime::currentDateTime()) < getChatLog()->repNameAfter) )
|
||||||
msg->hideSender();
|
msg->hideSender();
|
||||||
|
|
||||||
previousId = author;
|
previousId = author;
|
||||||
|
prevMsgDateTime = QDateTime::currentDateTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
insertChatMessage(msg);
|
insertChatMessage(msg);
|
||||||
|
@ -246,10 +247,11 @@ void GenericChatForm::addAlertMessage(const ToxID &author, QString message, QDat
|
||||||
ChatMessage::Ptr msg = ChatMessage::createChatMessage(authorStr, message, ChatMessage::ALERT, author.isMine(), datetime);
|
ChatMessage::Ptr msg = ChatMessage::createChatMessage(authorStr, message, ChatMessage::ALERT, author.isMine(), datetime);
|
||||||
insertChatMessage(msg);
|
insertChatMessage(msg);
|
||||||
|
|
||||||
if(author == previousId)
|
if( (author == previousId) && (prevMsgDateTime.secsTo(QDateTime::currentDateTime()) < getChatLog()->repNameAfter) )
|
||||||
msg->hideSender();
|
msg->hideSender();
|
||||||
|
|
||||||
previousId = author;
|
previousId = author;
|
||||||
|
prevMsgDateTime = QDateTime::currentDateTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericChatForm::onEmoteButtonClicked()
|
void GenericChatForm::onEmoteButtonClicked()
|
||||||
|
@ -372,3 +374,5 @@ void GenericChatForm::insertChatMessage(ChatMessage::Ptr msg)
|
||||||
{
|
{
|
||||||
chatWidget->insertChatlineAtBottom(std::dynamic_pointer_cast<ChatLine>(msg));
|
chatWidget->insertChatlineAtBottom(std::dynamic_pointer_cast<ChatLine>(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,7 @@ protected:
|
||||||
void insertChatMessage(ChatMessage::Ptr msg);
|
void insertChatMessage(ChatMessage::Ptr msg);
|
||||||
|
|
||||||
ToxID previousId;
|
ToxID previousId;
|
||||||
|
QDateTime prevMsgDateTime;
|
||||||
Widget *parent;
|
Widget *parent;
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
int curRow;
|
int curRow;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user