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,
|
UserInfo,
|
||||||
UserTimeout,
|
UserTimeout,
|
||||||
UserBan,
|
UserBan,
|
||||||
|
UserWhisper,
|
||||||
InsertText,
|
InsertText,
|
||||||
ShowMessage,
|
ShowMessage,
|
||||||
UserAction,
|
UserAction,
|
||||||
|
|
|
@ -438,7 +438,7 @@ void TwitchMessageBuilder::appendUsername()
|
||||||
this->emplace<TextElement>(usernameText, MessageElementFlag::Username,
|
this->emplace<TextElement>(usernameText, MessageElementFlag::Username,
|
||||||
this->usernameColor_,
|
this->usernameColor_,
|
||||||
FontStyle::ChatMediumBold)
|
FontStyle::ChatMediumBold)
|
||||||
->setLink({Link::UserInfo, this->message().displayName});
|
->setLink({Link::UserWhisper, this->message().displayName});
|
||||||
|
|
||||||
auto currentUser = app->accounts->twitch.getCurrent();
|
auto currentUser = app->accounts->twitch.getCurrent();
|
||||||
|
|
||||||
|
|
|
@ -1033,12 +1033,18 @@ void ChannelView::handleMouseClick(QMouseEvent *event,
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case Qt::RightButton: {
|
case Qt::RightButton: {
|
||||||
|
|
||||||
|
auto insertText = [=](QString text) {
|
||||||
|
if (auto split = dynamic_cast<Split *>(this->parentWidget())) {
|
||||||
|
split->insertTextToInput(text);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
auto &link = hoveredElement->getLink();
|
auto &link = hoveredElement->getLink();
|
||||||
if (link.type == Link::UserInfo) {
|
if (link.type == Link::UserInfo) {
|
||||||
Split *split = dynamic_cast<Split *>(this->parentWidget());
|
insertText("@" + link.value + ", ");
|
||||||
if (split != nullptr) {
|
} else if (link.type == Link::UserWhisper) {
|
||||||
split->insertTextToInput("@" + link.value + ", ");
|
insertText("/w " + link.value + " ");
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
this->addContextMenuItems(hoveredElement, layout);
|
this->addContextMenuItems(hoveredElement, layout);
|
||||||
}
|
}
|
||||||
|
@ -1155,6 +1161,7 @@ void ChannelView::handleLinkClick(QMouseEvent *event, const Link &link,
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (link.type) {
|
switch (link.type) {
|
||||||
|
case Link::UserWhisper:
|
||||||
case Link::UserInfo: {
|
case Link::UserInfo: {
|
||||||
auto user = link.value;
|
auto user = link.value;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue