mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Added right-click on nickname to reply on whisper. (#680)
This commit is contained in:
parent
70199e00d2
commit
ce155299e9
3 changed files with 13 additions and 5 deletions
|
@ -13,6 +13,7 @@ public:
|
|||
UserInfo,
|
||||
UserTimeout,
|
||||
UserBan,
|
||||
UserWhisper,
|
||||
InsertText,
|
||||
ShowMessage,
|
||||
UserAction,
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue