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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 1 deletions

View file

@ -46,6 +46,7 @@
- Bugfix: Fixed lookahead/-behind not working in _Ignores_. (#4965) - Bugfix: Fixed lookahead/-behind not working in _Ignores_. (#4965)
- Bugfix: Fixed Image Uploader accidentally deleting images with some hosts when link resolver was enabled. (#4971) - Bugfix: Fixed Image Uploader accidentally deleting images with some hosts when link resolver was enabled. (#4971)
- Bugfix: Fixed rare crash with Image Uploader when closing a split right after starting an upload. (#4971) - Bugfix: Fixed rare crash with Image Uploader when closing a split right after starting an upload. (#4971)
- Bugfix: Hide the Usercard button in the User Info Popup when in special channels. (#4972)
- Bugfix: Fixed support for Windows 11 Snap layouts. (#4994) - Bugfix: Fixed support for Windows 11 Snap layouts. (#4994)
- Bugfix: Fixed some windows appearing between screens. (#4797) - Bugfix: Fixed some windows appearing between screens. (#4797)
- Bugfix: Fixed a bug on Wayland where tooltips would spawn as separate windows instead of behaving like tooltips. (#4998) - Bugfix: Fixed a bug on Wayland where tooltips would spawn as separate windows instead of behaving like tooltips. (#4998)

View file

@ -385,7 +385,10 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, QWidget *parent,
user.emplace<QCheckBox>("Block").assign(&this->ui_.block); user.emplace<QCheckBox>("Block").assign(&this->ui_.block);
user.emplace<QCheckBox>("Ignore highlights") user.emplace<QCheckBox>("Ignore highlights")
.assign(&this->ui_.ignoreHighlights); .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"); usercard->getLabel().setText("Usercard");
auto mod = user.emplace<Button>(this); auto mod = user.emplace<Button>(this);
mod->setPixmap(getResources().buttons.mod); mod->setPixmap(getResources().buttons.mod);
@ -739,6 +742,15 @@ void UserInfoPopup::setData(const QString &name,
this->updateLatestMessages(); this->updateLatestMessages();
} }
// If we're opening by ID, this will be called as soon as we get the information from twitch // 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() void UserInfoPopup::updateLatestMessages()

View file

@ -1,6 +1,7 @@
#pragma once #pragma once
#include "widgets/DraggablePopup.hpp" #include "widgets/DraggablePopup.hpp"
#include "widgets/helper/EffectLabel.hpp"
#include <pajlada/signals/scoped-connection.hpp> #include <pajlada/signals/scoped-connection.hpp>
#include <pajlada/signals/signal.hpp> #include <pajlada/signals/signal.hpp>
@ -80,6 +81,8 @@ private:
Label *noMessagesLabel = nullptr; Label *noMessagesLabel = nullptr;
ChannelView *latestMessages = nullptr; ChannelView *latestMessages = nullptr;
EffectLabel2 *usercardLabel = nullptr;
} ui_; } ui_;
class TimeoutWidget : public BaseWidget class TimeoutWidget : public BaseWidget