Hide the Usercard button in the User Info Popup in special channels (#4972)

This commit is contained in:
Mm2PL
2023-12-09 13:21:00 +01:00
committed by GitHub
parent 507f27e3d2
commit 401e097d62
3 changed files with 17 additions and 1 deletions
+13 -1
View File
@@ -385,7 +385,10 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, QWidget *parent,
user.emplace<QCheckBox>("Block").assign(&this->ui_.block);
user.emplace<QCheckBox>("Ignore highlights")
.assign(&this->ui_.ignoreHighlights);
auto usercard = user.emplace<EffectLabel2>(this);
// visibility of this is updated in setData
auto usercard =
user.emplace<EffectLabel2>(this).assign(&this->ui_.usercardLabel);
usercard->getLabel().setText("Usercard");
auto mod = user.emplace<Button>(this);
mod->setPixmap(getResources().buttons.mod);
@@ -739,6 +742,15 @@ void UserInfoPopup::setData(const QString &name,
this->updateLatestMessages();
}
// If we're opening by ID, this will be called as soon as we get the information from twitch
auto type = this->channel_->getType();
if (type == Channel::Type::TwitchLive ||
type == Channel::Type::TwitchWhispers || type == Channel::Type::Irc ||
type == Channel::Type::Misc)
{
// not a normal twitch channel, the url opened by the button will be invalid, so hide the button
this->ui_.usercardLabel->hide();
}
}
void UserInfoPopup::updateLatestMessages()