From: sr55 <sr55.hb@outlook.com> Date: Mon, 22 Jun 2009 20:24:17 +0000 (+0000) Subject: WinGui: X-Git-Tag: 0.9.4~363 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5f1d29efe1d78d2019899619440250e5e760d614;p=handbrake WinGui: - Stop using Strings for CheckBoxes in IF statements. They can return a boolean values. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2599 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- diff --git a/win/C#/Controls/x264Panel.cs b/win/C#/Controls/x264Panel.cs index e86c1a105..503fcc253 100644 --- a/win/C#/Controls/x264Panel.cs +++ b/win/C#/Controls/x264Panel.cs @@ -15,7 +15,7 @@ namespace Handbrake.Controls { InitializeComponent(); - if (Properties.Settings.Default.tooltipEnable == "Checked") + if (Properties.Settings.Default.tooltipEnable) setToolTipActive(true); reset2Defaults(); diff --git a/win/C#/EncodeQueue/Encode.cs b/win/C#/EncodeQueue/Encode.cs index 6eced17c7..29d8bf874 100644 --- a/win/C#/EncodeQueue/Encode.cs +++ b/win/C#/EncodeQueue/Encode.cs @@ -34,13 +34,13 @@ namespace Handbrake.EncodeQueue string strCmdLine = String.Format(@" CMD /c """"{0}"" {1} 2>""{2}"" """, handbrakeCLIPath, query, logPath); ProcessStartInfo cliStart = new ProcessStartInfo("CMD.exe", strCmdLine); - if (Properties.Settings.Default.enocdeStatusInGui == "Checked") + if (Properties.Settings.Default.enocdeStatusInGui) { cliStart.RedirectStandardOutput = true; cliStart.UseShellExecute = false; } - if (Properties.Settings.Default.cli_minimized == "Checked") + if (Properties.Settings.Default.cli_minimized) cliStart.WindowStyle = ProcessWindowStyle.Minimized; Process[] before = Process.GetProcesses(); // Get a list of running processes before starting. @@ -174,12 +174,12 @@ namespace Handbrake.EncodeQueue File.Copy(tempLogFile, Path.Combine(logDir, encodeLogFile)); // Save a copy of the log file in the same location as the enocde. - if (Properties.Settings.Default.saveLogWithVideo == "Checked") + if (Properties.Settings.Default.saveLogWithVideo) File.Copy(tempLogFile, Path.Combine(encodeDestinationPath, encodeLogFile)); // Save a copy of the log file to a user specified location if (Directory.Exists(Properties.Settings.Default.saveLogPath)) - if (Properties.Settings.Default.saveLogPath != String.Empty && Properties.Settings.Default.saveLogToSpecifiedPath == "Checked") + if (Properties.Settings.Default.saveLogPath != String.Empty && Properties.Settings.Default.saveLogToSpecifiedPath) File.Copy(tempLogFile, Path.Combine(Properties.Settings.Default.saveLogPath, encodeLogFile)); } catch (Exception exc) diff --git a/win/C#/Functions/QueryGenerator.cs b/win/C#/Functions/QueryGenerator.cs index 604688612..373041107 100644 --- a/win/C#/Functions/QueryGenerator.cs +++ b/win/C#/Functions/QueryGenerator.cs @@ -33,7 +33,7 @@ namespace Handbrake.Functions query += " -t " + titleInfo[0]; } - if (Properties.Settings.Default.dvdnav == "Checked") + if (Properties.Settings.Default.dvdnav) if (mainWindow.drop_angle.Items.Count != 0) query += " --angle " + mainWindow.drop_angle.SelectedItem; @@ -497,7 +497,7 @@ namespace Handbrake.Functions query += " -v " + Properties.Settings.Default.verboseLevel; - if (Properties.Settings.Default.dvdnav == "Checked") + if (Properties.Settings.Default.dvdnav) query += " --dvdnav"; #endregion diff --git a/win/C#/Parsing/Title.cs b/win/C#/Parsing/Title.cs index e79dd72bd..deee24ad0 100644 --- a/win/C#/Parsing/Title.cs +++ b/win/C#/Parsing/Title.cs @@ -146,7 +146,7 @@ namespace Handbrake.Parsing output.ReadLine(); - if (Properties.Settings.Default.dvdnav == "Checked") + if (Properties.Settings.Default.dvdnav) { // Get the Angles for the title. m = Regex.Match(output.ReadLine(), @" \+ angle\(s\) ([0-9,])"); diff --git a/win/C#/Properties/Settings.Designer.cs b/win/C#/Properties/Settings.Designer.cs index f1eec40c5..c30705a1f 100644 --- a/win/C#/Properties/Settings.Designer.cs +++ b/win/C#/Properties/Settings.Designer.cs @@ -49,10 +49,10 @@ namespace Handbrake.Properties { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("Checked")] - public string defaultSettings { + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool defaultSettings { get { - return ((string)(this["defaultSettings"])); + return ((bool)(this["defaultSettings"])); } set { this["defaultSettings"] = value; @@ -61,10 +61,10 @@ namespace Handbrake.Properties { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("Checked")] - public string updateStatus { + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool updateStatus { get { - return ((string)(this["updateStatus"])); + return ((bool)(this["updateStatus"])); } set { this["updateStatus"] = value; @@ -85,10 +85,10 @@ namespace Handbrake.Properties { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("Checked")] - public string tooltipEnable { + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool tooltipEnable { get { - return ((string)(this["tooltipEnable"])); + return ((bool)(this["tooltipEnable"])); } set { this["tooltipEnable"] = value; @@ -145,10 +145,10 @@ namespace Handbrake.Properties { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("Checked")] - public string autoNaming { + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool autoNaming { get { - return ((string)(this["autoNaming"])); + return ((bool)(this["autoNaming"])); } set { this["autoNaming"] = value; @@ -193,10 +193,10 @@ namespace Handbrake.Properties { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("Checked")] - public string drive_detection { + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool drive_detection { get { - return ((string)(this["drive_detection"])); + return ((bool)(this["drive_detection"])); } set { this["drive_detection"] = value; @@ -205,10 +205,10 @@ namespace Handbrake.Properties { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("")] - public string cli_minimized { + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool cli_minimized { get { - return ((string)(this["cli_minimized"])); + return ((bool)(this["cli_minimized"])); } set { this["cli_minimized"] = value; @@ -229,10 +229,10 @@ namespace Handbrake.Properties { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("")] - public string saveLogToSpecifiedPath { + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool saveLogToSpecifiedPath { get { - return ((string)(this["saveLogToSpecifiedPath"])); + return ((bool)(this["saveLogToSpecifiedPath"])); } set { this["saveLogToSpecifiedPath"] = value; @@ -253,10 +253,10 @@ namespace Handbrake.Properties { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("")] - public string saveLogWithVideo { + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool saveLogWithVideo { get { - return ((string)(this["saveLogWithVideo"])); + return ((bool)(this["saveLogWithVideo"])); } set { this["saveLogWithVideo"] = value; @@ -265,7 +265,7 @@ namespace Handbrake.Properties { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("T:\\Program Files\\VideoLAN\\vlc\\vlc.exe")] + [global::System.Configuration.DefaultSettingValueAttribute("C:\\Program Files\\VideoLAN\\vlc\\vlc.exe")] public string VLC_Path { get { return ((string)(this["VLC_Path"])); @@ -277,10 +277,10 @@ namespace Handbrake.Properties { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("Checked")] - public string MainWindowMinimize { + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool MainWindowMinimize { get { - return ((string)(this["MainWindowMinimize"])); + return ((bool)(this["MainWindowMinimize"])); } set { this["MainWindowMinimize"] = value; @@ -289,10 +289,10 @@ namespace Handbrake.Properties { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("")] - public string QueryEditorTab { + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool QueryEditorTab { get { - return ((string)(this["QueryEditorTab"])); + return ((bool)(this["QueryEditorTab"])); } set { this["QueryEditorTab"] = value; @@ -325,10 +325,10 @@ namespace Handbrake.Properties { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("")] - public string dvdnav { + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool dvdnav { get { - return ((string)(this["dvdnav"])); + return ((bool)(this["dvdnav"])); } set { this["dvdnav"] = value; @@ -337,10 +337,10 @@ namespace Handbrake.Properties { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("")] - public string presetNotification { + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool presetNotification { get { - return ((string)(this["presetNotification"])); + return ((bool)(this["presetNotification"])); } set { this["presetNotification"] = value; @@ -349,10 +349,10 @@ namespace Handbrake.Properties { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("")] - public string enocdeStatusInGui { + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool enocdeStatusInGui { get { - return ((string)(this["enocdeStatusInGui"])); + return ((bool)(this["enocdeStatusInGui"])); } set { this["enocdeStatusInGui"] = value; @@ -361,10 +361,10 @@ namespace Handbrake.Properties { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("")] - public string trayIconAlerts { + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool trayIconAlerts { get { - return ((string)(this["trayIconAlerts"])); + return ((bool)(this["trayIconAlerts"])); } set { this["trayIconAlerts"] = value; diff --git a/win/C#/Properties/Settings.settings b/win/C#/Properties/Settings.settings index 5102e49b1..c710782bd 100644 --- a/win/C#/Properties/Settings.settings +++ b/win/C#/Properties/Settings.settings @@ -8,17 +8,17 @@ <Setting Name="Processors" Type="System.String" Scope="User"> <Value Profile="(Default)">Automatic</Value> </Setting> - <Setting Name="defaultSettings" Type="System.String" Scope="User"> - <Value Profile="(Default)">Checked</Value> + <Setting Name="defaultSettings" Type="System.Boolean" Scope="User"> + <Value Profile="(Default)">True</Value> </Setting> - <Setting Name="updateStatus" Type="System.String" Scope="User"> - <Value Profile="(Default)">Checked</Value> + <Setting Name="updateStatus" Type="System.Boolean" Scope="User"> + <Value Profile="(Default)">True</Value> </Setting> <Setting Name="hb_version" Type="System.String" Scope="User"> <Value Profile="(Default)">{hb_version}</Value> </Setting> - <Setting Name="tooltipEnable" Type="System.String" Scope="User"> - <Value Profile="(Default)">Checked</Value> + <Setting Name="tooltipEnable" Type="System.Boolean" Scope="User"> + <Value Profile="(Default)">True</Value> </Setting> <Setting Name="CompletionOption" Type="System.String" Scope="User"> <Value Profile="(Default)">Do Nothing</Value> @@ -32,8 +32,8 @@ <Setting Name="skipversion" Type="System.Int32" Scope="User"> <Value Profile="(Default)">0</Value> </Setting> - <Setting Name="autoNaming" Type="System.String" Scope="User"> - <Value Profile="(Default)">Checked</Value> + <Setting Name="autoNaming" Type="System.Boolean" Scope="User"> + <Value Profile="(Default)">True</Value> </Setting> <Setting Name="autoNamePath" Type="System.String" Scope="User"> <Value Profile="(Default)" /> @@ -44,32 +44,32 @@ <Setting Name="appcast_unstable" Type="System.String" Scope="User"> <Value Profile="(Default)">http://handbrake.fr/appcast_unstable.xml</Value> </Setting> - <Setting Name="drive_detection" Type="System.String" Scope="User"> - <Value Profile="(Default)">Checked</Value> + <Setting Name="drive_detection" Type="System.Boolean" Scope="User"> + <Value Profile="(Default)">True</Value> </Setting> - <Setting Name="cli_minimized" Type="System.String" Scope="User"> - <Value Profile="(Default)" /> + <Setting Name="cli_minimized" Type="System.Boolean" Scope="User"> + <Value Profile="(Default)">False</Value> </Setting> <Setting Name="autoNameFormat" Type="System.String" Scope="User"> <Value Profile="(Default)">{source}-{title}</Value> </Setting> - <Setting Name="saveLogToSpecifiedPath" Type="System.String" Scope="User"> - <Value Profile="(Default)" /> + <Setting Name="saveLogToSpecifiedPath" Type="System.Boolean" Scope="User"> + <Value Profile="(Default)">False</Value> </Setting> <Setting Name="saveLogPath" Type="System.String" Scope="User"> <Value Profile="(Default)" /> </Setting> - <Setting Name="saveLogWithVideo" Type="System.String" Scope="User"> - <Value Profile="(Default)" /> + <Setting Name="saveLogWithVideo" Type="System.Boolean" Scope="User"> + <Value Profile="(Default)">False</Value> </Setting> <Setting Name="VLC_Path" Type="System.String" Scope="User"> - <Value Profile="(Default)">T:\Program Files\VideoLAN\vlc\vlc.exe</Value> + <Value Profile="(Default)">C:\Program Files\VideoLAN\vlc\vlc.exe</Value> </Setting> - <Setting Name="MainWindowMinimize" Type="System.String" Scope="User"> - <Value Profile="(Default)">Checked</Value> + <Setting Name="MainWindowMinimize" Type="System.Boolean" Scope="User"> + <Value Profile="(Default)">False</Value> </Setting> - <Setting Name="QueryEditorTab" Type="System.String" Scope="User"> - <Value Profile="(Default)" /> + <Setting Name="QueryEditorTab" Type="System.Boolean" Scope="User"> + <Value Profile="(Default)">False</Value> </Setting> <Setting Name="x264cqstep" Type="System.String" Scope="User"> <Value Profile="(Default)">0.25</Value> @@ -77,17 +77,17 @@ <Setting Name="verboseLevel" Type="System.Int32" Scope="User"> <Value Profile="(Default)">1</Value> </Setting> - <Setting Name="dvdnav" Type="System.String" Scope="User"> - <Value Profile="(Default)" /> + <Setting Name="dvdnav" Type="System.Boolean" Scope="User"> + <Value Profile="(Default)">False</Value> </Setting> - <Setting Name="presetNotification" Type="System.String" Scope="User"> - <Value Profile="(Default)" /> + <Setting Name="presetNotification" Type="System.Boolean" Scope="User"> + <Value Profile="(Default)">False</Value> </Setting> - <Setting Name="enocdeStatusInGui" Type="System.String" Scope="User"> - <Value Profile="(Default)" /> + <Setting Name="enocdeStatusInGui" Type="System.Boolean" Scope="User"> + <Value Profile="(Default)">False</Value> </Setting> - <Setting Name="trayIconAlerts" Type="System.String" Scope="User"> - <Value Profile="(Default)" /> + <Setting Name="trayIconAlerts" Type="System.Boolean" Scope="User"> + <Value Profile="(Default)">True</Value> </Setting> <Setting Name="lastUpdateCheckDate" Type="System.DateTime" Scope="User"> <Value Profile="(Default)" /> diff --git a/win/C#/app.config b/win/C#/app.config index 54978e84b..acd4d45ca 100644 --- a/win/C#/app.config +++ b/win/C#/app.config @@ -14,16 +14,16 @@ <value>Automatic</value> </setting> <setting name="defaultSettings" serializeAs="String"> - <value>Checked</value> + <value>True</value> </setting> <setting name="updateStatus" serializeAs="String"> - <value>Checked</value> + <value>True</value> </setting> <setting name="hb_version" serializeAs="String"> <value>{hb_version}</value> </setting> <setting name="tooltipEnable" serializeAs="String"> - <value>Checked</value> + <value>True</value> </setting> <setting name="CompletionOption" serializeAs="String"> <value>Do Nothing</value> @@ -38,7 +38,7 @@ <value>0</value> </setting> <setting name="autoNaming" serializeAs="String"> - <value>Checked</value> + <value>True</value> </setting> <setting name="autoNamePath" serializeAs="String"> <value /> @@ -50,31 +50,31 @@ <value>http://handbrake.fr/appcast_unstable.xml</value> </setting> <setting name="drive_detection" serializeAs="String"> - <value>Checked</value> + <value>True</value> </setting> <setting name="cli_minimized" serializeAs="String"> - <value /> + <value>False</value> </setting> <setting name="autoNameFormat" serializeAs="String"> <value>{source}-{title}</value> </setting> <setting name="saveLogToSpecifiedPath" serializeAs="String"> - <value /> + <value>False</value> </setting> <setting name="saveLogPath" serializeAs="String"> <value /> </setting> <setting name="saveLogWithVideo" serializeAs="String"> - <value /> + <value>False</value> </setting> <setting name="VLC_Path" serializeAs="String"> - <value>T:\Program Files\VideoLAN\vlc\vlc.exe</value> + <value>C:\Program Files\VideoLAN\vlc\vlc.exe</value> </setting> <setting name="MainWindowMinimize" serializeAs="String"> - <value>Checked</value> + <value>False</value> </setting> <setting name="QueryEditorTab" serializeAs="String"> - <value /> + <value>False</value> </setting> <setting name="x264cqstep" serializeAs="String"> <value>0.25</value> @@ -83,16 +83,16 @@ <value>1</value> </setting> <setting name="dvdnav" serializeAs="String"> - <value /> + <value>False</value> </setting> <setting name="presetNotification" serializeAs="String"> - <value /> + <value>False</value> </setting> <setting name="enocdeStatusInGui" serializeAs="String"> - <value /> + <value>False</value> </setting> <setting name="trayIconAlerts" serializeAs="String"> - <value /> + <value>True</value> </setting> <setting name="lastUpdateCheckDate" serializeAs="String"> <value /> diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index 29622cb0a..c192be541 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -60,7 +60,7 @@ namespace Handbrake Application.DoEvents(); // Forces frmMain to draw // Check for new versions, if update checking is enabled - if (Properties.Settings.Default.updateStatus == "Checked") + if (Properties.Settings.Default.updateStatus) { DateTime now = DateTime.Now; DateTime lastCheck = Properties.Settings.Default.lastUpdateCheckDate; @@ -82,11 +82,11 @@ namespace Handbrake treeView_presets.ExpandAll(); lbl_encode.Text = ""; queueWindow = new frmQueue(encodeQueue); // Prepare the Queue - if (Properties.Settings.Default.QueryEditorTab != "Checked") + if (Properties.Settings.Default.QueryEditorTab) tabs_panel.TabPages.RemoveAt(7); // Remove the query editor tab if the user does not want it enabled. // Load the user's default settings or Normal Preset - if (Properties.Settings.Default.defaultSettings == "Checked" && Properties.Settings.Default.defaultPreset != "") + if (Properties.Settings.Default.defaultSettings && Properties.Settings.Default.defaultPreset != "") { if (presetHandler.getPreset(Properties.Settings.Default.defaultPreset) != null) { @@ -114,7 +114,7 @@ namespace Handbrake loadNormalPreset(); // Enabled GUI tooltip's if Required - if (Properties.Settings.Default.tooltipEnable == "Checked") + if (Properties.Settings.Default.tooltipEnable) ToolTip.Active = true; //Finished Loading @@ -176,7 +176,7 @@ namespace Handbrake private void events() { // Handle Window Resize - if (Properties.Settings.Default.MainWindowMinimize == "Checked") + if (Properties.Settings.Default.MainWindowMinimize) this.Resize += new EventHandler(frmMain_Resize); // Handle Encode Start / Finish / Pause @@ -219,7 +219,7 @@ namespace Handbrake setEncodeStarted(); // Experimental HBProc Process Monitoring. - if (Properties.Settings.Default.enocdeStatusInGui == "Checked") + if (Properties.Settings.Default.enocdeStatusInGui) { Thread encodeMon = new Thread(encodeMonitorThread); encodeMon.Start(); @@ -262,8 +262,8 @@ namespace Handbrake } private void mnu_options_Click(object sender, EventArgs e) { - Form Options = new frmOptions(); - Options.ShowDialog(); + Form options = new frmOptions(); + options.ShowDialog(); } #endregion @@ -510,7 +510,7 @@ namespace Handbrake #region ToolStrip private void btn_source_Click(object sender, EventArgs e) { - if (Properties.Settings.Default.drive_detection == "Checked") + if (Properties.Settings.Default.drive_detection) { mnu_dvd_drive.Visible = true; Thread driveInfoThread = new Thread(getDriveInfoThread); @@ -632,12 +632,6 @@ namespace Handbrake if (FormWindowState.Minimized == this.WindowState) { notifyIcon.Visible = true; - if (!encodeQueue.isEncoding) - { - notifyIcon.BalloonTipText = lbl_encode.Text != "" ? lbl_encode.Text : "Not Encoding"; - if (Properties.Settings.Default.trayIconAlerts == "Checked") - notifyIcon.ShowBalloonTip(500); - } this.Hide(); } else if (FormWindowState.Normal == this.WindowState) @@ -760,13 +754,13 @@ namespace Handbrake // Otheriwse if its not, title data has to be loased from parsing. if (drp_dvdtitle.Text != "Automatic") { - selectedTitle = drp_dvdtitle.SelectedItem as Parsing.Title; + selectedTitle = drp_dvdtitle.SelectedItem as Title; lbl_duration.Text = selectedTitle.Duration.ToString(); PictureSettings.setComponentsAfterScan(selectedTitle); // Setup Picture Settings Tab Control // Populate the Angles dropdown drop_angle.Items.Clear(); - if (Properties.Settings.Default.dvdnav == "Checked") + if (Properties.Settings.Default.dvdnav) { drop_angle.Visible = true; lbl_angle.Visible = true; @@ -803,7 +797,7 @@ namespace Handbrake } // Run the autoName & chapterNaming functions - if (Properties.Settings.Default.autoNaming == "Checked") + if (Properties.Settings.Default.autoNaming) { string autoPath = Main.autoName(drp_dvdtitle, drop_chapterStart.Text, drop_chapterFinish.Text, text_source.Text, text_destination.Text, drop_format.SelectedIndex); if (autoPath != null) @@ -848,7 +842,7 @@ namespace Handbrake lbl_duration.Text = Main.calculateDuration(drop_chapterStart.Text, drop_chapterFinish.Text, selectedTitle).ToString(); // Run the Autonaming function - if (Properties.Settings.Default.autoNaming == "Checked") + if (Properties.Settings.Default.autoNaming) text_destination.Text = Main.autoName(drp_dvdtitle, drop_chapterStart.Text, drop_chapterFinish.Text, text_source.Text, text_destination.Text, drop_format.SelectedIndex); // Disable chapter markers if only 1 chapter is selected. @@ -879,7 +873,7 @@ namespace Handbrake lbl_duration.Text = Main.calculateDuration(drop_chapterStart.Text, drop_chapterFinish.Text, selectedTitle).ToString(); // Run the Autonaming function - if (Properties.Settings.Default.autoNaming == "Checked") + if (Properties.Settings.Default.autoNaming) text_destination.Text = Main.autoName(drp_dvdtitle, drop_chapterStart.Text, drop_chapterFinish.Text, text_source.Text, text_destination.Text, drop_format.SelectedIndex); // Add more rows to the Chapter menu if needed. @@ -1262,7 +1256,7 @@ namespace Handbrake File.Delete(dvdInfoPath); String dvdnav = string.Empty; - if (Properties.Settings.Default.dvdnav == "Checked") + if (Properties.Settings.Default.dvdnav) dvdnav = " --dvdnav"; string strCmdLine = String.Format(@"cmd /c """"{0}"" -i ""{1}"" -t0 {2} -v >""{3}"" 2>&1""", handbrakeCLIPath, inputFile, dvdnav, dvdInfoPath); @@ -1432,11 +1426,12 @@ namespace Handbrake btn_start.Image = Properties.Resources.Play; // If the window is minimized, display the notification in a popup. - if (FormWindowState.Minimized == this.WindowState) - { - notifyIcon.BalloonTipText = lbl_encode.Text; - notifyIcon.ShowBalloonTip(500); - } + if (Properties.Settings.Default.trayIconAlerts) + if (FormWindowState.Minimized == this.WindowState) + { + notifyIcon.BalloonTipText = lbl_encode.Text; + notifyIcon.ShowBalloonTip(500); + } } catch (Exception exc) { @@ -1460,7 +1455,7 @@ namespace Handbrake lbl_encode.Visible = true; lbl_encode.Text = "Encoding in Progress"; btn_start.Text = "Stop"; - btn_start.ToolTipText = "Stop the encoding process. \nWarning: This may break your file. Press ctrl-c in the CLI window if you wish it to exit cleanly."; + btn_start.ToolTipText = "Stop the encoding process."; btn_start.Image = Properties.Resources.stop; } catch (Exception exc) @@ -1514,7 +1509,7 @@ namespace Handbrake public void loadPresetPanel() { if (presetHandler.checkIfPresetsAreOutOfDate()) - if (Properties.Settings.Default.presetNotification == "Unchecked") + if (!Properties.Settings.Default.presetNotification) MessageBox.Show( "HandBrake has determined your built-in presets are out of date... These presets will now be updated.", "Preset Update", MessageBoxButtons.OK, MessageBoxIcon.Information); diff --git a/win/C#/frmOptions.cs b/win/C#/frmOptions.cs index 978ffbcfe..2f4496a1e 100644 --- a/win/C#/frmOptions.cs +++ b/win/C#/frmOptions.cs @@ -20,25 +20,25 @@ namespace Handbrake // ############################# // Enable Tooltips. - if (Properties.Settings.Default.tooltipEnable == "Checked") + if (Properties.Settings.Default.tooltipEnable) { check_tooltip.CheckState = CheckState.Checked; ToolTip.Active = true; } // Setup Widgets to match settings. - if (Properties.Settings.Default.updateStatus == "Checked") + if (Properties.Settings.Default.updateStatus) check_updateCheck.CheckState = CheckState.Checked; // enable loading of default user settings. - if (Properties.Settings.Default.defaultSettings == "Checked") + if (Properties.Settings.Default.defaultSettings) check_userDefaultSettings.CheckState = CheckState.Checked; // On Encode Completeion Action drp_completeOption.Text = Properties.Settings.Default.CompletionOption; // Enable auto naming feature. - if (Properties.Settings.Default.autoNaming == "Checked") + if (Properties.Settings.Default.autoNaming) check_autoNaming.CheckState = CheckState.Checked; // Store the auto name path @@ -61,7 +61,7 @@ namespace Handbrake // ############################# // Enable Start CLI minimized - if (Properties.Settings.Default.cli_minimized == "Checked") + if (Properties.Settings.Default.cli_minimized) check_cli_minimized.CheckState = CheckState.Checked; // Number of processor cores @@ -75,11 +75,11 @@ namespace Handbrake // Save logs in the same directory as encoded files - if (Properties.Settings.Default.saveLogWithVideo == "Checked") + if (Properties.Settings.Default.saveLogWithVideo) check_saveLogWithVideo.CheckState = CheckState.Checked; // Save Logs in a specified path - if (Properties.Settings.Default.saveLogToSpecifiedPath == "Checked") + if (Properties.Settings.Default.saveLogToSpecifiedPath) check_logsInSpecifiedLocation.CheckState = CheckState.Checked; // The saved log path @@ -91,27 +91,27 @@ namespace Handbrake // ############################# // Enable GUI DVD Drive detection code - if (Properties.Settings.Default.drive_detection == "Checked") + if (Properties.Settings.Default.drive_detection) btn_drive_detect.CheckState = CheckState.Checked; // Minimise to Tray - if (Properties.Settings.Default.trayIconAlerts == "Checked") + if (Properties.Settings.Default.trayIconAlerts) check_trayStatusAlerts.CheckState = CheckState.Checked; // Tray Balloon popups - if (Properties.Settings.Default.MainWindowMinimize == "Checked") + if (Properties.Settings.Default.MainWindowMinimize) check_mainMinimize.CheckState = CheckState.Checked; // Enable / Disable Query editor tab - if (Properties.Settings.Default.QueryEditorTab == "Checked") + if (Properties.Settings.Default.QueryEditorTab) check_queryEditorTab.CheckState = CheckState.Checked; // Preset update notification - if (Properties.Settings.Default.presetNotification == "Checked") + if (Properties.Settings.Default.presetNotification) check_disablePresetNotification.CheckState = CheckState.Checked; // Experimental In-GUI encode status indicator. - if (Properties.Settings.Default.enocdeStatusInGui == "Checked") + if (Properties.Settings.Default.enocdeStatusInGui) check_inGuiStatus.CheckState = CheckState.Checked; // Days between update checks @@ -121,24 +121,24 @@ namespace Handbrake drop_x264step.SelectedItem = Properties.Settings.Default.x264cqstep; // Use Experimental dvdnav - if (Properties.Settings.Default.dvdnav == "Checked") + if (Properties.Settings.Default.dvdnav) check_dvdnav.CheckState = CheckState.Checked; } #region General private void check_updateCheck_CheckedChanged(object sender, EventArgs e) { - Properties.Settings.Default.updateStatus = check_updateCheck.CheckState.ToString(); + Properties.Settings.Default.updateStatus = check_updateCheck.Checked; } private void check_userDefaultSettings_CheckedChanged(object sender, EventArgs e) { - Properties.Settings.Default.defaultSettings = check_userDefaultSettings.CheckState.ToString(); + Properties.Settings.Default.defaultSettings = check_userDefaultSettings.Checked; } private void check_tooltip_CheckedChanged(object sender, EventArgs e) { - Properties.Settings.Default.tooltipEnable = check_tooltip.CheckState.ToString(); + Properties.Settings.Default.tooltipEnable = check_tooltip.Checked; } private void drp_completeOption_SelectedIndexChanged(object sender, EventArgs e) { @@ -147,7 +147,7 @@ namespace Handbrake private void check_autoNaming_CheckedChanged(object sender, EventArgs e) { - Properties.Settings.Default.autoNaming = check_autoNaming.CheckState.ToString(); + Properties.Settings.Default.autoNaming = check_autoNaming.Checked; } private void txt_autoNameFormat_TextChanged(object sender, EventArgs e) @@ -189,7 +189,7 @@ namespace Handbrake #region CLI private void check_cli_minimized_CheckedChanged(object sender, EventArgs e) { - Properties.Settings.Default.cli_minimized = check_cli_minimized.CheckState.ToString(); + Properties.Settings.Default.cli_minimized = check_cli_minimized.Checked; } private void drp_processors_SelectedIndexChanged(object sender, EventArgs e) @@ -209,11 +209,11 @@ namespace Handbrake private void check_saveLogWithVideo_CheckedChanged(object sender, EventArgs e) { - Properties.Settings.Default.saveLogWithVideo = check_saveLogWithVideo.CheckState.ToString(); + Properties.Settings.Default.saveLogWithVideo = check_saveLogWithVideo.Checked; } private void check_logsInSpecifiedLocation_CheckedChanged(object sender, EventArgs e) { - Properties.Settings.Default.saveLogToSpecifiedPath = check_logsInSpecifiedLocation.CheckState.ToString(); + Properties.Settings.Default.saveLogToSpecifiedPath = check_logsInSpecifiedLocation.Checked; } private void btn_saveLog_Click(object sender, EventArgs e) @@ -234,32 +234,32 @@ namespace Handbrake #region Advanced private void btn_drive_detect_CheckedChanged(object sender, EventArgs e) { - Properties.Settings.Default.drive_detection = btn_drive_detect.CheckState.ToString(); + Properties.Settings.Default.drive_detection = btn_drive_detect.Checked; } private void check_mainMinimize_CheckedChanged(object sender, EventArgs e) { - Properties.Settings.Default.MainWindowMinimize = check_mainMinimize.CheckState.ToString(); + Properties.Settings.Default.MainWindowMinimize = check_mainMinimize.Checked; } private void check_trayStatusAlerts_CheckedChanged(object sender, EventArgs e) { - Properties.Settings.Default.trayIconAlerts = check_trayStatusAlerts.CheckState.ToString(); + Properties.Settings.Default.trayIconAlerts = check_trayStatusAlerts.Checked; } private void check_queryEditorTab_CheckedChanged(object sender, EventArgs e) { - Properties.Settings.Default.QueryEditorTab = check_queryEditorTab.CheckState.ToString(); + Properties.Settings.Default.QueryEditorTab = check_queryEditorTab.Checked; } private void check_disablePresetNotification_CheckedChanged(object sender, EventArgs e) { - Properties.Settings.Default.presetNotification = check_disablePresetNotification.CheckState.ToString(); + Properties.Settings.Default.presetNotification = check_disablePresetNotification.Checked; } private void check_inGuiStatus_CheckedChanged(object sender, EventArgs e) { - Properties.Settings.Default.enocdeStatusInGui = check_inGuiStatus.CheckState.ToString(); + Properties.Settings.Default.enocdeStatusInGui = check_inGuiStatus.Checked; } private void numeric_updateCheckDays_ValueChanged(object sender, EventArgs e) @@ -274,7 +274,7 @@ namespace Handbrake private void check_dvdnav_CheckedChanged(object sender, EventArgs e) { - Properties.Settings.Default.dvdnav = check_dvdnav.CheckState.ToString(); + Properties.Settings.Default.dvdnav = check_dvdnav.Checked; } #endregion