Added ability to copy message ID with Shift + Right Click (#3481)

Co-authored-by: Paweł <zneix@zneix.eu>
Co-authored-by: Felanbird <41973452+Felanbird@users.noreply.github.com>
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
Infinitay 2022-01-16 08:35:00 -05:00 committed by GitHub
parent 687adf6b4e
commit 1d272c399b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 3 deletions

View file

@ -50,6 +50,7 @@
- Minor: Add feedback when writing a non-command message in the `/whispers` split. (#3439) - Minor: Add feedback when writing a non-command message in the `/whispers` split. (#3439)
- Minor: Opening streamlink through hotkeys and/or split header menu matches `/streamlink` command and shows feedback in chat as well. (#3510) - Minor: Opening streamlink through hotkeys and/or split header menu matches `/streamlink` command and shows feedback in chat as well. (#3510)
- Minor: Removed timestamp from AutoMod messages. (#3503) - Minor: Removed timestamp from AutoMod messages. (#3503)
- Minor: Added ability to copy message ID with `Shift + Right Click`. (#3481)
- Bugfix: Fix Split Input hotkeys not being available when input is hidden (#3362) - Bugfix: Fix Split Input hotkeys not being available when input is hidden (#3362)
- Bugfix: Fixed colored usernames sometimes not working. (#3170) - Bugfix: Fixed colored usernames sometimes not working. (#3170)
- Bugfix: Restored ability to send duplicate `/me` messages. (#3166) - Bugfix: Restored ability to send duplicate `/me` messages. (#3166)

View file

@ -1828,7 +1828,7 @@ void ChannelView::handleMouseClick(QMouseEvent *event,
} }
else else
{ {
this->addContextMenuItems(hoveredElement, layout); this->addContextMenuItems(hoveredElement, layout, event);
} }
} }
break; break;
@ -1845,7 +1845,8 @@ void ChannelView::handleMouseClick(QMouseEvent *event,
} }
void ChannelView::addContextMenuItems( void ChannelView::addContextMenuItems(
const MessageLayoutElement *hoveredElement, MessageLayoutPtr layout) const MessageLayoutElement *hoveredElement, MessageLayoutPtr layout,
QMouseEvent *event)
{ {
const auto &creator = hoveredElement->getCreator(); const auto &creator = hoveredElement->getCreator();
auto creatorFlags = creator.getFlags(); auto creatorFlags = creator.getFlags();
@ -1983,6 +1984,15 @@ void ChannelView::addContextMenuItems(
} }
} }
if (event->modifiers() == Qt::ShiftModifier &&
!layout->getMessage()->id.isEmpty())
{
menu->addAction("Copy message ID",
[messageID = layout->getMessage()->id] {
crossPlatformCopy(messageID);
});
}
menu->popup(QCursor::pos()); menu->popup(QCursor::pos());
menu->raise(); menu->raise();

View file

@ -160,7 +160,7 @@ private:
const MessageLayoutElement *hoverLayoutElement, const MessageLayoutElement *hoverLayoutElement,
MessageLayoutPtr layout); MessageLayoutPtr layout);
void addContextMenuItems(const MessageLayoutElement *hoveredElement, void addContextMenuItems(const MessageLayoutElement *hoveredElement,
MessageLayoutPtr layout); MessageLayoutPtr layout, QMouseEvent *event);
int getLayoutWidth() const; int getLayoutWidth() const;
void updatePauses(); void updatePauses();
void unpaused(); void unpaused();