Add context menu option to open the user's channel from a usercard (#3486)

Co-authored-by: Paweł <zneix@zneix.eu>
This commit is contained in:
Mm2PL 2022-02-13 01:37:14 +00:00 committed by GitHub
parent 5978ed8b1f
commit ad8246647f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View file

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

View file

@ -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 <QCheckBox>
#include <QDesktopServices>
@ -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();
}