From ad8246647f28a0b43908caeab36def429b20c0b4 Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Sun, 13 Feb 2022 01:37:14 +0000 Subject: [PATCH] Add context menu option to open the user's channel from a usercard (#3486) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Paweł --- CHANGELOG.md | 1 + src/widgets/dialogs/UserInfoPopup.cpp | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31293fdae..f61b4b430 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,7 @@ - Minor: Messages can now be highlighted by subscriber or founder badges. (#3445) - Minor: User timeout buttons can now be triggered using hotkeys. (#3483) - Minor: Add workaround for multipart emoji as described in [the RFC](https://mm2pl.github.io/emoji_rfc.pdf). (#3469) +- Minor: Added a way to open channel popup by right-clicking the avatar in a usercard. (#3486) - Minor: Add feedback when using the whisper command `/w` incorrectly. (#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) diff --git a/src/widgets/dialogs/UserInfoPopup.cpp b/src/widgets/dialogs/UserInfoPopup.cpp index 0e8c4a3e3..91d75e571 100644 --- a/src/widgets/dialogs/UserInfoPopup.cpp +++ b/src/widgets/dialogs/UserInfoPopup.cpp @@ -11,11 +11,13 @@ #include "messages/MessageBuilder.hpp" #include "providers/IvrApi.hpp" #include "providers/twitch/TwitchChannel.hpp" +#include "providers/twitch/TwitchIrcServer.hpp" #include "providers/twitch/api/Helix.hpp" #include "providers/twitch/api/Kraken.hpp" #include "singletons/Resources.hpp" #include "singletons/Settings.hpp" #include "singletons/Theme.hpp" +#include "singletons/WindowManager.hpp" #include "util/Clipboard.hpp" #include "util/Helpers.hpp" #include "util/LayoutCreator.hpp" @@ -23,9 +25,11 @@ #include "util/StreamerMode.hpp" #include "widgets/Label.hpp" #include "widgets/Scrollbar.hpp" +#include "widgets/Window.hpp" #include "widgets/helper/ChannelView.hpp" #include "widgets/helper/EffectLabel.hpp" #include "widgets/helper/Line.hpp" +#include "widgets/splits/Split.hpp" #include #include @@ -287,6 +291,21 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, QWidget *parent) crossPlatformCopy(avatarUrl); }); + // we need to assign login name for msvc compilation + auto loginName = this->userName_.toLower(); + menu->addAction( + "Open channel in a new popup window", this, + [loginName] { + auto app = getApp(); + auto &window = app->windows->createWindow( + WindowType::Popup, true); + auto split = window.getNotebook() + .getOrAddSelectedPage() + ->appendNewSplit(false); + split->setChannel(app->twitch2->getOrAddChannel( + loginName.toLower())); + }); + menu->popup(QCursor::pos()); menu->raise(); }