1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Fix another parsing bug, fix Action message bold

When you are the author of an 'action' message, it is not in bold, but if reloading history it is
This commit is contained in:
TheNain38 2015-10-04 14:29:48 +02:00 committed by TheNain38
parent f99c9f127d
commit 05d511bb66
2 changed files with 7 additions and 6 deletions

View File

@ -254,7 +254,7 @@ QDate GenericChatForm::getLatestDate() const
void GenericChatForm::setName(const QString &newName) void GenericChatForm::setName(const QString &newName)
{ {
nameLabel->setText(newName); nameLabel->setText(newName);
nameLabel->setToolTip(newName); // for overlength names nameLabel->setToolTip(newName.toHtmlEscaped()); // for overlength names
} }
void GenericChatForm::show(ContentLayout* contentLayout) void GenericChatForm::show(ContentLayout* contentLayout)
@ -294,17 +294,18 @@ void GenericChatForm::onChatContextMenuRequested(QPoint pos)
ChatMessage::Ptr GenericChatForm::addMessage(const ToxId& author, const QString &message, bool isAction, ChatMessage::Ptr GenericChatForm::addMessage(const ToxId& author, const QString &message, bool isAction,
const QDateTime &datetime, bool isSent) const QDateTime &datetime, bool isSent)
{ {
QString authorStr = author.isActiveProfile() ? Core::getInstance()->getUsername() : resolveToxId(author); bool authorIsActiveProfile = author.isActiveProfile();
QString authorStr = authorIsActiveProfile ? Core::getInstance()->getUsername() : resolveToxId(author);
ChatMessage::Ptr msg; ChatMessage::Ptr msg;
if (isAction) if (isAction)
{ {
msg = ChatMessage::createChatMessage(authorStr, message, ChatMessage::ACTION, false); msg = ChatMessage::createChatMessage(authorStr, message, ChatMessage::ACTION, authorIsActiveProfile);
previousId.clear(); previousId.clear();
} }
else else
{ {
msg = ChatMessage::createChatMessage(authorStr, message, ChatMessage::NORMAL, author.isActiveProfile()); msg = ChatMessage::createChatMessage(authorStr, message, ChatMessage::NORMAL, authorIsActiveProfile);
if ( (author == previousId) && (prevMsgDateTime.secsTo(QDateTime::currentDateTime()) < getChatLog()->repNameAfter) ) if ( (author == previousId) && (prevMsgDateTime.secsTo(QDateTime::currentDateTime()) < getChatLog()->repNameAfter) )
msg->hideSender(); msg->hideSender();

View File

@ -801,7 +801,7 @@ void Widget::setUsername(const QString& username)
else else
{ {
ui->nameLabel->setText(username); ui->nameLabel->setText(username);
ui->nameLabel->setToolTip(username); // for overlength names ui->nameLabel->setToolTip(username.toHtmlEscaped()); // for overlength names
} }
QString sanename = username; QString sanename = username;
@ -826,7 +826,7 @@ void Widget::setStatusMessage(const QString &statusMessage)
else else
{ {
ui->statusLabel->setText(statusMessage); ui->statusLabel->setText(statusMessage);
ui->statusLabel->setToolTip(statusMessage); // for overlength messsages ui->statusLabel->setToolTip(statusMessage.toHtmlEscaped()); // for overlength messsages
} }
} }