From 166ebbdc3752de708a72a7c4826713a804b3d507 Mon Sep 17 00:00:00 2001 From: sr55 Date: Thu, 7 May 2009 23:00:33 +0000 Subject: [PATCH] WinGui: - Notify users that built-in presets have been updated (when preset version < handbrake version.) - Option to disable that alert in Options > Advanced tab git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2401 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/C#/Presets/PresetsHandler.cs | 20 ++++++--- win/C#/Properties/Settings.Designer.cs | 12 ++++++ win/C#/Properties/Settings.settings | 3 ++ win/C#/app.config | 3 ++ win/C#/frmMain.cs | 11 ++++- win/C#/frmOptions.Designer.cs | 58 +++++++++++++++++--------- win/C#/frmOptions.cs | 14 ++++--- 7 files changed, 88 insertions(+), 33 deletions(-) diff --git a/win/C#/Presets/PresetsHandler.cs b/win/C#/Presets/PresetsHandler.cs index cbd654558..2ba6acc37 100644 --- a/win/C#/Presets/PresetsHandler.cs +++ b/win/C#/Presets/PresetsHandler.cs @@ -220,13 +220,7 @@ namespace Handbrake.Presets } } - // Update built-in presets if the built-in presets belong to an older version. - if (presets.Count != 0) - if (presets[0].Version != Properties.Settings.Default.hb_version) - updateBuiltInPresets(); - // Load in the users presets from user_presets.xml - if (File.Exists(userPresetFile)) { using (FileStream strm = new FileStream(userPresetFile, FileMode.Open, FileAccess.Read)) @@ -389,5 +383,19 @@ namespace Handbrake.Presets return false; } + + public Boolean checkIfPresetsAreOutOfDate() + { + loadPresetData(); + // Update built-in presets if the built-in presets belong to an older version. + if (presets.Count != 0) + if (presets[0].Version != Properties.Settings.Default.hb_version) + { + updateBuiltInPresets(); + return true; + } + + return false; + } } } \ No newline at end of file diff --git a/win/C#/Properties/Settings.Designer.cs b/win/C#/Properties/Settings.Designer.cs index c54d0be30..4b8fffbea 100644 --- a/win/C#/Properties/Settings.Designer.cs +++ b/win/C#/Properties/Settings.Designer.cs @@ -346,5 +346,17 @@ namespace Handbrake.Properties { this["dvdnav"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string presetNotification { + get { + return ((string)(this["presetNotification"])); + } + set { + this["presetNotification"] = value; + } + } } } diff --git a/win/C#/Properties/Settings.settings b/win/C#/Properties/Settings.settings index 62894d2de..a5766339d 100644 --- a/win/C#/Properties/Settings.settings +++ b/win/C#/Properties/Settings.settings @@ -83,5 +83,8 @@ + + + \ No newline at end of file diff --git a/win/C#/app.config b/win/C#/app.config index 4789bc858..f095d50d4 100644 --- a/win/C#/app.config +++ b/win/C#/app.config @@ -88,6 +88,9 @@ + + + diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index 78074b143..a8c7a8a7a 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -894,7 +894,8 @@ namespace Handbrake DataGridView chapterGridView = Main.chapterNaming(data_chpt, drop_chapterFinish.Text); if (chapterGridView != null) data_chpt = chapterGridView; - } else + } + else { Check_ChapterMarkers.Checked = false; Check_ChapterMarkers.Enabled = false; @@ -930,7 +931,7 @@ namespace Handbrake if (c_start == c_end) { Check_ChapterMarkers.Checked = false; - Check_ChapterMarkers.Enabled = false; + Check_ChapterMarkers.Enabled = false; } else Check_ChapterMarkers.Enabled = true; @@ -2002,6 +2003,12 @@ namespace Handbrake /// public void loadPresetPanel() { + if (presetHandler.checkIfPresetsAreOutOfDate()) + if (Properties.Settings.Default.presetNotification == "Unchecked") + 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); + presetHandler.getPresetPanel(ref treeView_presets); treeView_presets.Update(); } diff --git a/win/C#/frmOptions.Designer.cs b/win/C#/frmOptions.Designer.cs index e4f0cb98f..14cc9c731 100644 --- a/win/C#/frmOptions.Designer.cs +++ b/win/C#/frmOptions.Designer.cs @@ -58,6 +58,7 @@ namespace Handbrake this.txt_vlcPath = new System.Windows.Forms.TextBox(); this.label29 = new System.Windows.Forms.Label(); this.tab_cli = new System.Windows.Forms.TabPage(); + this.check_logsInSpecifiedLocation = new System.Windows.Forms.CheckBox(); this.cb_logVerboseLvl = new System.Windows.Forms.ComboBox(); this.label3 = new System.Windows.Forms.Label(); this.check_saveLogWithVideo = new System.Windows.Forms.CheckBox(); @@ -116,7 +117,7 @@ namespace Handbrake this.label26 = new System.Windows.Forms.Label(); this.label27 = new System.Windows.Forms.Label(); this.openFile_vlc = new System.Windows.Forms.OpenFileDialog(); - this.check_logsInSpecifiedLocation = new System.Windows.Forms.CheckBox(); + this.check_disablePresetNotification = new System.Windows.Forms.CheckBox(); this.tab_options.SuspendLayout(); this.tab_general.SuspendLayout(); this.tab_picture.SuspendLayout(); @@ -412,6 +413,19 @@ namespace Handbrake this.tab_cli.Text = "CLI"; this.tab_cli.UseVisualStyleBackColor = true; // + // check_logsInSpecifiedLocation + // + this.check_logsInSpecifiedLocation.AutoSize = true; + this.check_logsInSpecifiedLocation.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.check_logsInSpecifiedLocation.Location = new System.Drawing.Point(71, 201); + this.check_logsInSpecifiedLocation.Name = "check_logsInSpecifiedLocation"; + this.check_logsInSpecifiedLocation.Size = new System.Drawing.Size(306, 17); + this.check_logsInSpecifiedLocation.TabIndex = 87; + this.check_logsInSpecifiedLocation.Text = "Put individual encode logs in a specified location:"; + this.ToolTip.SetToolTip(this.check_logsInSpecifiedLocation, "Place a copy of the encode log in the same folder as the encoded movie."); + this.check_logsInSpecifiedLocation.UseVisualStyleBackColor = true; + this.check_logsInSpecifiedLocation.CheckedChanged += new System.EventHandler(this.check_logsInSpecifiedLocation_CheckedChanged); + // // cb_logVerboseLvl // this.cb_logVerboseLvl.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; @@ -584,6 +598,7 @@ namespace Handbrake // // tab_advanced // + this.tab_advanced.Controls.Add(this.check_disablePresetNotification); this.tab_advanced.Controls.Add(this.check_dvdnav); this.tab_advanced.Controls.Add(this.label32); this.tab_advanced.Controls.Add(this.label30); @@ -608,7 +623,7 @@ namespace Handbrake this.check_dvdnav.AutoSize = true; this.check_dvdnav.BackColor = System.Drawing.Color.Transparent; this.check_dvdnav.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.check_dvdnav.Location = new System.Drawing.Point(76, 184); + this.check_dvdnav.Location = new System.Drawing.Point(76, 209); this.check_dvdnav.Name = "check_dvdnav"; this.check_dvdnav.Size = new System.Drawing.Size(297, 17); this.check_dvdnav.TabIndex = 90; @@ -620,7 +635,7 @@ namespace Handbrake // this.label32.AutoSize = true; this.label32.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label32.Location = new System.Drawing.Point(38, 184); + this.label32.Location = new System.Drawing.Point(38, 209); this.label32.Name = "label32"; this.label32.Size = new System.Drawing.Size(32, 13); this.label32.TabIndex = 89; @@ -629,7 +644,7 @@ namespace Handbrake // label30 // this.label30.AutoSize = true; - this.label30.Location = new System.Drawing.Point(73, 142); + this.label30.Location = new System.Drawing.Point(73, 167); this.label30.Name = "label30"; this.label30.Size = new System.Drawing.Size(230, 13); this.label30.TabIndex = 87; @@ -645,7 +660,7 @@ namespace Handbrake "0.50", "0.25", "0.20"}); - this.drop_x264step.Location = new System.Drawing.Point(312, 139); + this.drop_x264step.Location = new System.Drawing.Point(312, 164); this.drop_x264step.Name = "drop_x264step"; this.drop_x264step.Size = new System.Drawing.Size(111, 21); this.drop_x264step.TabIndex = 86; @@ -657,7 +672,7 @@ namespace Handbrake // this.label28.AutoSize = true; this.label28.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label28.Location = new System.Drawing.Point(27, 142); + this.label28.Location = new System.Drawing.Point(27, 167); this.label28.Name = "label28"; this.label28.Size = new System.Drawing.Size(43, 13); this.label28.TabIndex = 85; @@ -682,7 +697,7 @@ namespace Handbrake // this.lbl_appcastUnstable.AutoSize = true; this.lbl_appcastUnstable.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lbl_appcastUnstable.Location = new System.Drawing.Point(6, 105); + this.lbl_appcastUnstable.Location = new System.Drawing.Point(6, 130); this.lbl_appcastUnstable.Name = "lbl_appcastUnstable"; this.lbl_appcastUnstable.Size = new System.Drawing.Size(64, 13); this.lbl_appcastUnstable.TabIndex = 83; @@ -709,7 +724,7 @@ namespace Handbrake this.check_snapshot.AutoSize = true; this.check_snapshot.BackColor = System.Drawing.Color.Transparent; this.check_snapshot.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.check_snapshot.Location = new System.Drawing.Point(76, 104); + this.check_snapshot.Location = new System.Drawing.Point(76, 129); this.check_snapshot.Name = "check_snapshot"; this.check_snapshot.Size = new System.Drawing.Size(273, 17); this.check_snapshot.TabIndex = 80; @@ -1098,18 +1113,20 @@ namespace Handbrake this.openFile_vlc.DefaultExt = "exe"; this.openFile_vlc.Filter = "exe|*.exe"; // - // check_logsInSpecifiedLocation - // - this.check_logsInSpecifiedLocation.AutoSize = true; - this.check_logsInSpecifiedLocation.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.check_logsInSpecifiedLocation.Location = new System.Drawing.Point(71, 201); - this.check_logsInSpecifiedLocation.Name = "check_logsInSpecifiedLocation"; - this.check_logsInSpecifiedLocation.Size = new System.Drawing.Size(306, 17); - this.check_logsInSpecifiedLocation.TabIndex = 87; - this.check_logsInSpecifiedLocation.Text = "Put individual encode logs in a specified location:"; - this.ToolTip.SetToolTip(this.check_logsInSpecifiedLocation, "Place a copy of the encode log in the same folder as the encoded movie."); - this.check_logsInSpecifiedLocation.UseVisualStyleBackColor = true; - this.check_logsInSpecifiedLocation.CheckedChanged += new System.EventHandler(this.check_logsInSpecifiedLocation_CheckedChanged); + // check_disablePresetNotification + // + this.check_disablePresetNotification.AutoSize = true; + this.check_disablePresetNotification.BackColor = System.Drawing.Color.Transparent; + this.check_disablePresetNotification.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.check_disablePresetNotification.Location = new System.Drawing.Point(76, 87); + this.check_disablePresetNotification.Name = "check_disablePresetNotification"; + this.check_disablePresetNotification.Size = new System.Drawing.Size(261, 17); + this.check_disablePresetNotification.TabIndex = 91; + this.check_disablePresetNotification.Text = "Disable Built-in preset update notification"; + this.ToolTip.SetToolTip(this.check_disablePresetNotification, "Disables the notification you recieve when presets are updated when a new version" + + " of HandBrake is installed."); + this.check_disablePresetNotification.UseVisualStyleBackColor = false; + this.check_disablePresetNotification.CheckedChanged += new System.EventHandler(this.check_disablePresetNotification_CheckedChanged); // // frmOptions // @@ -1224,5 +1241,6 @@ namespace Handbrake internal System.Windows.Forms.CheckBox check_dvdnav; private System.Windows.Forms.Label label32; internal System.Windows.Forms.CheckBox check_logsInSpecifiedLocation; + internal System.Windows.Forms.CheckBox check_disablePresetNotification; } } \ No newline at end of file diff --git a/win/C#/frmOptions.cs b/win/C#/frmOptions.cs index c33cc22c2..289fdb798 100644 --- a/win/C#/frmOptions.cs +++ b/win/C#/frmOptions.cs @@ -109,6 +109,9 @@ namespace Handbrake if (Properties.Settings.Default.QueryEditorTab == "Checked") check_queryEditorTab.CheckState = CheckState.Checked; + if (Properties.Settings.Default.presetNotification == "Checked") + check_disablePresetNotification.CheckState = CheckState.Checked; + // Enable snapshot updating if (Properties.Settings.Default.MainWindowMinimize == "Checked") check_mainMinimize.CheckState = CheckState.Checked; @@ -243,6 +246,11 @@ namespace Handbrake Properties.Settings.Default.QueryEditorTab = check_queryEditorTab.CheckState.ToString(); } + private void check_disablePresetNotification_CheckedChanged(object sender, EventArgs e) + { + Properties.Settings.Default.presetNotification = check_disablePresetNotification.CheckState.ToString(); + } + private void check_snapshot_CheckedChanged(object sender, EventArgs e) { Properties.Settings.Default.checkSnapshot = check_snapshot.CheckState.ToString(); @@ -263,10 +271,6 @@ namespace Handbrake { Properties.Settings.Default.Save(); // Small hack for Vista. Seems to work fine on XP without this this.Close(); - } - - - - + } } } \ No newline at end of file -- 2.40.0