]> granicus.if.org Git - handbrake/commitdiff
WinGui: Some fixes and tidyup of the new logging code.
authorsr55 <sr55.hb@outlook.com>
Mon, 21 Mar 2016 12:57:48 +0000 (12:57 +0000)
committersr55 <sr55.hb@outlook.com>
Mon, 21 Mar 2016 12:57:48 +0000 (12:57 +0000)
win/CS/HandBrake.ApplicationServices/Services/Logging/LogService.cs
win/CS/HandBrake.ApplicationServices/Services/Logging/Model/LogMessageType.cs
win/CS/HandBrakeWPF/Services/Encode/EncodeBase.cs
win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs
win/CS/HandBrakeWPF/Views/LogView.xaml
win/CS/HandBrakeWPF/Views/LogView.xaml.cs

index cd0d5a4834437c0364cc96f518763e4a0e4df0b4..b0292ca318a06358aeb5424aa89ab6b1878dd296 100644 (file)
@@ -120,7 +120,7 @@ namespace HandBrake.ApplicationServices.Services.Logging
                     this.messageIndex = this.messageIndex + 1;
                     msg = new LogMessage(
                             "Log Service Pausing. Too Many Log messages. This may indicate a problem with your encode.",
-                            LogMessageType.Vital,
+                            LogMessageType.Application,
                             LogLevel.Error,
                             this.messageIndex);
                     this.logMessages.Add(msg);
@@ -204,7 +204,7 @@ namespace HandBrake.ApplicationServices.Services.Logging
             }
             catch (Exception exc)
             {
-                this.LogMessage("Failed to Initialise Disk Logging. " + Environment.NewLine + exc, LogMessageType.Vital, LogLevel.Error);
+                this.LogMessage("Failed to Initialise Disk Logging. " + Environment.NewLine + exc, LogMessageType.Application, LogLevel.Error);
 
                 if (this.fileWriter != null)
                 {
@@ -227,7 +227,7 @@ namespace HandBrake.ApplicationServices.Services.Logging
         public void SetupLogHeader(string header)
         {
             this.logHeader = header;
-            this.LogMessage(header, LogMessageType.Vital, LogLevel.Info);
+            this.LogMessage(header, LogMessageType.Application, LogLevel.Info);
         }
 
         /// <summary>
index 47302a8728f021572418f87bdd59a6de066a54bf..dfa467b4a7399924207f6f85677fadf3ae8de394 100644 (file)
@@ -17,6 +17,6 @@ namespace HandBrake.ApplicationServices.Services.Logging.Model
         ScanOrEncode,\r
         API,\r
         Progress,\r
-        Vital,\r
+        Application,\r
     }\r
 }\r
index 801a8c9cc832c5501ed45119d6ea9120c5d6663f..ed06d2cf6285b928f3473e7a81b8c2af265bbb8d 100644 (file)
@@ -170,19 +170,19 @@ namespace HandBrakeWPF.Services.Encode
         /// <summary>
         /// The write file.
         /// </summary>
-        /// <param name="fileName">
-        /// The file name.
-        /// </param>
         /// <param name="content">
         /// The content.
         /// </param>
-        private void WriteFile(string fileName, string content)
+        /// <param name="fileName">
+        /// The file name.
+        /// </param>
+        private void WriteFile(string content, string fileName)
         {
             try
             {
                 using (StreamWriter fileWriter = new StreamWriter(fileName) { AutoFlush = true })
                 {
-                    fileWriter.WriteLineAsync(content);
+                    fileWriter.Write(content);
                 }
             }
             catch (Exception exc)
index e8b920c57af6b5b83a72910d97fcb606d57a8dd2..df86058df2c00ac3f1b638585c905add8cdd49f0 100644 (file)
@@ -205,7 +205,7 @@ namespace HandBrakeWPF.Services.Encode
         /// <param name="message">Log message content</param>
         protected void ServiceLogMessage(string message)
         {
-            this.log.LogMessage(string.Format("# {0}", message), LogMessageType.ScanOrEncode, LogLevel.Info);
+            this.log.LogMessage(string.Format("{0}# {1}{0}", Environment.NewLine, message), LogMessageType.ScanOrEncode, LogLevel.Info);
         }
         #endregion
     }
index 878fd430a4cd0afd9003396f2a4b9ccca814434a..4745203bacee3f2e0b445f513951636820467621 100644 (file)
@@ -17,6 +17,7 @@
                 <RowDefinition Height="Auto" />\r
                 <RowDefinition Height="*" />\r
             </Grid.RowDefinitions>\r
+                       \r
             <ToolBar Grid.Row="0"\r
                      ToolBar.OverflowMode="Never" \r
                      ToolBarTray.IsLocked="True"\r
 \r
             </ToolBar>\r
 \r
-            <TextBox Grid.Row="2" ScrollViewer.VerticalScrollBarVisibility="Visible" TextWrapping="Wrap" x:Name="logText" />\r
+            <TextBox Grid.Row="2" ScrollViewer.VerticalScrollBarVisibility="Visible" TextWrapping="Wrap" x:Name="logText">\r
+\r
+                <TextBox.ContextMenu>\r
+                    <ContextMenu>\r
+                        <MenuItem Header="{x:Static Properties:ResourcesUI.LogView_CopyClipboard}" cal:Message.Attach="[Event Click] = [Action CopyLog]" >\r
+                            <MenuItem.Icon>\r
+                                <Image Width="16" Source="Images/copy.png" />\r
+                            </MenuItem.Icon>\r
+                        </MenuItem>\r
+                        <MenuItem Header="{x:Static Properties:ResourcesUI.LogView_OpenLogDir}" cal:Message.Attach="[Event Click] = [Action OpenLogDirectory]">\r
+                            <MenuItem.Icon>\r
+                                <Image Width="16" Source="Images/folder.png" />\r
+                            </MenuItem.Icon>\r
+                        </MenuItem>\r
+                        <Separator />\r
+                        <MenuItem Header="Auto Scroll" IsCheckable="True" IsChecked="True" x:Name="AutoScroll" />\r
+                        \r
+                    </ContextMenu>\r
+                </TextBox.ContextMenu>\r
+            </TextBox>\r
 \r
         </Grid>\r
 \r
index af07ae50991469ae054648eb0ea1cf19257c0fe0..2ab42775299270ba9cdb5fca3323cb56432eee7a 100644 (file)
@@ -77,7 +77,11 @@ namespace HandBrakeWPF.Views
             {\r
                 // This works better than Data Binding because of the scroll.\r
                 this.logText.AppendText(Environment.NewLine + e.Log.Content);\r
-                this.logText.ScrollToEnd();\r
+\r
+                if (this.AutoScroll.IsChecked)\r
+                {\r
+                    this.logText.ScrollToEnd();\r
+                }\r
             }\r
         }\r
 \r