From cdd641a40ca696e97b8b12a07db6bdb9b2114725 Mon Sep 17 00:00:00 2001 From: Scrub <72096833+ScrubN@users.noreply.github.com> Date: Fri, 29 Mar 2024 23:11:35 -0400 Subject: [PATCH] Fix WPF styling (#1020) * 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 --- TwitchDownloaderWPF/App.xaml | 2 +- TwitchDownloaderWPF/PageChatDownload.xaml | 18 +- TwitchDownloaderWPF/PageChatDownload.xaml.cs | 28 +- TwitchDownloaderWPF/PageChatRender.xaml | 257 ++++++++++--------- TwitchDownloaderWPF/PageChatUpdate.xaml | 18 +- TwitchDownloaderWPF/PageChatUpdate.xaml.cs | 29 ++- TwitchDownloaderWPF/PageClipDownload.xaml | 2 +- TwitchDownloaderWPF/PageClipDownload.xaml.cs | 2 +- TwitchDownloaderWPF/PageQueue.xaml | 8 +- TwitchDownloaderWPF/PageVodDownload.xaml | 8 +- TwitchDownloaderWPF/PageVodDownload.xaml.cs | 2 +- TwitchDownloaderWPF/Themes/Dark.xaml | 2 +- TwitchDownloaderWPF/Themes/Light.xaml | 2 +- TwitchDownloaderWPF/WindowQueueOptions.xaml | 10 +- TwitchDownloaderWPF/WindowSettings.xaml | 16 +- 15 files changed, 222 insertions(+), 182 deletions(-) diff --git a/TwitchDownloaderWPF/App.xaml b/TwitchDownloaderWPF/App.xaml index 6dd4a03c..6c6c13e5 100644 --- a/TwitchDownloaderWPF/App.xaml +++ b/TwitchDownloaderWPF/App.xaml @@ -22,7 +22,7 @@ - + diff --git a/TwitchDownloaderWPF/PageChatDownload.xaml b/TwitchDownloaderWPF/PageChatDownload.xaml index c95fbf85..47b976ed 100644 --- a/TwitchDownloaderWPF/PageChatDownload.xaml +++ b/TwitchDownloaderWPF/PageChatDownload.xaml @@ -66,10 +66,10 @@ - - - - + + + + (?): (?): @@ -84,13 +84,13 @@ - - + + - - - + + + diff --git a/TwitchDownloaderWPF/PageChatDownload.xaml.cs b/TwitchDownloaderWPF/PageChatDownload.xaml.cs index f2ef7ae7..f570ec91 100644 --- a/TwitchDownloaderWPF/PageChatDownload.xaml.cs +++ b/TwitchDownloaderWPF/PageChatDownload.xaml.cs @@ -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) { diff --git a/TwitchDownloaderWPF/PageChatRender.xaml b/TwitchDownloaderWPF/PageChatRender.xaml index fab704bd..caedea67 100644 --- a/TwitchDownloaderWPF/PageChatRender.xaml +++ b/TwitchDownloaderWPF/PageChatRender.xaml @@ -40,136 +40,149 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - (?): - (?): - - - - - - - - - - - - - - - (?): - - - - - - - - - - - (?): - - (?): - - - - - - - - - + + + + + + + + + + (?): + (?): + + + + + + + + + + + + + + + (?): + + + + + + + + + + + (?): + + (?): + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - + + + diff --git a/TwitchDownloaderWPF/PageChatUpdate.xaml b/TwitchDownloaderWPF/PageChatUpdate.xaml index 1eb270f3..1e292b3b 100644 --- a/TwitchDownloaderWPF/PageChatUpdate.xaml +++ b/TwitchDownloaderWPF/PageChatUpdate.xaml @@ -66,10 +66,10 @@ - - - - + + + + (?): (?): @@ -84,13 +84,13 @@ - - + + - - - + + + diff --git a/TwitchDownloaderWPF/PageChatUpdate.xaml.cs b/TwitchDownloaderWPF/PageChatUpdate.xaml.cs index 1b4d9a2f..64b99f4c 100644 --- a/TwitchDownloaderWPF/PageChatUpdate.xaml.cs +++ b/TwitchDownloaderWPF/PageChatUpdate.xaml.cs @@ -480,25 +480,38 @@ private async void SplitBtnUpdate_Click(object sender, RoutedEventArgs e) return; } - SaveFileDialog saveFileDialog = new SaveFileDialog(); + var saveFileDialog = new SaveFileDialog + { + FileName = FilenameService.GetFilename(Settings.Default.TemplateChat, textTitle.Text, + ChatJsonInfo.video.id ?? ChatJsonInfo.comments.FirstOrDefault()?.content_id ?? "-1", VideoCreatedAt, textStreamer.Text, + checkStart.IsChecked == true ? new TimeSpan((int)numStartHour.Value, (int)numStartMinute.Value, (int)numStartSecond.Value) : TimeSpan.FromSeconds(double.IsNegative(ChatJsonInfo.video.start) ? 0.0 : ChatJsonInfo.video.start), + checkEnd.IsChecked == true ? new TimeSpan((int)numEndHour.Value, (int)numEndMinute.Value, (int)numEndSecond.Value) : VideoLength, + 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, - ChatJsonInfo.video.id ?? ChatJsonInfo.comments.FirstOrDefault()?.content_id ?? "-1", VideoCreatedAt, textStreamer.Text, - checkStart.IsChecked == true ? new TimeSpan((int)numStartHour.Value, (int)numStartMinute.Value, (int)numStartSecond.Value) : TimeSpan.FromSeconds(double.IsNegative(ChatJsonInfo.video.start) ? 0.0 : ChatJsonInfo.video.start), - checkEnd.IsChecked == true ? new TimeSpan((int)numEndHour.Value, (int)numEndMinute.Value, (int)numEndSecond.Value) : VideoLength, - ViewCount.ToString(), Game); + saveFileDialog.FileName += ".txt"; + } if (saveFileDialog.ShowDialog() != true) { diff --git a/TwitchDownloaderWPF/PageClipDownload.xaml b/TwitchDownloaderWPF/PageClipDownload.xaml index c875b23e..ef2bb3c6 100644 --- a/TwitchDownloaderWPF/PageClipDownload.xaml +++ b/TwitchDownloaderWPF/PageClipDownload.xaml @@ -66,7 +66,7 @@ - + diff --git a/TwitchDownloaderWPF/PageClipDownload.xaml.cs b/TwitchDownloaderWPF/PageClipDownload.xaml.cs index d68e600c..e78e22ad 100644 --- a/TwitchDownloaderWPF/PageClipDownload.xaml.cs +++ b/TwitchDownloaderWPF/PageClipDownload.xaml.cs @@ -201,7 +201,7 @@ private async void SplitBtnDownload_Click(object sender, RoutedEventArgs e) SaveFileDialog saveFileDialog = new SaveFileDialog { Filter = "MP4 Files | *.mp4", - FileName = FilenameService.GetFilename(Settings.Default.TemplateClip, textTitle.Text, clipId, currentVideoTime, textStreamer.Text, TimeSpan.Zero, clipLength, viewCount.ToString(), game) + FileName = FilenameService.GetFilename(Settings.Default.TemplateClip, textTitle.Text, clipId, currentVideoTime, textStreamer.Text, TimeSpan.Zero, clipLength, viewCount.ToString(), game) + ".mp4" }; if (saveFileDialog.ShowDialog() != true) { diff --git a/TwitchDownloaderWPF/PageQueue.xaml b/TwitchDownloaderWPF/PageQueue.xaml index b337fdbb..3e5e1534 100644 --- a/TwitchDownloaderWPF/PageQueue.xaml +++ b/TwitchDownloaderWPF/PageQueue.xaml @@ -94,19 +94,19 @@ - + - + - + - + diff --git a/TwitchDownloaderWPF/PageVodDownload.xaml b/TwitchDownloaderWPF/PageVodDownload.xaml index ed2be6a8..4e91f745 100644 --- a/TwitchDownloaderWPF/PageVodDownload.xaml +++ b/TwitchDownloaderWPF/PageVodDownload.xaml @@ -68,9 +68,9 @@ - - - (?): + + + (?): @@ -90,7 +90,7 @@ - + diff --git a/TwitchDownloaderWPF/PageVodDownload.xaml.cs b/TwitchDownloaderWPF/PageVodDownload.xaml.cs index 8e4406ae..9202c23e 100644 --- a/TwitchDownloaderWPF/PageVodDownload.xaml.cs +++ b/TwitchDownloaderWPF/PageVodDownload.xaml.cs @@ -411,7 +411,7 @@ private async void SplitBtnDownloader_Click(object sender, RoutedEventArgs e) FileName = FilenameService.GetFilename(Settings.Default.TemplateVod, textTitle.Text, currentVideoId.ToString(), currentVideoTime, textStreamer.Text, checkStart.IsChecked == true ? new TimeSpan((int)numStartHour.Value, (int)numStartMinute.Value, (int)numStartSecond.Value) : TimeSpan.Zero, checkEnd.IsChecked == true ? new TimeSpan((int)numEndHour.Value, (int)numEndMinute.Value, (int)numEndSecond.Value) : vodLength, - viewCount.ToString(), game) + viewCount.ToString(), game) + ".mp4" }; if (saveFileDialog.ShowDialog() == false) { diff --git a/TwitchDownloaderWPF/Themes/Dark.xaml b/TwitchDownloaderWPF/Themes/Dark.xaml index 376b0b22..d4cd4c7e 100644 --- a/TwitchDownloaderWPF/Themes/Dark.xaml +++ b/TwitchDownloaderWPF/Themes/Dark.xaml @@ -19,7 +19,7 @@ - + diff --git a/TwitchDownloaderWPF/Themes/Light.xaml b/TwitchDownloaderWPF/Themes/Light.xaml index 2caa884a..fbd055e8 100644 --- a/TwitchDownloaderWPF/Themes/Light.xaml +++ b/TwitchDownloaderWPF/Themes/Light.xaml @@ -19,7 +19,7 @@ - + diff --git a/TwitchDownloaderWPF/WindowQueueOptions.xaml b/TwitchDownloaderWPF/WindowQueueOptions.xaml index 4c8680e5..6b935daa 100644 --- a/TwitchDownloaderWPF/WindowQueueOptions.xaml +++ b/TwitchDownloaderWPF/WindowQueueOptions.xaml @@ -51,14 +51,14 @@ - - - + + + - - + + diff --git a/TwitchDownloaderWPF/WindowSettings.xaml b/TwitchDownloaderWPF/WindowSettings.xaml index 611f8456..81ac7ba5 100644 --- a/TwitchDownloaderWPF/WindowSettings.xaml +++ b/TwitchDownloaderWPF/WindowSettings.xaml @@ -43,26 +43,26 @@ - - - + + + - + - (?): + (?): - - (?): + + (?): - (?): + (?):