mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
added sending actions, and tested both ways
This commit is contained in:
parent
5f106ab618
commit
cfa39460bf
|
@ -10,7 +10,7 @@ div.message {
|
|||
}
|
||||
|
||||
div.action {
|
||||
color: @blue;
|
||||
color: #1818FF;
|
||||
font: @big;
|
||||
}
|
||||
|
||||
|
|
|
@ -86,9 +86,18 @@ void ChatForm::onSendTriggered()
|
|||
if (msg.isEmpty())
|
||||
return;
|
||||
QString name = Widget::getInstance()->getUsername();
|
||||
if (msg.startsWith("/me "))
|
||||
{
|
||||
msg = msg.right(msg.length() - 4);
|
||||
addMessage(name, msg, true);
|
||||
emit sendAction(f->friendId, msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
addMessage(name, msg, false);
|
||||
emit sendMessage(f->friendId, msg);
|
||||
}
|
||||
msgEdit->clear();
|
||||
addMessage(name, msg);
|
||||
emit sendMessage(f->friendId, msg);
|
||||
}
|
||||
|
||||
void ChatForm::onAttachClicked()
|
||||
|
|
|
@ -173,7 +173,11 @@ void GenericChatForm::addMessage(QString author, QString message, bool isAction,
|
|||
bool isMe = (author == Widget::getInstance()->getUsername());
|
||||
|
||||
if (isAction)
|
||||
{
|
||||
chatWidget->insertMessage(new ActionAction (getElidedName(author), message, date, isMe));
|
||||
previousName = ""; // next msg has a name regardless
|
||||
return;
|
||||
}
|
||||
else if (previousName == author)
|
||||
chatWidget->insertMessage(new MessageAction("", message, date, isMe));
|
||||
else
|
||||
|
|
|
@ -49,6 +49,7 @@ public:
|
|||
|
||||
signals:
|
||||
void sendMessage(int, QString);
|
||||
void sendAction(int, QString);
|
||||
|
||||
public slots:
|
||||
void focusInput();
|
||||
|
|
|
@ -455,6 +455,7 @@ void Widget::addFriend(int friendId, const QString &userId)
|
|||
connect(newfriend->widget, SIGNAL(copyFriendIdToClipboard(int)), this, SLOT(copyFriendIdToClipboard(int)));
|
||||
connect(newfriend->widget, SIGNAL(chatroomWidgetClicked(GenericChatroomWidget*)), newfriend->chatForm, SLOT(focusInput()));
|
||||
connect(newfriend->chatForm, SIGNAL(sendMessage(int,QString)), core, SLOT(sendMessage(int,QString)));
|
||||
connect(newfriend->chatForm, &GenericChatForm::sendAction, core, &Core::sendAction);
|
||||
connect(newfriend->chatForm, SIGNAL(sendFile(int32_t, QString, QString, long long)), core, SLOT(sendFile(int32_t, QString, QString, long long)));
|
||||
connect(newfriend->chatForm, SIGNAL(answerCall(int)), core, SLOT(answerCall(int)));
|
||||
connect(newfriend->chatForm, SIGNAL(hangupCall(int)), core, SLOT(hangupCall(int)));
|
||||
|
|
Loading…
Reference in New Issue
Block a user