Unbreak c2.ChannelType

This commit is contained in:
Mm2PL 2024-09-30 16:33:29 +02:00
parent ef2ae52bed
commit 121317cbd4
No known key found for this signature in database
GPG key ID: 94AC9B80EFA15ED9
2 changed files with 27 additions and 28 deletions

View file

@ -165,30 +165,3 @@ private:
};
} // namespace chatterino
template <>
constexpr magic_enum::customize::customize_t
magic_enum::customize::enum_name<chatterino::Channel::Type>(
chatterino::Channel::Type value) noexcept
{
using Type = chatterino::Channel::Type;
switch (value)
{
case Type::Twitch:
return "twitch";
case Type::TwitchWhispers:
return "whispers";
case Type::TwitchWatching:
return "watching";
case Type::TwitchMentions:
return "mentions";
case Type::TwitchLive:
return "live";
case Type::TwitchAutomod:
return "automod";
case Type::Misc:
return "misc";
default:
return default_tag;
}
}

View file

@ -805,6 +805,32 @@ void SplitContainer::popup()
window.show();
}
QString channelTypeToString(Channel::Type value) noexcept
{
using Type = chatterino::Channel::Type;
switch (value)
{
default:
assert(false && "value cannot be serialized");
return "never";
case Type::Twitch:
return "twitch";
case Type::TwitchWhispers:
return "whispers";
case Type::TwitchWatching:
return "watching";
case Type::TwitchMentions:
return "mentions";
case Type::TwitchLive:
return "live";
case Type::TwitchAutomod:
return "automod";
case Type::Misc:
return "misc";
}
}
NodeDescriptor SplitContainer::buildDescriptorRecursively(
const Node *currentNode) const
{
@ -814,7 +840,7 @@ NodeDescriptor SplitContainer::buildDescriptorRecursively(
currentNode->split_->getIndirectChannel().getType();
SplitNodeDescriptor result;
result.type_ = qmagicenum::enumNameString(channelType);
result.type_ = channelTypeToString(channelType);
result.channelName_ = currentNode->split_->getChannel()->getName();
result.filters_ = currentNode->split_->getFilters();
return result;