From 3dd8482c3e4ce80f14e292f69203c79f6023b5fe Mon Sep 17 00:00:00 2001 From: OmrSi Date: Tue, 22 Sep 2020 19:08:43 +0300 Subject: [PATCH] Remove unused "Netflix QC Result" --- src/Forms/Main.cs | 31 ++----- src/Forms/NetflixFixErrors.cs | 10 +++ src/Forms/NetflixQCResult.Designer.cs | 102 ---------------------- src/Forms/NetflixQCResult.cs | 109 ----------------------- src/Forms/NetflixQCResult.resx | 120 -------------------------- src/SubtitleEdit.csproj | 9 -- 6 files changed, 19 insertions(+), 362 deletions(-) delete mode 100644 src/Forms/NetflixQCResult.Designer.cs delete mode 100644 src/Forms/NetflixQCResult.cs delete mode 100644 src/Forms/NetflixQCResult.resx diff --git a/src/Forms/Main.cs b/src/Forms/Main.cs index 049fce67d..041ad7797 100644 --- a/src/Forms/Main.cs +++ b/src/Forms/Main.cs @@ -27214,8 +27214,6 @@ namespace Nikse.SubtitleEdit.Forms string fileName = string.IsNullOrEmpty(_fileName) ? "UntitledSubtitle" : Path.GetFileNameWithoutExtension(_fileName); string language = LanguageAutoDetect.AutoDetectGoogleLanguage(_subtitle); - var messages = new List(); - var reportFiles = new List(); var netflixController = new NetflixQualityController { Language = language, VideoFileName = _videoFileName }; if (!string.IsNullOrEmpty(_videoFileName) && _videoInfo != null && _videoInfo.FramesPerSecond > 20) @@ -27229,36 +27227,25 @@ namespace Nikse.SubtitleEdit.Forms { string reportPath = Path.GetTempPath() + fileName + "_NetflixQualityCheck.csv"; netflixController.SaveCsv(reportPath); - string msgFormat = string.Format("{0}\r\n\r\n{1}", string.Format(Configuration.Settings.Language.NetflixQualityCheck.FoundXIssues, netflixController.Records.Count), - Configuration.Settings.Language.NetflixQualityCheck.ReportPrompt); - messages.Add(string.Format(msgFormat, reportPath)); - reportFiles.Add(reportPath); - using (var dialog = new NetflixQCResult(string.Join(Environment.NewLine, messages), reportFiles)) + if (!isSaving) { - if (!isSaving) + using (var form = new NetflixFixErrors(_subtitle, GetCurrentSubtitleFormat(), _fileName, _videoFileName)) { - using (var form = new NetflixFixErrors(_subtitle, GetCurrentSubtitleFormat(), _fileName, _videoFileName)) + if (form.ShowDialog(this) == DialogResult.OK) { - if (form.ShowDialog(this) == DialogResult.OK) - { - } } } - else - { - ShowStatus(string.Format(_language.SavedSubtitleX, _fileName) + " - " + - string.Format(Configuration.Settings.Language.NetflixQualityCheck.FoundXIssues, netflixController.Records.Count)); - } + } + else + { + ShowStatus(string.Format(_language.SavedSubtitleX, _fileName) + " - " + + string.Format(Configuration.Settings.Language.NetflixQualityCheck.FoundXIssues, netflixController.Records.Count)); } } else if (!isSaving) { - messages.Add(Configuration.Settings.Language.NetflixQualityCheck.CheckOk); - using (var dialog = new NetflixQCResult(string.Join(Environment.NewLine, messages), reportFiles)) - { - dialog.ShowDialog(this); - } + MessageBox.Show("Netflix Quality Check found no issues.", "Netflix Quality Check"); } } diff --git a/src/Forms/NetflixFixErrors.cs b/src/Forms/NetflixFixErrors.cs index fe99827a1..4106daaf1 100644 --- a/src/Forms/NetflixFixErrors.cs +++ b/src/Forms/NetflixFixErrors.cs @@ -136,6 +136,16 @@ namespace Nikse.SubtitleEdit.Forms listViewFixes.Items.Add(item); } + protected override bool ProcessDialogKey(Keys keyData) + { + if (keyData == Keys.Escape) + { + Close(); + } + + return base.ProcessDialogKey(keyData); + } + private void buttonCancel_Click(object sender, EventArgs e) { DialogResult = DialogResult.Cancel; diff --git a/src/Forms/NetflixQCResult.Designer.cs b/src/Forms/NetflixQCResult.Designer.cs deleted file mode 100644 index 68d93f4f6..000000000 --- a/src/Forms/NetflixQCResult.Designer.cs +++ /dev/null @@ -1,102 +0,0 @@ -namespace Nikse.SubtitleEdit.Forms -{ - partial class NetflixQCResult - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.btnOk = new System.Windows.Forms.Button(); - this.btnOpen = new System.Windows.Forms.Button(); - this.lnkLblText = new System.Windows.Forms.LinkLabel(); - this.lblText = new System.Windows.Forms.Label(); - this.SuspendLayout(); - // - // btnOk - // - this.btnOk.Location = new System.Drawing.Point(162, 64); - this.btnOk.Name = "btnOk"; - this.btnOk.Size = new System.Drawing.Size(75, 23); - this.btnOk.TabIndex = 0; - this.btnOk.Text = "Ok"; - this.btnOk.UseVisualStyleBackColor = true; - this.btnOk.Click += new System.EventHandler(this.btnOk_Click); - // - // btnOpen - // - this.btnOpen.Location = new System.Drawing.Point(46, 64); - this.btnOpen.Name = "btnOpen"; - this.btnOpen.Size = new System.Drawing.Size(110, 23); - this.btnOpen.TabIndex = 1; - this.btnOpen.Text = "Open file location"; - this.btnOpen.UseVisualStyleBackColor = true; - this.btnOpen.Click += new System.EventHandler(this.btnOpen_Click); - // - // lnkLblText - // - this.lnkLblText.AutoSize = true; - this.lnkLblText.Location = new System.Drawing.Point(12, 9); - this.lnkLblText.Name = "lnkLblText"; - this.lnkLblText.Size = new System.Drawing.Size(55, 13); - this.lnkLblText.TabIndex = 3; - this.lnkLblText.TabStop = true; - this.lnkLblText.Text = "linkLabel1"; - this.lnkLblText.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lblText_LinkClicked); - // - // lblText - // - this.lblText.AutoSize = true; - this.lblText.Location = new System.Drawing.Point(12, 9); - this.lblText.Name = "lblText"; - this.lblText.Size = new System.Drawing.Size(35, 13); - this.lblText.TabIndex = 4; - this.lblText.Text = "label1"; - // - // NetflixQCResult - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(296, 99); - this.Controls.Add(this.lblText); - this.Controls.Add(this.lnkLblText); - this.Controls.Add(this.btnOpen); - this.Controls.Add(this.btnOk); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.Name = "NetflixQCResult"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Netflix quality check"; - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Button btnOk; - private System.Windows.Forms.Button btnOpen; - private System.Windows.Forms.LinkLabel lnkLblText; - private System.Windows.Forms.Label lblText; - } -} \ No newline at end of file diff --git a/src/Forms/NetflixQCResult.cs b/src/Forms/NetflixQCResult.cs deleted file mode 100644 index 3d6c7cd33..000000000 --- a/src/Forms/NetflixQCResult.cs +++ /dev/null @@ -1,109 +0,0 @@ -using Nikse.SubtitleEdit.Logic; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Windows.Forms; -using Nikse.SubtitleEdit.Core; - -namespace Nikse.SubtitleEdit.Forms -{ - public sealed partial class NetflixQCResult : Form - { - private string Message { get; } - private List FilesToLocate { get; } - - public NetflixQCResult(string message, List filesToLocate) - { - UiUtil.PreInitialize(this); - InitializeComponent(); - UiUtil.FixFonts(this); - - Message = message; - FilesToLocate = filesToLocate; - btnOk.Text = Configuration.Settings.Language.General.Ok; - Text = Configuration.Settings.Language.Main.Menu.ToolBar.NetflixQualityCheck; - btnOpen.Text = Configuration.Settings.Language.Main.Menu.ToolBar.Open; - InitUi(); - } - - private void InitUi() - { - bool isAnyLinks = FilesToLocate.Count != 0; - Label usedLabel; - - if (isAnyLinks) - { - lblText.Visible = false; - lnkLblText.Text = Message; - usedLabel = lnkLblText; - - FilesToLocate - .Where(Message.Contains) - .ToList() - .ForEach(s => lnkLblText.Links.Add(Message.IndexOf(s, StringComparison.Ordinal), s.Length, s)); - } - else - { - lnkLblText.Visible = false; - lblText.Text = Message; - usedLabel = lblText; - } - - Width = Math.Max(usedLabel.Width + usedLabel.Left * 3, 300); - - btnOpen.Visible = isAnyLinks; - int buttonsPosMid; - - if (isAnyLinks) - { - buttonsPosMid = btnOpen.Left + (btnOk.Left + btnOk.Width - btnOpen.Left) / 2; - } - else - { - buttonsPosMid = btnOk.Left + btnOk.Width / 2; - } - - btnOpen.Left = btnOpen.Left - buttonsPosMid + Width / 2; - btnOk.Left = btnOk.Left - buttonsPosMid + Width / 2; - } - - protected override bool ProcessDialogKey(Keys keyData) - { - if (keyData == Keys.Escape) - { - Close(); - } - - return base.ProcessDialogKey(keyData); - } - - private void btnOk_Click(object sender, EventArgs e) - { - Close(); - } - - private void btnOpen_Click(object sender, EventArgs e) - { - OpenFileLocation(FilesToLocate[0]); - Close(); - } - - private void lblText_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) - { - UiUtil.OpenURL((string)e.Link.LinkData); - } - - private void OpenFileLocation(string filePath) - { - if (Configuration.IsRunningOnWindows) - { - Process.Start("explorer.exe", $@"/select,""{filePath}"" "); - } - else - { - UiUtil.OpenFolder(System.IO.Path.GetDirectoryName(filePath)); - } - } - } -} diff --git a/src/Forms/NetflixQCResult.resx b/src/Forms/NetflixQCResult.resx deleted file mode 100644 index 1af7de150..000000000 --- a/src/Forms/NetflixQCResult.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/src/SubtitleEdit.csproj b/src/SubtitleEdit.csproj index 336438048..37f1602fa 100644 --- a/src/SubtitleEdit.csproj +++ b/src/SubtitleEdit.csproj @@ -438,12 +438,6 @@ MultipleReplaceNewGroup.cs - - Form - - - NetflixQCResult.cs - Form @@ -1302,9 +1296,6 @@ MultipleReplaceNewGroup.cs - - NetflixQCResult.cs - NuendoProperties.cs