Don't crash upon right-clicking automod badge (#3496)
This commit is contained in:
@@ -81,6 +81,7 @@
|
|||||||
- Bugfix: Fixed crash that could occur if the user opens/closes ChannelViews (e.g. EmotePopup, or Splits) then modifies the showLastMessageIndicator setting. (#3444)
|
- Bugfix: Fixed crash that could occur if the user opens/closes ChannelViews (e.g. EmotePopup, or Splits) then modifies the showLastMessageIndicator setting. (#3444)
|
||||||
- Bugfix: Removed ability to reload emotes really fast (#3450)
|
- Bugfix: Removed ability to reload emotes really fast (#3450)
|
||||||
- Bugfix: Re-add date of build to the "About" page on nightly versions. (#3464)
|
- Bugfix: Re-add date of build to the "About" page on nightly versions. (#3464)
|
||||||
|
- Bugfix: Fixed crash that would occur if the user right-clicked AutoMod badge. (#3496)
|
||||||
- Dev: Batch checking live status for channels with live notifications that aren't connected. (#3442)
|
- Dev: Batch checking live status for channels with live notifications that aren't connected. (#3442)
|
||||||
- Dev: Add GitHub action to test builds without precompiled headers enabled. (#3327)
|
- Dev: Add GitHub action to test builds without precompiled headers enabled. (#3327)
|
||||||
- Dev: Renamed CMake's build option `USE_SYSTEM_QT5KEYCHAIN` to `USE_SYSTEM_QTKEYCHAIN`. (#3103)
|
- Dev: Renamed CMake's build option `USE_SYSTEM_QT5KEYCHAIN` to `USE_SYSTEM_QTKEYCHAIN`. (#3103)
|
||||||
|
|||||||
@@ -28,6 +28,14 @@ MessagePtr makeSystemMessage(const QString &text, const QTime &time)
|
|||||||
return MessageBuilder(systemMessage, text, time).release();
|
return MessageBuilder(systemMessage, text, time).release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EmotePtr makeAutoModBadge()
|
||||||
|
{
|
||||||
|
return std::make_shared<Emote>(Emote{
|
||||||
|
EmoteName{}, ImageSet{Image::fromPixmap(getResources().twitch.automod)},
|
||||||
|
Tooltip{"AutoMod"},
|
||||||
|
Url{"https://dashboard.twitch.tv/settings/moderation/automod"}});
|
||||||
|
}
|
||||||
|
|
||||||
MessagePtr makeAutomodInfoMessage(const AutomodInfoAction &action)
|
MessagePtr makeAutomodInfoMessage(const AutomodInfoAction &action)
|
||||||
{
|
{
|
||||||
auto builder = MessageBuilder();
|
auto builder = MessageBuilder();
|
||||||
@@ -37,10 +45,8 @@ MessagePtr makeAutomodInfoMessage(const AutomodInfoAction &action)
|
|||||||
builder.message().flags.set(MessageFlag::PubSub);
|
builder.message().flags.set(MessageFlag::PubSub);
|
||||||
|
|
||||||
// AutoMod shield badge
|
// AutoMod shield badge
|
||||||
builder
|
builder.emplace<BadgeElement>(makeAutoModBadge(),
|
||||||
.emplace<ImageElement>(Image::fromPixmap(getResources().twitch.automod),
|
MessageElementFlag::BadgeChannelAuthority);
|
||||||
MessageElementFlag::BadgeChannelAuthority)
|
|
||||||
->setTooltip("AutoMod");
|
|
||||||
// AutoMod "username"
|
// AutoMod "username"
|
||||||
builder.emplace<TextElement>("AutoMod:", MessageElementFlag::BoldUsername,
|
builder.emplace<TextElement>("AutoMod:", MessageElementFlag::BoldUsername,
|
||||||
MessageColor(QColor("blue")),
|
MessageColor(QColor("blue")),
|
||||||
@@ -95,10 +101,8 @@ std::pair<MessagePtr, MessagePtr> makeAutomodMessage(
|
|||||||
builder.message().flags.set(MessageFlag::PubSub);
|
builder.message().flags.set(MessageFlag::PubSub);
|
||||||
|
|
||||||
// AutoMod shield badge
|
// AutoMod shield badge
|
||||||
builder
|
builder.emplace<BadgeElement>(makeAutoModBadge(),
|
||||||
.emplace<ImageElement>(Image::fromPixmap(getResources().twitch.automod),
|
MessageElementFlag::BadgeChannelAuthority);
|
||||||
MessageElementFlag::BadgeChannelAuthority)
|
|
||||||
->setTooltip("AutoMod");
|
|
||||||
// AutoMod "username"
|
// AutoMod "username"
|
||||||
builder.emplace<TextElement>("AutoMod:", MessageElementFlag::BoldUsername,
|
builder.emplace<TextElement>("AutoMod:", MessageElementFlag::BoldUsername,
|
||||||
MessageColor(QColor("blue")),
|
MessageColor(QColor("blue")),
|
||||||
|
|||||||
@@ -1860,19 +1860,19 @@ void ChannelView::addContextMenuItems(
|
|||||||
auto menu = new QMenu;
|
auto menu = new QMenu;
|
||||||
previousMenu = menu;
|
previousMenu = menu;
|
||||||
|
|
||||||
|
// Badge actions
|
||||||
if (creatorFlags.hasAny({MessageElementFlag::Badges}))
|
if (creatorFlags.hasAny({MessageElementFlag::Badges}))
|
||||||
{
|
{
|
||||||
auto badgeElement = dynamic_cast<const BadgeElement *>(&creator);
|
if (auto badgeElement = dynamic_cast<const BadgeElement *>(&creator))
|
||||||
addEmoteContextMenuItems(*badgeElement->getEmote(), creatorFlags,
|
addEmoteContextMenuItems(*badgeElement->getEmote(), creatorFlags,
|
||||||
*menu);
|
*menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emote actions
|
// Emote actions
|
||||||
if (creatorFlags.hasAny(
|
if (creatorFlags.hasAny(
|
||||||
{MessageElementFlag::EmoteImages, MessageElementFlag::EmojiImage}))
|
{MessageElementFlag::EmoteImages, MessageElementFlag::EmojiImage}))
|
||||||
{
|
{
|
||||||
const auto emoteElement = dynamic_cast<const EmoteElement *>(&creator);
|
if (auto emoteElement = dynamic_cast<const EmoteElement *>(&creator))
|
||||||
if (emoteElement)
|
|
||||||
addEmoteContextMenuItems(*emoteElement->getEmote(), creatorFlags,
|
addEmoteContextMenuItems(*emoteElement->getEmote(), creatorFlags,
|
||||||
*menu);
|
*menu);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user