feat: use message's original channel name when usercard popout is opened (#3623)
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -2153,15 +2153,20 @@ void ChannelView::hideEvent(QHideEvent *)
|
||||
this->messagesOnScreen_.clear();
|
||||
}
|
||||
|
||||
void ChannelView::showUserInfoPopup(const QString &userName)
|
||||
void ChannelView::showUserInfoPopup(const QString &userName,
|
||||
QString alternativePopoutChannel)
|
||||
{
|
||||
QWidget *userCardParent =
|
||||
auto *userCardParent =
|
||||
static_cast<QWidget *>(&(getApp()->windows->getMainWindow()));
|
||||
auto *userPopup =
|
||||
new UserInfoPopup(getSettings()->autoCloseUserPopup, userCardParent);
|
||||
userPopup->setData(userName, this->hasSourceChannel()
|
||||
? this->sourceChannel_
|
||||
: this->underlyingChannel_);
|
||||
|
||||
auto contextChannel =
|
||||
getApp()->twitch->getChannelOrEmpty(alternativePopoutChannel);
|
||||
auto openingChannel = this->hasSourceChannel() ? this->sourceChannel_
|
||||
: this->underlyingChannel_;
|
||||
userPopup->setData(userName, contextChannel, openingChannel);
|
||||
|
||||
QPoint offset(int(150 * this->scale()), int(70 * this->scale()));
|
||||
userPopup->move(QCursor::pos() - offset);
|
||||
userPopup->show();
|
||||
@@ -2181,7 +2186,7 @@ void ChannelView::handleLinkClick(QMouseEvent *event, const Link &link,
|
||||
case Link::UserWhisper:
|
||||
case Link::UserInfo: {
|
||||
auto user = link.value;
|
||||
this->showUserInfoPopup(user);
|
||||
this->showUserInfoPopup(user, layout->getMessage()->channelName);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -96,7 +96,15 @@ public:
|
||||
void queueLayout();
|
||||
|
||||
void clearMessages();
|
||||
void showUserInfoPopup(const QString &userName);
|
||||
|
||||
/**
|
||||
* @brief Creates and shows a UserInfoPopup dialog
|
||||
*
|
||||
* @param userName The login name of the user
|
||||
* @param alternativePopoutChannel Optional parameter containing the channel name to use for context
|
||||
**/
|
||||
void showUserInfoPopup(const QString &userName,
|
||||
QString alternativePopoutChannel = QString());
|
||||
|
||||
pajlada::Signals::Signal<QMouseEvent *> mouseDown;
|
||||
pajlada::Signals::NoArgSignal selectionChanged;
|
||||
|
||||
Reference in New Issue
Block a user