Add accelerators to the right click menu for messages (#4705)

This commit is contained in:
Mm2PL 2023-07-22 12:54:48 +02:00 committed by GitHub
parent 7fd01ac575
commit ae8b2adcdd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 22 deletions

View file

@ -10,6 +10,7 @@
- Minor: Added setting to only show tabs with live channels (default toggle hotkey: Ctrl+Shift+L). (#4358)
- Minor: Added option to subscribe to and unsubscribe from reply threads. (#4680)
- Minor: Added a message for when Chatterino joins a channel (#4616)
- Minor: Add accelerators to the right click menu for messages (#4705)
- Minor: Add pin action to usercards and reply threads. (#4692)
- Minor: Stream status requests are now batched. (#4713)
- Bugfix: Fixed generation of crashdumps by the browser-extension process when the browser was closed. (#4667)

View file

@ -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);