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

Merge branch 'pr1496' into back_in_the_game

This commit is contained in:
tux3 2015-04-24 22:28:10 +02:00
commit 2954ee3c95
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
4 changed files with 36 additions and 33 deletions

View File

@ -67,7 +67,7 @@ ChatMessage::Ptr ChatMessage::createChatMessage(const QString &sender, const QSt
// Note: Eliding cannot be enabled for RichText items. (QTBUG-17207)
msg->addColumn(new Text(senderText, isMe ? Style::getFont(Style::BigBold) : Style::getFont(Style::Big), true, sender, type == ACTION ? actionColor : Qt::black), ColumnFormat(NAME_COL_WIDTH, ColumnFormat::FixedSize, ColumnFormat::Right));
msg->addColumn(new Text(text, Style::getFont(Style::Big), false, type == ACTION ? QString("*%1 %2*").arg(sender, rawMessage) : rawMessage), ColumnFormat(1.0, ColumnFormat::VariableSize));
msg->addColumn(new Text(text, Style::getFont(Style::Big), false, type == (ACTION && isMe) ? QString("%1 %2").arg(sender, rawMessage) : rawMessage), ColumnFormat(1.0, ColumnFormat::VariableSize));
msg->addColumn(new Spinner(":/ui/chatArea/spinner.svg", QSize(16, 16), 360.0/1.6), ColumnFormat(TIME_COL_WIDTH, ColumnFormat::FixedSize, ColumnFormat::Right));
if(!date.isNull())

View File

@ -116,6 +116,8 @@ void ChatForm::onSendTriggered()
if (msg.isEmpty())
return;
msgEdit->setLastMessage(msg); //set last message only when sending it
bool isAction = msg.startsWith("/me ");
if (isAction)
msg = msg = msg.right(msg.length() - 4);
@ -123,8 +125,6 @@ void ChatForm::onSendTriggered()
QList<CString> splittedMsg = Core::splitMessage(msg, TOX_MAX_MESSAGE_LENGTH);
QDateTime timestamp = QDateTime::currentDateTime();
msgEdit->setLastMessage(msg); //set last message only when sending it
bool status = !Settings::getInstance().getFauxOfflineMessaging();
for (CString& c_msg : splittedMsg)

View File

@ -116,7 +116,10 @@ void GroupChatForm::onSendTriggered()
}
else
{
addSelfMessage(msg, msg.startsWith("/me "), QDateTime::currentDateTime(), true);
if (msg.startsWith("/me "))
addSelfMessage(msg.right(msg.length() - 4), true, QDateTime::currentDateTime(), true);
else
addSelfMessage(msg, false, QDateTime::currentDateTime(), true);
}
}

View File

@ -737,7 +737,7 @@ void Widget::onFriendMessageReceived(int friendId, const QString& message, bool
QDateTime timestamp = QDateTime::currentDateTime();
f->getChatForm()->addMessage(f->getToxID(), message, isAction, timestamp, true);
HistoryKeeper::getInstance()->addChatEntry(f->getToxID().publicKey, isAction ? "/me " + message : message,
HistoryKeeper::getInstance()->addChatEntry(f->getToxID().publicKey, isAction ? "/me " + f->getDisplayedName() + " " + message : message,
f->getToxID().publicKey, timestamp, true);
f->setEventFlag(f->getFriendWidget() != activeChatroomWidget);