Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix WPF badge mask combobox #1076

Merged
merged 2 commits into from
May 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 18 additions & 24 deletions TwitchDownloaderWPF/PageChatRender.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using TwitchDownloaderCore.TwitchObjects;
using TwitchDownloaderWPF.Models;
using TwitchDownloaderWPF.Properties;
using TwitchDownloaderWPF.Translations;
using TwitchDownloaderWPF.Utils;
using WpfAnimatedGif;
using MessageBox = System.Windows.MessageBox;
Expand Down Expand Up @@ -146,7 +147,7 @@ public ChatRenderOptions GetOptions(string filename)
options.EmojiVendor = EmojiVendor.None;
foreach (var item in comboBadges.SelectedItems)
{
options.ChatBadgeMask += (int)((ChatBadgeListItem)item).Type;
options.ChatBadgeMask += (int)((CheckComboBoxItem)item).Tag;
}

return options;
Expand Down Expand Up @@ -195,19 +196,23 @@ private void LoadSettings()
RadioEmojiTwemoji.IsChecked = (EmojiVendor)Settings.Default.RenderEmojiVendor == EmojiVendor.TwitterTwemoji;
RadioEmojiNone.IsChecked = (EmojiVendor)Settings.Default.RenderEmojiVendor == EmojiVendor.None;

comboBadges.Items.Add(new ChatBadgeListItem() { Type = ChatBadgeType.Broadcaster, Name = "Broadcaster" });
comboBadges.Items.Add(new ChatBadgeListItem() { Type = ChatBadgeType.Moderator, Name = "Mods" });
comboBadges.Items.Add(new ChatBadgeListItem() { Type = ChatBadgeType.VIP, Name = "VIPs" });
comboBadges.Items.Add(new ChatBadgeListItem() { Type = ChatBadgeType.Subscriber, Name = "Subs" });
comboBadges.Items.Add(new ChatBadgeListItem() { Type = ChatBadgeType.Predictions, Name = "Predictions" });
comboBadges.Items.Add(new ChatBadgeListItem() { Type = ChatBadgeType.NoAudioVisual, Name = "No Audio/No Video" });
comboBadges.Items.Add(new ChatBadgeListItem() { Type = ChatBadgeType.PrimeGaming, Name = "Prime" });
comboBadges.Items.Add(new ChatBadgeListItem() { Type = ChatBadgeType.Other, Name = "Others" });

foreach (ChatBadgeListItem item in comboBadges.Items)
comboBadges.Items.Clear();
comboBadges.Items.Add(new CheckComboBoxItem { Content = Strings.BadgeMaskBroadcaster, Tag = ChatBadgeType.Broadcaster });
comboBadges.Items.Add(new CheckComboBoxItem { Content = Strings.BadgeMaskModerator, Tag = ChatBadgeType.Moderator });
comboBadges.Items.Add(new CheckComboBoxItem { Content = Strings.BadgeMaskVIP, Tag = ChatBadgeType.VIP });
comboBadges.Items.Add(new CheckComboBoxItem { Content = Strings.BadgeMaskSubscriber, Tag = ChatBadgeType.Subscriber });
comboBadges.Items.Add(new CheckComboBoxItem { Content = Strings.BadgeMaskPredictions, Tag = ChatBadgeType.Predictions });
comboBadges.Items.Add(new CheckComboBoxItem { Content = Strings.BadgeMaskNoAudioNoVideo, Tag = ChatBadgeType.NoAudioVisual });
comboBadges.Items.Add(new CheckComboBoxItem { Content = Strings.BadgeMaskTwitchPrime, Tag = ChatBadgeType.PrimeGaming });
comboBadges.Items.Add(new CheckComboBoxItem { Content = Strings.BadgeMaskOthers, Tag = ChatBadgeType.Other });

var badgeMask = (ChatBadgeType)Settings.Default.ChatBadgeMask;
foreach (CheckComboBoxItem item in comboBadges.Items)
{
if (((ChatBadgeType)Settings.Default.ChatBadgeMask).HasFlag(item.Type))
if (badgeMask.HasFlag((Enum)item.Tag))
{
comboBadges.SelectedItems.Add(item);
}
}

foreach (VideoContainer container in comboFormat.Items)
Expand Down Expand Up @@ -316,7 +321,7 @@ public void SaveSettings()
int newMask = 0;
foreach (var item in comboBadges.SelectedItems)
{
newMask += (int)((ChatBadgeListItem)item).Type;
newMask += (int)((CheckComboBoxItem)item).Tag;
}
Settings.Default.ChatBadgeMask = newMask;

Expand Down Expand Up @@ -738,17 +743,6 @@ private void TextJson_TextChanged(object sender, TextChangedEventArgs e)
}
}

public class ChatBadgeListItem
{
public ChatBadgeType Type { get; set; }
public string Name { get; set; }

public override string ToString()
{
return Name;
}
}

public class VideoContainer
{
public string Name;
Expand Down
72 changes: 72 additions & 0 deletions TwitchDownloaderWPF/Translations/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions TwitchDownloaderWPF/Translations/Strings.es.resx
Original file line number Diff line number Diff line change
Expand Up @@ -874,4 +874,28 @@
<data name="IncreaseUsernameReadability" xml:space="preserve">
<value>Increase Username Readability:</value>
</data>
<data name="BadgeMaskBroadcaster" xml:space="preserve">
<value>Broadcaster</value>
</data>
<data name="BadgeMaskModerator" xml:space="preserve">
<value>Mods</value>
</data>
<data name="BadgeMaskVIP" xml:space="preserve">
<value>VIPs</value>
</data>
<data name="BadgeMaskSubscriber" xml:space="preserve">
<value>Subs</value>
</data>
<data name="BadgeMaskPredictions" xml:space="preserve">
<value>Predictions</value>
</data>
<data name="BadgeMaskNoAudioNoVideo" xml:space="preserve">
<value>No Audio/No Video</value>
</data>
<data name="BadgeMaskTwitchPrime" xml:space="preserve">
<value>Prime</value>
</data>
<data name="BadgeMaskOthers" xml:space="preserve">
<value>Others</value>
</data>
</root>
24 changes: 24 additions & 0 deletions TwitchDownloaderWPF/Translations/Strings.fr.resx
Original file line number Diff line number Diff line change
Expand Up @@ -873,4 +873,28 @@
<data name="IncreaseUsernameReadability" xml:space="preserve">
<value>Increase Username Readability:</value>
</data>
<data name="BadgeMaskBroadcaster" xml:space="preserve">
<value>Broadcaster</value>
</data>
<data name="BadgeMaskModerator" xml:space="preserve">
<value>Mods</value>
</data>
<data name="BadgeMaskVIP" xml:space="preserve">
<value>VIPs</value>
</data>
<data name="BadgeMaskSubscriber" xml:space="preserve">
<value>Subs</value>
</data>
<data name="BadgeMaskPredictions" xml:space="preserve">
<value>Predictions</value>
</data>
<data name="BadgeMaskNoAudioNoVideo" xml:space="preserve">
<value>No Audio/No Video</value>
</data>
<data name="BadgeMaskTwitchPrime" xml:space="preserve">
<value>Prime</value>
</data>
<data name="BadgeMaskOthers" xml:space="preserve">
<value>Others</value>
</data>
</root>
24 changes: 24 additions & 0 deletions TwitchDownloaderWPF/Translations/Strings.it.resx
Original file line number Diff line number Diff line change
Expand Up @@ -874,4 +874,28 @@
<data name="IncreaseUsernameReadability" xml:space="preserve">
<value>Increase Username Readability:</value>
</data>
<data name="BadgeMaskBroadcaster" xml:space="preserve">
<value>Broadcaster</value>
</data>
<data name="BadgeMaskModerator" xml:space="preserve">
<value>Mods</value>
</data>
<data name="BadgeMaskVIP" xml:space="preserve">
<value>VIPs</value>
</data>
<data name="BadgeMaskSubscriber" xml:space="preserve">
<value>Subs</value>
</data>
<data name="BadgeMaskPredictions" xml:space="preserve">
<value>Predictions</value>
</data>
<data name="BadgeMaskNoAudioNoVideo" xml:space="preserve">
<value>No Audio/No Video</value>
</data>
<data name="BadgeMaskTwitchPrime" xml:space="preserve">
<value>Prime</value>
</data>
<data name="BadgeMaskOthers" xml:space="preserve">
<value>Others</value>
</data>
</root>
25 changes: 23 additions & 2 deletions TwitchDownloaderWPF/Translations/Strings.ja.resx
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,28 @@
<data name="IncreaseUsernameReadability" xml:space="preserve">
<value>ユーザー名の読みやすさを向上する:</value>
</data>
<data name="IncreaseUsernameReadability" xml:space="preserve">
<value>Increase Username Readability:</value>
<data name="BadgeMaskBroadcaster" xml:space="preserve">
<value>Broadcaster</value>
</data>
<data name="BadgeMaskModerator" xml:space="preserve">
<value>Mods</value>
</data>
<data name="BadgeMaskVIP" xml:space="preserve">
<value>VIPs</value>
</data>
<data name="BadgeMaskSubscriber" xml:space="preserve">
<value>Subs</value>
</data>
<data name="BadgeMaskPredictions" xml:space="preserve">
<value>Predictions</value>
</data>
<data name="BadgeMaskNoAudioNoVideo" xml:space="preserve">
<value>No Audio/No Video</value>
</data>
<data name="BadgeMaskTwitchPrime" xml:space="preserve">
<value>Prime</value>
</data>
<data name="BadgeMaskOthers" xml:space="preserve">
<value>Others</value>
</data>
</root>
24 changes: 24 additions & 0 deletions TwitchDownloaderWPF/Translations/Strings.pl.resx
Original file line number Diff line number Diff line change
Expand Up @@ -873,4 +873,28 @@
<data name="IncreaseUsernameReadability" xml:space="preserve">
<value>Increase Username Readability:</value>
</data>
<data name="BadgeMaskBroadcaster" xml:space="preserve">
<value>Broadcaster</value>
</data>
<data name="BadgeMaskModerator" xml:space="preserve">
<value>Mods</value>
</data>
<data name="BadgeMaskVIP" xml:space="preserve">
<value>VIPs</value>
</data>
<data name="BadgeMaskSubscriber" xml:space="preserve">
<value>Subs</value>
</data>
<data name="BadgeMaskPredictions" xml:space="preserve">
<value>Predictions</value>
</data>
<data name="BadgeMaskNoAudioNoVideo" xml:space="preserve">
<value>No Audio/No Video</value>
</data>
<data name="BadgeMaskTwitchPrime" xml:space="preserve">
<value>Prime</value>
</data>
<data name="BadgeMaskOthers" xml:space="preserve">
<value>Others</value>
</data>
</root>
24 changes: 24 additions & 0 deletions TwitchDownloaderWPF/Translations/Strings.pt-br.resx
Original file line number Diff line number Diff line change
Expand Up @@ -872,4 +872,28 @@
<data name="IncreaseUsernameReadability" xml:space="preserve">
<value>Increase Username Readability:</value>
</data>
<data name="BadgeMaskBroadcaster" xml:space="preserve">
<value>Broadcaster</value>
</data>
<data name="BadgeMaskModerator" xml:space="preserve">
<value>Mods</value>
</data>
<data name="BadgeMaskVIP" xml:space="preserve">
<value>VIPs</value>
</data>
<data name="BadgeMaskSubscriber" xml:space="preserve">
<value>Subs</value>
</data>
<data name="BadgeMaskPredictions" xml:space="preserve">
<value>Predictions</value>
</data>
<data name="BadgeMaskNoAudioNoVideo" xml:space="preserve">
<value>No Audio/No Video</value>
</data>
<data name="BadgeMaskTwitchPrime" xml:space="preserve">
<value>Prime</value>
</data>
<data name="BadgeMaskOthers" xml:space="preserve">
<value>Others</value>
</data>
</root>
24 changes: 24 additions & 0 deletions TwitchDownloaderWPF/Translations/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -872,4 +872,28 @@
<data name="IncreaseUsernameReadability" xml:space="preserve">
<value>Increase Username Readability:</value>
</data>
<data name="BadgeMaskBroadcaster" xml:space="preserve">
<value>Broadcaster</value>
</data>
<data name="BadgeMaskModerator" xml:space="preserve">
<value>Mods</value>
</data>
<data name="BadgeMaskVIP" xml:space="preserve">
<value>VIPs</value>
</data>
<data name="BadgeMaskSubscriber" xml:space="preserve">
<value>Subs</value>
</data>
<data name="BadgeMaskPredictions" xml:space="preserve">
<value>Predictions</value>
</data>
<data name="BadgeMaskNoAudioNoVideo" xml:space="preserve">
<value>No Audio/No Video</value>
</data>
<data name="BadgeMaskTwitchPrime" xml:space="preserve">
<value>Prime</value>
</data>
<data name="BadgeMaskOthers" xml:space="preserve">
<value>Others</value>
</data>
</root>
24 changes: 24 additions & 0 deletions TwitchDownloaderWPF/Translations/Strings.ru.resx
Original file line number Diff line number Diff line change
Expand Up @@ -873,4 +873,28 @@
<data name="IncreaseUsernameReadability" xml:space="preserve">
<value>Increase Username Readability:</value>
</data>
<data name="BadgeMaskBroadcaster" xml:space="preserve">
<value>Broadcaster</value>
</data>
<data name="BadgeMaskModerator" xml:space="preserve">
<value>Mods</value>
</data>
<data name="BadgeMaskVIP" xml:space="preserve">
<value>VIPs</value>
</data>
<data name="BadgeMaskSubscriber" xml:space="preserve">
<value>Subs</value>
</data>
<data name="BadgeMaskPredictions" xml:space="preserve">
<value>Predictions</value>
</data>
<data name="BadgeMaskNoAudioNoVideo" xml:space="preserve">
<value>No Audio/No Video</value>
</data>
<data name="BadgeMaskTwitchPrime" xml:space="preserve">
<value>Prime</value>
</data>
<data name="BadgeMaskOthers" xml:space="preserve">
<value>Others</value>
</data>
</root>
Loading
Loading