mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Added mention of user by right-clicking on his nickname. (#589)
* Added mention of user by right-clicking on his nickname. * Removed possibility of choice. Always add @ to username.
This commit is contained in:
parent
d82c647edd
commit
c3793121cb
3 changed files with 16 additions and 1 deletions
|
@ -963,7 +963,15 @@ void ChannelView::handleMouseClick(QMouseEvent *event, const MessageLayoutElemen
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case Qt::RightButton: {
|
case Qt::RightButton: {
|
||||||
this->addContextMenuItems(hoveredElement, layout);
|
auto &link = hoveredElement->getLink();
|
||||||
|
if (link.type == Link::UserInfo) {
|
||||||
|
Split *split = dynamic_cast<Split *>(this->parentWidget());
|
||||||
|
if (split != nullptr) {
|
||||||
|
split->insertTextToInput("@" + link.value + ", ");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this->addContextMenuItems(hoveredElement, layout);
|
||||||
|
}
|
||||||
} break;
|
} break;
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
|
|
|
@ -227,6 +227,11 @@ bool Split::getModerationMode() const
|
||||||
return this->moderationMode_;
|
return this->moderationMode_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Split::insertTextToInput(const QString &text)
|
||||||
|
{
|
||||||
|
this->input_.insertText(text);
|
||||||
|
}
|
||||||
|
|
||||||
void Split::showChangeChannelPopup(const char *dialogTitle, bool empty,
|
void Split::showChangeChannelPopup(const char *dialogTitle, bool empty,
|
||||||
std::function<void(bool)> callback)
|
std::function<void(bool)> callback)
|
||||||
{
|
{
|
||||||
|
|
|
@ -60,6 +60,8 @@ public:
|
||||||
void setModerationMode(bool value);
|
void setModerationMode(bool value);
|
||||||
bool getModerationMode() const;
|
bool getModerationMode() const;
|
||||||
|
|
||||||
|
void insertTextToInput(const QString &text);
|
||||||
|
|
||||||
void showChangeChannelPopup(const char *dialogTitle, bool empty,
|
void showChangeChannelPopup(const char *dialogTitle, bool empty,
|
||||||
std::function<void(bool)> callback);
|
std::function<void(bool)> callback);
|
||||||
void giveFocus(Qt::FocusReason reason);
|
void giveFocus(Qt::FocusReason reason);
|
||||||
|
|
Loading…
Reference in a new issue