OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Wed, 30 Sep 2009 14:39:12 +0000 (14:39 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Wed, 30 Sep 2009 14:39:12 +0000 (14:39 +0000)
- Add a notice to the log to indicate if the user has used a custom query.

git-svn-id: svn://localhost/HandBrake/trunk@2854 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/C#/EncodeQueue/EncodeAndQueueHandler.cs
win/C#/EncodeQueue/Job.cs
win/C#/frmActivityWindow.cs
win/C#/frmMain.cs
win/C#/frmQueue.cs

index 93cab84..f2a4eae 100644 (file)
@@ -82,9 +82,10 @@ namespace Handbrake.EncodeQueue
         /// <param name="query">The query that will be passed to the HandBrake CLI.</param>\r
         /// <param name="source">The location of the source video.</param>\r
         /// <param name="destination">The location where the encoded video will be.</param>\r
-        public void AddJob(string query, string source, string destination)\r
+        /// <param name="customJob"></param>\r
+        public void AddJob(string query, string source, string destination, bool customJob)\r
         {\r
-            Job newJob = new Job { Id = nextJobId++, Query = query, Source = source, Destination = destination };\r
+            Job newJob = new Job { Id = nextJobId++, Query = query, Source = source, Destination = destination, CustomQuery = customJob };\r
 \r
             queue.Add(newJob);\r
             WriteQueueStateToFile("hb_queue_recovery.xml");\r
@@ -306,7 +307,8 @@ namespace Handbrake.EncodeQueue
             // Run through each item on the queue\r
             while (this.Count != 0)\r
             {\r
-                string query = GetNextJob().Query;\r
+                Job encJob = GetNextJob();\r
+                string query = encJob.Query;\r
                 WriteQueueStateToFile("hb_queue_recovery.xml"); // Update the queue recovery file\r
 \r
                 RunCli(query);\r
@@ -316,7 +318,7 @@ namespace Handbrake.EncodeQueue
 \r
                 hbProcess.WaitForExit();\r
 \r
-                AddCLIQueryToLog(query);\r
+                AddCLIQueryToLog(encJob);\r
                 CopyLog(LastEncode.Destination);\r
 \r
                 hbProcess.Close();\r
@@ -469,7 +471,7 @@ namespace Handbrake.EncodeQueue
         /// Append the CLI query to the start of the log file.\r
         /// </summary>\r
         /// <param name="query"></param>\r
-        private static void AddCLIQueryToLog(string query)\r
+        private static void AddCLIQueryToLog(Job encJob)\r
         {\r
             string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";\r
             string logPath = Path.Combine(logDir, "last_encode_log.txt");\r
@@ -480,7 +482,8 @@ namespace Handbrake.EncodeQueue
 \r
             StreamWriter writer = new StreamWriter(File.Create(logPath));\r
 \r
-            writer.Write("### CLI Query: " + query + "\n\n");\r
+            writer.Write("### CLI Query: " + encJob.Query + "\n\n");\r
+            writer.Write("### User Query: " + encJob.CustomQuery + "\n\n");\r
             writer.Write("#########################################\n\n");\r
             writer.WriteLine(log);\r
             writer.Flush();\r
index e912fd6..7dfe7e5 100644 (file)
@@ -4,6 +4,8 @@
           Homepage: <http://handbrake.fr>.\r
           It may be used under the terms of the GNU General Public License. */\r
 \r
+using System;\r
+\r
 namespace Handbrake.EncodeQueue\r
 {\r
     public struct Job\r
@@ -19,6 +21,11 @@ namespace Handbrake.EncodeQueue
         public string Query { get; set; }\r
 \r
         /// <summary>\r
+        /// record if this is a user or GUI generated query\r
+        /// </summary>\r
+        public Boolean CustomQuery { get; set; }\r
+\r
+        /// <summary>\r
         /// Gets or sets the source file of encoding.\r
         /// </summary>\r
         public string Source { get; set; }\r
index 9509500..9f9f411 100644 (file)
@@ -74,11 +74,6 @@ namespace Handbrake
             rtf_actLog.AppendText(String.Format("### Install Dir: {0} \n", Application.StartupPath));\r
             rtf_actLog.AppendText(String.Format("### Data Dir: {0} \n", Application.UserAppDataPath));\r
             rtf_actLog.AppendText("#########################################\n\n");\r
-            if ((!_encodeQueue.LastEncode.IsEmpty) && _encodeQueue.LastEncode.Query != String.Empty)\r
-            {\r
-                rtf_actLog.AppendText("### CLI Query: " + _encodeQueue.LastEncode.Query + "\n\n");\r
-                rtf_actLog.AppendText("#########################################\n\n");\r
-            }\r
 \r
             // Seutp the log file\r
             if (scan)\r
@@ -90,6 +85,13 @@ namespace Handbrake
             {\r
                 _readFile = "last_encode_log.txt";\r
                 txt_log.Text = "Encode Log";\r
+                if (_encodeQueue.isEncoding)\r
+                    if ((!_encodeQueue.LastEncode.IsEmpty) && _encodeQueue.LastEncode.Query != String.Empty)\r
+                    {\r
+                        rtf_actLog.AppendText("### CLI Query: " + _encodeQueue.LastEncode.Query + "\n");\r
+                        rtf_actLog.AppendText("### Custom Query: " + _encodeQueue.LastEncode.CustomQuery + "\n\n");\r
+                        rtf_actLog.AppendText("#########################################\n\n");\r
+                    }\r
             }\r
             _lastUpdate = false;\r
         }\r
@@ -184,7 +186,7 @@ namespace Handbrake
                     fileNotFoundQuickFix = true;\r
                     return "\n\n\nERROR: The log file could not be found. \nMaybe you cleared your system's tempory folder or maybe you just havn't run an encode yet. \nTried to find the log file in: " + logFile;\r
                 }\r
-                   \r
+\r
                 StreamReader sr = new StreamReader(logFile2);\r
                 string line;\r
                 int i = 1;\r
index 4e3a73f..2be9b16 100644 (file)
@@ -729,7 +729,7 @@ namespace Handbrake
                     if (overwrite == DialogResult.Yes)\r
                     {\r
                         if (encodeQueue.Count == 0)\r
-                            encodeQueue.AddJob(query, sourcePath, text_destination.Text);\r
+                            encodeQueue.AddJob(query, sourcePath, text_destination.Text, (rtf_query.Text != ""));\r
 \r
                         queueWindow.setQueue();\r
                         if (encodeQueue.Count > 1)\r
@@ -764,11 +764,11 @@ namespace Handbrake
                     DialogResult result = MessageBox.Show("There is already a queue item for this destination path. \n\n If you continue, the encode will be overwritten. Do you wish to continue?",\r
                   "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);\r
                     if (result == DialogResult.Yes)\r
-                        encodeQueue.AddJob(query, sourcePath, text_destination.Text);\r
+                        encodeQueue.AddJob(query, sourcePath, text_destination.Text, (rtf_query.Text != ""));\r
 \r
                 }\r
                 else\r
-                    encodeQueue.AddJob(query, sourcePath, text_destination.Text);\r
+                    encodeQueue.AddJob(query, sourcePath, text_destination.Text, (rtf_query.Text != ""));\r
 \r
                 lbl_encode.Text = encodeQueue.Count + " encode(s) pending in the queue";\r
 \r
@@ -806,6 +806,8 @@ namespace Handbrake
             if (ActivityWindow == null)\r
                 ActivityWindow = new frmActivityWindow(file, encodeQueue, this);\r
 \r
+            ActivityWindow.SetLogView(!encodeQueue.isEncoding);\r
+\r
             ActivityWindow.Show();\r
         }\r
         #endregion\r
index e110a47..3529789 100644 (file)
@@ -379,7 +379,7 @@ namespace Handbrake
         {\r
             if (!queue.LastEncode.IsEmpty)\r
             {\r
-                queue.AddJob(queue.LastEncode.Query, queue.LastEncode.Source, queue.LastEncode.Destination);\r
+                queue.AddJob(queue.LastEncode.Query, queue.LastEncode.Source, queue.LastEncode.Destination, queue.LastEncode.CustomQuery);\r
                 updateUIElements();\r
             }\r
         }\r