Add accelerators to the right click menu for messages (#4705)
This commit is contained in:
@@ -71,11 +71,11 @@ namespace {
|
||||
void addEmoteContextMenuItems(const Emote &emote,
|
||||
MessageElementFlags creatorFlags, QMenu &menu)
|
||||
{
|
||||
auto openAction = menu.addAction("Open");
|
||||
auto *openAction = menu.addAction("&Open");
|
||||
auto openMenu = new QMenu;
|
||||
openAction->setMenu(openMenu);
|
||||
|
||||
auto copyAction = menu.addAction("Copy");
|
||||
auto *copyAction = menu.addAction("&Copy");
|
||||
auto copyMenu = new QMenu;
|
||||
copyAction->setMenu(copyMenu);
|
||||
|
||||
@@ -89,12 +89,12 @@ namespace {
|
||||
auto addImageLink = [&](const ImagePtr &image, char scale) {
|
||||
if (!image->isEmpty())
|
||||
{
|
||||
copyMenu->addAction(QString(scale) + "x link",
|
||||
copyMenu->addAction("&" + QString(scale) + "x link",
|
||||
[url = image->url()] {
|
||||
crossPlatformCopy(url.string);
|
||||
});
|
||||
openMenu->addAction(
|
||||
QString(scale) + "x link", [url = image->url()] {
|
||||
"&" + QString(scale) + "x link", [url = image->url()] {
|
||||
QDesktopServices::openUrl(QUrl(url.string));
|
||||
});
|
||||
}
|
||||
@@ -109,11 +109,11 @@ namespace {
|
||||
copyMenu->addSeparator();
|
||||
openMenu->addSeparator();
|
||||
|
||||
copyMenu->addAction("Copy " + name + " emote link",
|
||||
copyMenu->addAction("Copy " + name + " &emote link",
|
||||
[url = emote.homePage] {
|
||||
crossPlatformCopy(url.string);
|
||||
});
|
||||
openMenu->addAction("Open " + name + " emote link",
|
||||
openMenu->addAction("Open " + name + " &emote link",
|
||||
[url = emote.homePage] {
|
||||
QDesktopServices::openUrl(QUrl(url.string));
|
||||
});
|
||||
@@ -2292,17 +2292,17 @@ void ChannelView::addLinkContextMenuItems(
|
||||
QString url = link.value;
|
||||
|
||||
// open link
|
||||
menu.addAction("Open link", [url] {
|
||||
menu.addAction("&Open link", [url] {
|
||||
QDesktopServices::openUrl(QUrl(url));
|
||||
});
|
||||
// open link default
|
||||
if (supportsIncognitoLinks())
|
||||
{
|
||||
menu.addAction("Open link incognito", [url] {
|
||||
menu.addAction("Open link &incognito", [url] {
|
||||
openLinkIncognito(url);
|
||||
});
|
||||
}
|
||||
menu.addAction("Copy link", [url] {
|
||||
menu.addAction("&Copy link", [url] {
|
||||
crossPlatformCopy(url);
|
||||
});
|
||||
|
||||
@@ -2315,12 +2315,12 @@ void ChannelView::addMessageContextMenuItems(
|
||||
// Copy actions
|
||||
if (!this->selection_.isEmpty())
|
||||
{
|
||||
menu.addAction("Copy selection", [this] {
|
||||
menu.addAction("&Copy selection", [this] {
|
||||
crossPlatformCopy(this->getSelectedText());
|
||||
});
|
||||
}
|
||||
|
||||
menu.addAction("Copy message", [layout] {
|
||||
menu.addAction("Copy &message", [layout] {
|
||||
QString copyString;
|
||||
layout->addSelectionText(copyString, 0, INT_MAX,
|
||||
CopyMode::OnlyTextAndEmotes);
|
||||
@@ -2328,7 +2328,7 @@ void ChannelView::addMessageContextMenuItems(
|
||||
crossPlatformCopy(copyString);
|
||||
});
|
||||
|
||||
menu.addAction("Copy full message", [layout] {
|
||||
menu.addAction("Copy &full message", [layout] {
|
||||
QString copyString;
|
||||
layout->addSelectionText(copyString, 0, INT_MAX,
|
||||
CopyMode::EverythingButReplies);
|
||||
@@ -2340,13 +2340,13 @@ void ChannelView::addMessageContextMenuItems(
|
||||
if (this->canReplyToMessages() && layout->isReplyable())
|
||||
{
|
||||
const auto &messagePtr = layout->getMessagePtr();
|
||||
menu.addAction("Reply to message", [this, &messagePtr] {
|
||||
menu.addAction("&Reply to message", [this, &messagePtr] {
|
||||
this->setInputReply(messagePtr);
|
||||
});
|
||||
|
||||
if (messagePtr->replyThread != nullptr)
|
||||
{
|
||||
menu.addAction("View thread", [this, &messagePtr] {
|
||||
menu.addAction("View &thread", [this, &messagePtr] {
|
||||
this->showReplyThreadPopup(messagePtr);
|
||||
});
|
||||
}
|
||||
@@ -2361,8 +2361,8 @@ void ChannelView::addMessageContextMenuItems(
|
||||
if (isSearch || isMentions || isReplyOrUserCard)
|
||||
{
|
||||
const auto &messagePtr = layout->getMessagePtr();
|
||||
menu.addAction("Go to message", [this, &messagePtr, isSearch,
|
||||
isMentions, isReplyOrUserCard] {
|
||||
menu.addAction("&Go to message", [this, &messagePtr, isSearch,
|
||||
isMentions, isReplyOrUserCard] {
|
||||
if (isSearch)
|
||||
{
|
||||
if (const auto &search =
|
||||
@@ -2437,21 +2437,21 @@ void ChannelView::addTwitchLinkContextMenuItems(
|
||||
if (!twitchUsername.isEmpty() && !ignoredUsernames.contains(twitchUsername))
|
||||
{
|
||||
menu.addSeparator();
|
||||
menu.addAction("Open in new split", [twitchUsername, this] {
|
||||
menu.addAction("&Open in new split", [twitchUsername, this] {
|
||||
this->openChannelIn.invoke(twitchUsername,
|
||||
FromTwitchLinkOpenChannelIn::Split);
|
||||
});
|
||||
menu.addAction("Open in new tab", [twitchUsername, this] {
|
||||
menu.addAction("Open in new &tab", [twitchUsername, this] {
|
||||
this->openChannelIn.invoke(twitchUsername,
|
||||
FromTwitchLinkOpenChannelIn::Tab);
|
||||
});
|
||||
|
||||
menu.addSeparator();
|
||||
menu.addAction("Open player in browser", [twitchUsername, this] {
|
||||
menu.addAction("Open player in &browser", [twitchUsername, this] {
|
||||
this->openChannelIn.invoke(
|
||||
twitchUsername, FromTwitchLinkOpenChannelIn::BrowserPlayer);
|
||||
});
|
||||
menu.addAction("Open in streamlink", [twitchUsername, this] {
|
||||
menu.addAction("Open in &streamlink", [twitchUsername, this] {
|
||||
this->openChannelIn.invoke(twitchUsername,
|
||||
FromTwitchLinkOpenChannelIn::Streamlink);
|
||||
});
|
||||
@@ -2475,7 +2475,7 @@ void ChannelView::addHiddenContextMenuItems(
|
||||
|
||||
if (!layout->getMessage()->id.isEmpty())
|
||||
{
|
||||
menu.addAction("Copy message ID",
|
||||
menu.addAction("Copy message &ID",
|
||||
[messageID = layout->getMessage()->id] {
|
||||
crossPlatformCopy(messageID);
|
||||
});
|
||||
@@ -2503,7 +2503,7 @@ void ChannelView::addCommandExecutionContextMenuItems(
|
||||
}
|
||||
|
||||
menu.addSeparator();
|
||||
auto executeAction = menu.addAction("Execute command");
|
||||
auto *executeAction = menu.addAction("&Execute command");
|
||||
auto cmdMenu = new QMenu;
|
||||
executeAction->setMenu(cmdMenu);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user