Added right-click on nickname to reply on whisper. (#680)

This commit is contained in:
23rd 2018-08-26 11:42:00 +03:00 committed by pajlada
parent 70199e00d2
commit ce155299e9
3 changed files with 13 additions and 5 deletions

View file

@ -13,6 +13,7 @@ public:
UserInfo,
UserTimeout,
UserBan,
UserWhisper,
InsertText,
ShowMessage,
UserAction,

View file

@ -438,7 +438,7 @@ void TwitchMessageBuilder::appendUsername()
this->emplace<TextElement>(usernameText, MessageElementFlag::Username,
this->usernameColor_,
FontStyle::ChatMediumBold)
->setLink({Link::UserInfo, this->message().displayName});
->setLink({Link::UserWhisper, this->message().displayName});
auto currentUser = app->accounts->twitch.getCurrent();

View file

@ -1033,12 +1033,18 @@ void ChannelView::handleMouseClick(QMouseEvent *event,
}
} break;
case Qt::RightButton: {
auto insertText = [=](QString text) {
if (auto split = dynamic_cast<Split *>(this->parentWidget())) {
split->insertTextToInput(text);
}
};
auto &link = hoveredElement->getLink();
if (link.type == Link::UserInfo) {
Split *split = dynamic_cast<Split *>(this->parentWidget());
if (split != nullptr) {
split->insertTextToInput("@" + link.value + ", ");
}
insertText("@" + link.value + ", ");
} else if (link.type == Link::UserWhisper) {
insertText("/w " + link.value + " ");
} else {
this->addContextMenuItems(hoveredElement, layout);
}
@ -1155,6 +1161,7 @@ void ChannelView::handleLinkClick(QMouseEvent *event, const Link &link,
}
switch (link.type) {
case Link::UserWhisper:
case Link::UserInfo: {
auto user = link.value;