Click tag mentions
You can now click on a username in the main chat to add a "@username" tag to the chat. Makes communication with other users using tags faster.
This commit is contained in:
parent
9b7f488bd7
commit
45112e49b1
4 changed files with 14 additions and 4 deletions
|
@ -249,12 +249,15 @@ void ChatView::mousePressEvent(QMouseEvent *event)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case HoveredUser: {
|
case HoveredUser: {
|
||||||
if (event->button() == Qt::RightButton) {
|
if (event->button() != Qt::MidButton) {
|
||||||
const int delimiterIndex = hoveredContent.indexOf("_");
|
const int delimiterIndex = hoveredContent.indexOf("_");
|
||||||
UserLevelFlags userLevel(hoveredContent.left(delimiterIndex).toInt());
|
|
||||||
const QString userName = hoveredContent.mid(delimiterIndex + 1);
|
const QString userName = hoveredContent.mid(delimiterIndex + 1);
|
||||||
|
if (event->button() == Qt::RightButton) {
|
||||||
userContextMenu->showContextMenu(event->globalPos(), userName, userLevel);
|
UserLevelFlags userLevel(hoveredContent.left(delimiterIndex).toInt());
|
||||||
|
userContextMenu->showContextMenu(event->globalPos(), userName, userLevel);
|
||||||
|
}
|
||||||
|
else if (event->button() == Qt::LeftButton)
|
||||||
|
emit addMentionTag("@" + userName);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,7 @@ signals:
|
||||||
void cardNameHovered(QString cardName);
|
void cardNameHovered(QString cardName);
|
||||||
void showCardInfoPopup(QPoint pos, QString cardName);
|
void showCardInfoPopup(QPoint pos, QString cardName);
|
||||||
void deleteCardInfoPopup(QString cardName);
|
void deleteCardInfoPopup(QString cardName);
|
||||||
|
void addMentionTag(QString mentionTag);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -44,6 +44,7 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor, AbstractClient *_client, ServerI
|
||||||
connect(chatView, SIGNAL(openMessageDialog(QString, bool)), this, SIGNAL(openMessageDialog(QString, bool)));
|
connect(chatView, SIGNAL(openMessageDialog(QString, bool)), this, SIGNAL(openMessageDialog(QString, bool)));
|
||||||
connect(chatView, SIGNAL(showCardInfoPopup(QPoint, QString)), this, SLOT(showCardInfoPopup(QPoint, QString)));
|
connect(chatView, SIGNAL(showCardInfoPopup(QPoint, QString)), this, SLOT(showCardInfoPopup(QPoint, QString)));
|
||||||
connect(chatView, SIGNAL(deleteCardInfoPopup(QString)), this, SLOT(deleteCardInfoPopup(QString)));
|
connect(chatView, SIGNAL(deleteCardInfoPopup(QString)), this, SLOT(deleteCardInfoPopup(QString)));
|
||||||
|
connect(chatView, SIGNAL(addMentionTag(QString)), this, SLOT(addMentionTag(QString)));
|
||||||
sayLabel = new QLabel;
|
sayLabel = new QLabel;
|
||||||
sayEdit = new QLineEdit;
|
sayEdit = new QLineEdit;
|
||||||
sayLabel->setBuddy(sayEdit);
|
sayLabel->setBuddy(sayEdit);
|
||||||
|
@ -225,6 +226,10 @@ void TabRoom::processRoomSayEvent(const Event_RoomSay &event)
|
||||||
emit userEvent(false);
|
emit userEvent(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TabRoom::addMentionTag(QString mentionTag) {
|
||||||
|
sayEdit->insert(mentionTag + " ");
|
||||||
|
}
|
||||||
|
|
||||||
PendingCommand *TabRoom::prepareRoomCommand(const ::google::protobuf::Message &cmd)
|
PendingCommand *TabRoom::prepareRoomCommand(const ::google::protobuf::Message &cmd)
|
||||||
{
|
{
|
||||||
return client->prepareRoomCommand(cmd, roomId);
|
return client->prepareRoomCommand(cmd, roomId);
|
||||||
|
|
|
@ -56,6 +56,7 @@ private slots:
|
||||||
void actIgnoreUnregisteredUsers();
|
void actIgnoreUnregisteredUsers();
|
||||||
void actClearChat();
|
void actClearChat();
|
||||||
void ignoreUnregisteredUsersChanged();
|
void ignoreUnregisteredUsersChanged();
|
||||||
|
void addMentionTag(QString mentionTag);
|
||||||
|
|
||||||
void processListGamesEvent(const Event_ListGames &event);
|
void processListGamesEvent(const Event_ListGames &event);
|
||||||
void processJoinRoomEvent(const Event_JoinRoom &event);
|
void processJoinRoomEvent(const Event_JoinRoom &event);
|
||||||
|
|
Loading…
Reference in a new issue