Skip to content

Commit

Permalink
Fix WPF styling (#1020)
Browse files Browse the repository at this point in the history
* Remove AppRadio brush :(

* Fix margins and add explicit separators to PageChatRender

* Manually add file extensions to circumvent new SaveFileDialog behavior
After the recent WPF update, SaveFileDialog no longer appends the filtered extension if the FileName already has an extension, regardless of whether said extension is correct or not according to the filter. This is a problem when streams have a URL at the end of the title
  • Loading branch information
ScrubN authored Mar 30, 2024
1 parent ccf2abb commit cdd641a
Show file tree
Hide file tree
Showing 15 changed files with 222 additions and 182 deletions.
2 changes: 1 addition & 1 deletion TwitchDownloaderWPF/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<SolidColorBrush x:Key="AppInnerTextDisabled" Color="#A6A6A6" />
<SolidColorBrush x:Key="AppHyperlink" Color="#0066CC" />
<SolidColorBrush x:Key="AppCheckBox" Color="#3A96F2" />
<SolidColorBrush x:Key="AppRadio" Color="#2388ED" />
<!-- <SolidColorBrush x:Key="AppRadio" Color="#2388ED" /> DEPRECATED :( -->
<SolidColorBrush x:Key="AppDivider" Color="#E0E0E0" />
<SolidColorBrush x:Key="AppDividerText" Color="#212121" />

Expand Down
18 changes: 9 additions & 9 deletions TwitchDownloaderWPF/PageChatDownload.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@
<StackPanel Grid.Row="2" Grid.Column="2" Grid.ColumnSpan="2" Margin="0,20,0,0" Orientation="Horizontal" HorizontalAlignment="Center">
<StackPanel HorizontalAlignment="Left">
<TextBlock Text="{lex:Loc Length}" HorizontalAlignment="Right" Foreground="{DynamicResource AppText}" />
<TextBlock Text="{lex:Loc DownloadFormat}" HorizontalAlignment="Right" Margin="0,13,0,0" Foreground="{DynamicResource AppText}" />
<TextBlock Visibility="Visible" x:Name="compressionText" Text="{lex:Loc ChatCompression}" HorizontalAlignment="Right" Margin="0,15,0,0" Foreground="{DynamicResource AppText}" />
<TextBlock Visibility="Collapsed" x:Name="timeText" Text="{lex:Loc TimestampFormat}" HorizontalAlignment="Right" Margin="0,15,0,0" Foreground="{DynamicResource AppText}" />
<TextBlock x:Name="textCrop" Text="{lex:Loc ChatCrop}" HorizontalAlignment="Right" Margin="0,12,0,36" Foreground="{DynamicResource AppText}" />
<TextBlock Text="{lex:Loc DownloadFormat}" HorizontalAlignment="Right" Margin="0,12,0,0" Foreground="{DynamicResource AppText}" />
<TextBlock Visibility="Visible" x:Name="compressionText" Text="{lex:Loc ChatCompression}" HorizontalAlignment="Right" Margin="0,14,0,0" Foreground="{DynamicResource AppText}" />
<TextBlock Visibility="Collapsed" x:Name="timeText" Text="{lex:Loc TimestampFormat}" HorizontalAlignment="Right" Margin="0,8,0,0" Foreground="{DynamicResource AppText}" />
<TextBlock x:Name="textCrop" Text="{lex:Loc ChatCrop}" HorizontalAlignment="Right" Margin="0,10,0,33" Foreground="{DynamicResource AppText}" />
<StackPanel x:Name="stackEmbedText" Visibility="Visible">
<TextBlock HorizontalAlignment="Right" Margin="0,8,0,0" Foreground="{DynamicResource AppText}" ><Run Text="{lex:Loc EmbedImages}"/><Hyperlink ToolTipService.ShowDuration="30000" Foreground="{DynamicResource AppHyperlink}"><Hyperlink.ToolTip><Run Text="{lex:Loc EmbedImagesTooltip}"/></Hyperlink.ToolTip>(?)</Hyperlink>:</TextBlock>
<TextBlock HorizontalAlignment="Right" Margin="0,8,0,0" Foreground="{DynamicResource AppText}" ><Run Text="{lex:Loc ThirdPartyEmotes}"/><Hyperlink ToolTipService.ShowDuration="30000" Foreground="{DynamicResource AppHyperlink}"><Hyperlink.ToolTip><Run Text="{lex:Loc ThirdPartyEmotesTooltip}"/></Hyperlink.ToolTip>(?)</Hyperlink>:</TextBlock>
Expand All @@ -84,13 +84,13 @@
<RadioButton x:Name="radioHTML" Content="HTML" Checked="radioHTML_Checked" Background="{DynamicResource AppElementBackground}" BorderBrush="{DynamicResource AppElementBorder}" Foreground="{DynamicResource AppText}" />
</hc:ButtonGroup>
<StackPanel Visibility="Visible" x:Name="compressionOptions" Margin="5,8,0,0" Orientation="Horizontal">
<RadioButton x:Name="radioCompressionNone" IsChecked="True" Content="{lex:Loc ChatCompressionNone}" Margin="3,0,0,0" Background="{DynamicResource AppRadio}" BorderBrush="{DynamicResource AppElementBorder}" Foreground="{DynamicResource AppText}" />
<RadioButton x:Name="radioCompressionGzip" Content="{lex:Loc ChatCompressionGzip}" Margin="3,0,0,0" Background="{DynamicResource AppRadio}" BorderBrush="{DynamicResource AppElementBorder}" Foreground="{DynamicResource AppText}" />
<RadioButton x:Name="radioCompressionNone" IsChecked="True" Content="{lex:Loc ChatCompressionNone}" Margin="3,0,0,0" BorderBrush="{DynamicResource AppElementBorder}" Foreground="{DynamicResource AppText}" />
<RadioButton x:Name="radioCompressionGzip" Content="{lex:Loc ChatCompressionGzip}" Margin="3,0,0,0" BorderBrush="{DynamicResource AppElementBorder}" Foreground="{DynamicResource AppText}" />
</StackPanel>
<StackPanel Visibility="Collapsed" x:Name="timeOptions" Margin="5,8,0,0" Orientation="Horizontal">
<RadioButton x:Name="radioTimestampUTC" IsChecked="True" Content="{lex:Loc TimestampUtc}" Background="{DynamicResource AppRadio}" BorderBrush="{DynamicResource AppElementBorder}" Foreground="{DynamicResource AppText}" />
<RadioButton x:Name="radioTimestampRelative" Content="{lex:Loc TimestampRelative}" Margin="3,0,0,0" Background="{DynamicResource AppRadio}" BorderBrush="{DynamicResource AppElementBorder}" Foreground="{DynamicResource AppText}" />
<RadioButton x:Name="radioTimestampNone" Content="{lex:Loc TimestampNone}" Margin="3,0,0,0" Background="{DynamicResource AppRadio}" BorderBrush="{DynamicResource AppElementBorder}" Foreground="{DynamicResource AppText}" />
<RadioButton x:Name="radioTimestampUTC" IsChecked="True" Content="{lex:Loc TimestampUtc}" BorderBrush="{DynamicResource AppElementBorder}" Foreground="{DynamicResource AppText}" />
<RadioButton x:Name="radioTimestampRelative" Content="{lex:Loc TimestampRelative}" Margin="3,0,0,0" BorderBrush="{DynamicResource AppElementBorder}" Foreground="{DynamicResource AppText}" />
<RadioButton x:Name="radioTimestampNone" Content="{lex:Loc TimestampNone}" Margin="3,0,0,0" BorderBrush="{DynamicResource AppElementBorder}" Foreground="{DynamicResource AppText}" />
</StackPanel>
<StackPanel Margin="5,5,0,0">
<StackPanel Orientation="Horizontal">
Expand Down
28 changes: 21 additions & 7 deletions TwitchDownloaderWPF/PageChatDownload.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -447,23 +447,37 @@ private async void SplitBtnDownload_Click(object sender, RoutedEventArgs e)
return;
}

SaveFileDialog saveFileDialog = new SaveFileDialog();
var saveFileDialog = new SaveFileDialog
{
FileName = FilenameService.GetFilename(Settings.Default.TemplateChat, textTitle.Text, downloadId, currentVideoTime, textStreamer.Text,
checkCropStart.IsChecked == true ? new TimeSpan((int)numStartHour.Value, (int)numStartMinute.Value, (int)numStartSecond.Value) : TimeSpan.Zero,
checkCropEnd.IsChecked == true ? new TimeSpan((int)numEndHour.Value, (int)numEndMinute.Value, (int)numEndSecond.Value) : vodLength,
viewCount.ToString(), game)
};

if (radioJson.IsChecked == true)
{
if (radioCompressionNone.IsChecked == true)
{
saveFileDialog.Filter = "JSON Files | *.json";
saveFileDialog.FileName += ".json";
}
else if (radioCompressionGzip.IsChecked == true)
{
saveFileDialog.Filter = "GZip JSON Files | *.json.gz";
saveFileDialog.FileName += ".json.gz";
}
}
else if (radioHTML.IsChecked == true)
saveFileDialog.Filter = "HTML Files | *.html;*.htm";
{
saveFileDialog.Filter = "HTML Files | *.html";
saveFileDialog.FileName += ".html";
}
else if (radioText.IsChecked == true)
{
saveFileDialog.Filter = "TXT Files | *.txt";

saveFileDialog.FileName = FilenameService.GetFilename(Settings.Default.TemplateChat, textTitle.Text, downloadId, currentVideoTime, textStreamer.Text,
checkCropStart.IsChecked == true ? new TimeSpan((int)numStartHour.Value, (int)numStartMinute.Value, (int)numStartSecond.Value) : TimeSpan.Zero,
checkCropEnd.IsChecked == true ? new TimeSpan((int)numEndHour.Value, (int)numEndMinute.Value, (int)numEndSecond.Value) : vodLength,
viewCount.ToString(), game);
saveFileDialog.FileName += ".txt";
}

if (saveFileDialog.ShowDialog() != true)
{
Expand Down
Loading

0 comments on commit cdd641a

Please sign in to comment.