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:
James Upjohn
2022-04-09 23:27:21 +12:00
committed by GitHub
parent 3afdb3367f
commit 04c355f7e9
5 changed files with 87 additions and 47 deletions
+11 -6
View File
@@ -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;