diff options
author | sr55 <[email protected]> | 2008-10-30 21:15:28 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2008-10-30 21:15:28 +0000 |
commit | db7164860c6d50c56a0a14689ee6251011a6a994 (patch) | |
tree | 7f772927154288a5128a3eac1453c7763399e23c /win | |
parent | 9834623a06e533d557ec8919e4238e207886f9a7 (diff) |
WinGui:
- Activity logs for individual encodes can now be saved either:
+ With the encoded file
+ or to a a directory which is configured from options.
Log file format: "YYYY-MM-DD HH-MM-SS {Destination File Name}.txt"
Feature is disabled by default
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1883 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win')
-rw-r--r-- | win/C#/Functions/Encode.cs | 35 | ||||
-rw-r--r-- | win/C#/Properties/Settings.Designer.cs | 36 | ||||
-rw-r--r-- | win/C#/Properties/Settings.settings | 9 | ||||
-rw-r--r-- | win/C#/app.config | 9 | ||||
-rw-r--r-- | win/C#/frmMain.cs | 1 | ||||
-rw-r--r-- | win/C#/frmOptions.Designer.cs | 99 | ||||
-rw-r--r-- | win/C#/frmOptions.cs | 180 | ||||
-rw-r--r-- | win/C#/frmQueue.cs | 3 |
8 files changed, 317 insertions, 55 deletions
diff --git a/win/C#/Functions/Encode.cs b/win/C#/Functions/Encode.cs index f2fb11440..f79f45a9b 100644 --- a/win/C#/Functions/Encode.cs +++ b/win/C#/Functions/Encode.cs @@ -16,7 +16,7 @@ using System.Runtime.InteropServices; namespace Handbrake.Functions
{
public class Encode
- {
+ {
/// <summary>
/// CLI output is based on en-US locale,
/// we use this CultureInfo as IFormatProvider to *.Parse() calls
@@ -106,5 +106,38 @@ namespace Handbrake.Functions break;
}
}
+
+ public void copyLog(string query)
+ {
+ // The user may wish to do something with the log.
+ if (Properties.Settings.Default.saveLog == "Checked")
+ {
+ string logPath = Path.Combine(Path.GetTempPath(), "hb_encode_log.dat");
+ Functions.QueryParser parsed = Functions.QueryParser.Parse(query);
+
+ if (Properties.Settings.Default.saveLogWithVideo == "Checked")
+ {
+ string[] destName = parsed.Destination.Split('\\');
+ string destinationFile = "";
+ for (int i = 0; i < destName.Length - 1; i++)
+ {
+ destinationFile += destName[i] + "\\";
+ }
+
+ destinationFile += DateTime.Now.ToString().Replace("/", "-").Replace(":", "-") + " " + destName[destName.Length - 1] + ".txt";
+
+ File.Copy(logPath, destinationFile);
+ }
+ else if (Properties.Settings.Default.saveLogPath != String.Empty)
+ {
+ string[] destName = parsed.Destination.Split('\\');
+ string dest = destName[destName.Length - 1];
+ string filename = DateTime.Now.ToString().Replace("/", "-").Replace(":", "-") + " " + dest + ".txt";
+ string useDefinedLogPath = Path.Combine(Properties.Settings.Default.saveLogPath, filename);
+
+ File.Copy(logPath, useDefinedLogPath);
+ }
+ }
+ }
}
}
diff --git a/win/C#/Properties/Settings.Designer.cs b/win/C#/Properties/Settings.Designer.cs index f1ce04bcd..b86973431 100644 --- a/win/C#/Properties/Settings.Designer.cs +++ b/win/C#/Properties/Settings.Designer.cs @@ -262,5 +262,41 @@ namespace Handbrake.Properties { this["autoNameFormat"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("")]
+ public string saveLog {
+ get {
+ return ((string)(this["saveLog"]));
+ }
+ set {
+ this["saveLog"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("")]
+ public string saveLogPath {
+ get {
+ return ((string)(this["saveLogPath"]));
+ }
+ set {
+ this["saveLogPath"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("")]
+ public string saveLogWithVideo {
+ get {
+ return ((string)(this["saveLogWithVideo"]));
+ }
+ set {
+ this["saveLogWithVideo"] = value;
+ }
+ }
}
}
diff --git a/win/C#/Properties/Settings.settings b/win/C#/Properties/Settings.settings index 60694165d..40a2e12be 100644 --- a/win/C#/Properties/Settings.settings +++ b/win/C#/Properties/Settings.settings @@ -62,5 +62,14 @@ <Setting Name="autoNameFormat" Type="System.String" Scope="User">
<Value Profile="(Default)">{source}-{title}-{chapters}</Value>
</Setting>
+ <Setting Name="saveLog" Type="System.String" Scope="User">
+ <Value Profile="(Default)" />
+ </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>
</Settings>
</SettingsFile>
\ No newline at end of file diff --git a/win/C#/app.config b/win/C#/app.config index ce66d92db..b5a65a74e 100644 --- a/win/C#/app.config +++ b/win/C#/app.config @@ -67,6 +67,15 @@ <setting name="autoNameFormat" serializeAs="String">
<value>{source}-{title}-{chapters}</value>
</setting>
+ <setting name="saveLog" serializeAs="String">
+ <value />
+ </setting>
+ <setting name="saveLogPath" serializeAs="String">
+ <value />
+ </setting>
+ <setting name="saveLogWithVideo" serializeAs="String">
+ <value />
+ </setting>
</Handbrake.Properties.Settings>
</userSettings>
</configuration>
\ No newline at end of file diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index 652ff22dd..d3595e46b 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -1849,6 +1849,7 @@ namespace Handbrake }
// After the encode is done, we may want to shutdown, suspend etc.
+ cliObj.copyLog((string)state);
cliObj.afterEncodeAction();
}
}
diff --git a/win/C#/frmOptions.Designer.cs b/win/C#/frmOptions.Designer.cs index dff23d9e4..91bd684fa 100644 --- a/win/C#/frmOptions.Designer.cs +++ b/win/C#/frmOptions.Designer.cs @@ -57,6 +57,13 @@ namespace Handbrake this.txt_decomb = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.tab_cli = new System.Windows.Forms.TabPage();
+ this.label15 = new System.Windows.Forms.Label();
+ this.check_saveLogWithVideo = new System.Windows.Forms.CheckBox();
+ this.btn_saveLog = new System.Windows.Forms.Button();
+ this.label14 = new System.Windows.Forms.Label();
+ this.text_logPath = new System.Windows.Forms.TextBox();
+ this.check_keepLogs = new System.Windows.Forms.CheckBox();
+ this.label9 = new System.Windows.Forms.Label();
this.check_cli_minimized = new System.Windows.Forms.CheckBox();
this.label12 = new System.Windows.Forms.Label();
this.drp_Priority = new System.Windows.Forms.ComboBox();
@@ -331,6 +338,13 @@ namespace Handbrake //
// tab_cli
//
+ this.tab_cli.Controls.Add(this.label15);
+ this.tab_cli.Controls.Add(this.check_saveLogWithVideo);
+ this.tab_cli.Controls.Add(this.btn_saveLog);
+ this.tab_cli.Controls.Add(this.label14);
+ this.tab_cli.Controls.Add(this.text_logPath);
+ this.tab_cli.Controls.Add(this.check_keepLogs);
+ this.tab_cli.Controls.Add(this.label9);
this.tab_cli.Controls.Add(this.check_cli_minimized);
this.tab_cli.Controls.Add(this.label12);
this.tab_cli.Controls.Add(this.drp_Priority);
@@ -344,6 +358,84 @@ namespace Handbrake this.tab_cli.Text = "CLI";
this.tab_cli.UseVisualStyleBackColor = true;
//
+ // label15
+ //
+ this.label15.AutoSize = true;
+ this.label15.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.label15.Location = new System.Drawing.Point(195, 197);
+ this.label15.Name = "label15";
+ this.label15.Size = new System.Drawing.Size(24, 13);
+ this.label15.TabIndex = 84;
+ this.label15.Text = "OR";
+ //
+ // check_saveLogWithVideo
+ //
+ this.check_saveLogWithVideo.AutoSize = true;
+ this.check_saveLogWithVideo.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.check_saveLogWithVideo.Location = new System.Drawing.Point(71, 177);
+ this.check_saveLogWithVideo.Name = "check_saveLogWithVideo";
+ this.check_saveLogWithVideo.Size = new System.Drawing.Size(349, 17);
+ this.check_saveLogWithVideo.TabIndex = 83;
+ this.check_saveLogWithVideo.Text = "Put individual encode logs in the same location as movie";
+ this.ToolTip.SetToolTip(this.check_saveLogWithVideo, "Place a copy of the encode log in the same folder as the encoded movie.");
+ this.check_saveLogWithVideo.UseVisualStyleBackColor = true;
+ this.check_saveLogWithVideo.CheckedChanged += new System.EventHandler(this.check_saveLogWithVideo_CheckedChanged);
+ //
+ // btn_saveLog
+ //
+ this.btn_saveLog.FlatAppearance.BorderColor = System.Drawing.Color.Black;
+ this.btn_saveLog.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.btn_saveLog.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
+ this.btn_saveLog.Location = new System.Drawing.Point(343, 218);
+ this.btn_saveLog.Name = "btn_saveLog";
+ this.btn_saveLog.Size = new System.Drawing.Size(68, 22);
+ this.btn_saveLog.TabIndex = 82;
+ this.btn_saveLog.Text = "Browse";
+ this.btn_saveLog.UseVisualStyleBackColor = true;
+ this.btn_saveLog.Click += new System.EventHandler(this.btn_saveLog_Click);
+ //
+ // label14
+ //
+ this.label14.AutoSize = true;
+ this.label14.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.label14.Location = new System.Drawing.Point(68, 221);
+ this.label14.Name = "label14";
+ this.label14.Size = new System.Drawing.Size(61, 13);
+ this.label14.TabIndex = 81;
+ this.label14.Text = "Log Path:";
+ //
+ // text_logPath
+ //
+ this.text_logPath.Location = new System.Drawing.Point(135, 218);
+ this.text_logPath.Name = "text_logPath";
+ this.text_logPath.Size = new System.Drawing.Size(202, 21);
+ this.text_logPath.TabIndex = 80;
+ this.ToolTip.SetToolTip(this.text_logPath, "The default location where auto named files are stored.");
+ this.text_logPath.TextChanged += new System.EventHandler(this.text_logPath_TextChanged);
+ //
+ // check_keepLogs
+ //
+ this.check_keepLogs.AutoSize = true;
+ this.check_keepLogs.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.check_keepLogs.Location = new System.Drawing.Point(71, 135);
+ this.check_keepLogs.Name = "check_keepLogs";
+ this.check_keepLogs.Size = new System.Drawing.Size(185, 17);
+ this.check_keepLogs.TabIndex = 79;
+ this.check_keepLogs.Text = "Keep individual encode logs";
+ this.ToolTip.SetToolTip(this.check_keepLogs, "Save encode logs to a file after the encode has completed.");
+ this.check_keepLogs.UseVisualStyleBackColor = true;
+ this.check_keepLogs.CheckedChanged += new System.EventHandler(this.check_keepLogs_CheckedChanged);
+ //
+ // label9
+ //
+ this.label9.AutoSize = true;
+ this.label9.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.label9.Location = new System.Drawing.Point(12, 136);
+ this.label9.Name = "label9";
+ this.label9.Size = new System.Drawing.Size(41, 13);
+ this.label9.TabIndex = 77;
+ this.label9.Text = "Logs:";
+ //
// check_cli_minimized
//
this.check_cli_minimized.AutoSize = true;
@@ -589,5 +681,12 @@ namespace Handbrake internal System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox txt_autoNameFormat;
private System.Windows.Forms.Label label7;
+ private System.Windows.Forms.Label label9;
+ internal System.Windows.Forms.Label label15;
+ internal System.Windows.Forms.Button btn_saveLog;
+ internal System.Windows.Forms.Label label14;
+ private System.Windows.Forms.TextBox text_logPath;
+ internal System.Windows.Forms.CheckBox check_keepLogs;
+ internal System.Windows.Forms.CheckBox check_saveLogWithVideo;
}
}
\ No newline at end of file diff --git a/win/C#/frmOptions.cs b/win/C#/frmOptions.cs index a94b2c752..4e6d698e2 100644 --- a/win/C#/frmOptions.cs +++ b/win/C#/frmOptions.cs @@ -25,53 +25,95 @@ namespace Handbrake InitializeComponent();
mainWindow = window;
+ // #############################
+ // General
+ // #############################
+
// Enable Tooltips.
if (Properties.Settings.Default.tooltipEnable == "Checked")
+ {
+ check_tooltip.CheckState = CheckState.Checked;
ToolTip.Active = true;
-
+ }
+
// Setup Widgets to match settings.
if (Properties.Settings.Default.updateStatus == "Checked")
check_updateCheck.CheckState = CheckState.Checked;
- // Unstable Snapshot checking should only be visible for stable builds.
- if (Properties.Settings.Default.hb_build.ToString().EndsWith("1"))
- {
- lbl_appcastUnstable.Visible = false;
- check_snapshot.Visible = false;
- }
- if (Properties.Settings.Default.checkSnapshot == "Checked")
- check_snapshot.CheckState = CheckState.Checked;
-
+ // enable loading of default user settings.
if (Properties.Settings.Default.defaultSettings == "Checked")
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")
+ check_autoNaming.CheckState = CheckState.Checked;
+
+ // Store the auto name path
+ text_an_path.Text = Properties.Settings.Default.autoNamePath;
+ if (text_an_path.Text == string.Empty)
+ text_an_path.Text = "Click 'Browse' to set the default location";
+
+ // Store auto name format
+ txt_autoNameFormat.Text = Properties.Settings.Default.autoNameFormat;
+
+ // #############################
+ // Picture Tab
+ // #############################
+
+ // Store decomb value string
txt_decomb.Text = Properties.Settings.Default.decomb;
+ // #############################
+ // CLI
+ // #############################
+
+ // Enable Start CLI minimized
+ if (Properties.Settings.Default.cli_minimized == "Checked")
+ check_cli_minimized.CheckState = CheckState.Checked;
+
+ // Number of processor cores
drp_processors.Text = Properties.Settings.Default.Processors;
+
+ // Priority level for encodes
drp_Priority.Text = Properties.Settings.Default.processPriority;
- drp_completeOption.Text = Properties.Settings.Default.CompletionOption;
- if (Properties.Settings.Default.tooltipEnable == "Checked")
- check_tooltip.CheckState = CheckState.Checked;
+ // Save individual log files
+ if (Properties.Settings.Default.saveLog == "Checked")
+ check_keepLogs.CheckState = CheckState.Checked;
- if (Properties.Settings.Default.autoNaming == "Checked")
- check_autoNaming.CheckState = CheckState.Checked;
+ // Save logs in the same directory as encoded files
+ if (Properties.Settings.Default.saveLogWithVideo == "Checked")
+ check_saveLogWithVideo.CheckState = CheckState.Checked;
- txt_autoNameFormat.Text = Properties.Settings.Default.autoNameFormat;
+ // The saved log path
+ text_logPath.Text = Properties.Settings.Default.saveLogPath;
- if (Properties.Settings.Default.drive_detection == "Checked")
- btn_drive_detect.CheckState = CheckState.Checked;
- if (Properties.Settings.Default.cli_minimized == "Checked")
- check_cli_minimized.CheckState = CheckState.Checked;
+ // #############################
+ // Advanced
+ // #############################
- text_an_path.Text = Properties.Settings.Default.autoNamePath;
+ // Unstable Snapshot checking should only be visible for stable builds.
+ if (Properties.Settings.Default.hb_build.ToString().EndsWith("1"))
+ {
+ lbl_appcastUnstable.Visible = false;
+ check_snapshot.Visible = false;
+ }
+
+ // Enable snapshot updating
+ if (Properties.Settings.Default.checkSnapshot == "Checked")
+ check_snapshot.CheckState = CheckState.Checked;
+
+ // Enable GUI DVD Drive detection code
+ if (Properties.Settings.Default.drive_detection == "Checked")
+ btn_drive_detect.CheckState = CheckState.Checked;
- if (text_an_path.Text == string.Empty)
- text_an_path.Text = "Click 'Browse' to set the default location";
}
- #region Options
+ #region General
private void check_updateCheck_CheckedChanged(object sender, EventArgs e)
{
Properties.Settings.Default.updateStatus = check_updateCheck.CheckState.ToString();
@@ -82,22 +124,6 @@ namespace Handbrake Properties.Settings.Default.defaultSettings = check_userDefaultSettings.CheckState.ToString();
}
- private void drp_processors_SelectedIndexChanged(object sender, EventArgs e)
- {
- Properties.Settings.Default.Processors = drp_processors.Text;
- }
-
- private void drp_Priority_SelectedIndexChanged(object sender, EventArgs e)
- {
- Properties.Settings.Default.processPriority = drp_Priority.Text;
- }
-
- private void btn_close_Click(object sender, EventArgs e)
- {
- Properties.Settings.Default.Save(); // Small hack for Vista. Seems to work fine on XP without this
- this.Close();
- }
-
private void check_tooltip_CheckedChanged(object sender, EventArgs e)
{
Properties.Settings.Default.tooltipEnable = check_tooltip.CheckState.ToString();
@@ -112,7 +138,6 @@ namespace Handbrake mainWindow.ToolTip.Active = false;
}
}
-
private void drp_completeOption_SelectedIndexChanged(object sender, EventArgs e)
{
Properties.Settings.Default.CompletionOption = drp_completeOption.Text;
@@ -134,16 +159,6 @@ namespace Handbrake text_an_path.Text = pathFinder.SelectedPath;
}
- private void txt_decomb_TextChanged(object sender, EventArgs e)
- {
- Properties.Settings.Default.decomb = txt_decomb.Text;
- }
-
- private void btn_drive_detect_CheckedChanged(object sender, EventArgs e)
- {
- Properties.Settings.Default.drive_detection = btn_drive_detect.CheckState.ToString();
- }
-
private void text_an_path_TextChanged(object sender, EventArgs e)
{
if (text_an_path.Text == string.Empty)
@@ -154,17 +169,76 @@ namespace Handbrake else
Properties.Settings.Default.autoNamePath = text_an_path.Text;
}
+ #endregion
- private void check_snapshot_CheckedChanged(object sender, EventArgs e)
+ #region Picture
+ private void txt_decomb_TextChanged(object sender, EventArgs e)
{
- Properties.Settings.Default.checkSnapshot = check_snapshot.CheckState.ToString();
+ Properties.Settings.Default.decomb = txt_decomb.Text;
}
+ #endregion
+ #region CLI
private void check_cli_minimized_CheckedChanged(object sender, EventArgs e)
{
Properties.Settings.Default.cli_minimized = check_cli_minimized.CheckState.ToString();
}
+
+ private void drp_processors_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ Properties.Settings.Default.Processors = drp_processors.Text;
+ }
+
+ private void drp_Priority_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ Properties.Settings.Default.processPriority = drp_Priority.Text;
+ }
+
+ private void check_keepLogs_CheckedChanged(object sender, EventArgs e)
+ {
+ Properties.Settings.Default.saveLog = check_keepLogs.CheckState.ToString();
+ }
+
+ private void check_saveLogWithVideo_CheckedChanged(object sender, EventArgs e)
+ {
+ Properties.Settings.Default.saveLogWithVideo = check_saveLogWithVideo.CheckState.ToString();
+ if (check_saveLogWithVideo.Checked == true)
+ text_logPath.Text = "";
+ }
+
+ private void btn_saveLog_Click(object sender, EventArgs e)
+ {
+ pathFinder.SelectedPath = String.Empty;
+ pathFinder.ShowDialog();
+ if (pathFinder.SelectedPath != string.Empty)
+ text_logPath.Text = pathFinder.SelectedPath;
+ }
+
+ private void text_logPath_TextChanged(object sender, EventArgs e)
+ {
+ Properties.Settings.Default.saveLogPath = text_logPath.Text;
+ if (text_logPath.Text != String.Empty)
+ check_saveLogWithVideo.Checked = false;
+ }
+
#endregion
+ #region Advanced
+ private void btn_drive_detect_CheckedChanged(object sender, EventArgs e)
+ {
+ Properties.Settings.Default.drive_detection = btn_drive_detect.CheckState.ToString();
+ }
+
+ private void check_snapshot_CheckedChanged(object sender, EventArgs e)
+ {
+ Properties.Settings.Default.checkSnapshot = check_snapshot.CheckState.ToString();
+ }
+ #endregion
+
+ private void btn_close_Click(object sender, EventArgs e)
+ {
+ Properties.Settings.Default.Save(); // Small hack for Vista. Seems to work fine on XP without this
+ this.Close();
+ }
}
}
\ No newline at end of file diff --git a/win/C#/frmQueue.cs b/win/C#/frmQueue.cs index 2ba5b2b2c..7b6d2d677 100644 --- a/win/C#/frmQueue.cs +++ b/win/C#/frmQueue.cs @@ -147,10 +147,11 @@ namespace Handbrake hbProc = cliObj.runCli(this, query);
hbProc.WaitForExit();
+ cliObj.copyLog(query);
+
hbProc.Close();
hbProc.Dispose();
hbProc = null;
-
query = "";
if (cancel == true)
|