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:
commit
2954ee3c95
|
@ -67,7 +67,7 @@ ChatMessage::Ptr ChatMessage::createChatMessage(const QString &sender, const QSt
|
||||||
|
|
||||||
// Note: Eliding cannot be enabled for RichText items. (QTBUG-17207)
|
// 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(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));
|
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())
|
if(!date.isNull())
|
||||||
|
|
|
@ -116,6 +116,8 @@ void ChatForm::onSendTriggered()
|
||||||
if (msg.isEmpty())
|
if (msg.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
msgEdit->setLastMessage(msg); //set last message only when sending it
|
||||||
|
|
||||||
bool isAction = msg.startsWith("/me ");
|
bool isAction = msg.startsWith("/me ");
|
||||||
if (isAction)
|
if (isAction)
|
||||||
msg = msg = msg.right(msg.length() - 4);
|
msg = msg = msg.right(msg.length() - 4);
|
||||||
|
@ -123,8 +125,6 @@ void ChatForm::onSendTriggered()
|
||||||
QList<CString> splittedMsg = Core::splitMessage(msg, TOX_MAX_MESSAGE_LENGTH);
|
QList<CString> splittedMsg = Core::splitMessage(msg, TOX_MAX_MESSAGE_LENGTH);
|
||||||
QDateTime timestamp = QDateTime::currentDateTime();
|
QDateTime timestamp = QDateTime::currentDateTime();
|
||||||
|
|
||||||
msgEdit->setLastMessage(msg); //set last message only when sending it
|
|
||||||
|
|
||||||
bool status = !Settings::getInstance().getFauxOfflineMessaging();
|
bool status = !Settings::getInstance().getFauxOfflineMessaging();
|
||||||
|
|
||||||
for (CString& c_msg : splittedMsg)
|
for (CString& c_msg : splittedMsg)
|
||||||
|
|
|
@ -116,7 +116,10 @@ void GroupChatForm::onSendTriggered()
|
||||||
}
|
}
|
||||||
else
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -737,7 +737,7 @@ void Widget::onFriendMessageReceived(int friendId, const QString& message, bool
|
||||||
QDateTime timestamp = QDateTime::currentDateTime();
|
QDateTime timestamp = QDateTime::currentDateTime();
|
||||||
f->getChatForm()->addMessage(f->getToxID(), message, isAction, timestamp, true);
|
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->getToxID().publicKey, timestamp, true);
|
||||||
|
|
||||||
f->setEventFlag(f->getFriendWidget() != activeChatroomWidget);
|
f->setEventFlag(f->getFriendWidget() != activeChatroomWidget);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user