[vlc-commits] macosx: messages panel: save log as text file instead of rtf

David Fuhrmann git at videolan.org
Fri Jan 1 20:42:48 CET 2016


vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Fri Jan  1 20:33:53 2016 +0100| [c3dad7ffc124cb26b66e11691a4c1864705d70d8] | committer: David Fuhrmann

macosx: messages panel: save log as text file instead of rtf

Those rtf files were awful to read, and rather unhandy. Switch to
plain txt which should make debugging more easy.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c3dad7ffc124cb26b66e11691a4c1864705d70d8
---

 modules/gui/macosx/DebugMessageVisualizer.m |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/modules/gui/macosx/DebugMessageVisualizer.m b/modules/gui/macosx/DebugMessageVisualizer.m
index 409e7fc..aa5339a 100644
--- a/modules/gui/macosx/DebugMessageVisualizer.m
+++ b/modules/gui/macosx/DebugMessageVisualizer.m
@@ -144,18 +144,16 @@ static void MsgCallback(void *data, int type, const vlc_log_t *item, const char
 
     [saveFolderPanel setCanSelectHiddenExtension: NO];
     [saveFolderPanel setCanCreateDirectories: YES];
-    [saveFolderPanel setAllowedFileTypes: [NSArray arrayWithObject:@"rtf"]];
-    [saveFolderPanel setNameFieldStringValue:[NSString stringWithFormat: _NS("VLC Debug Log (%s).rtf"), VERSION_MESSAGE]];
+    [saveFolderPanel setAllowedFileTypes: [NSArray arrayWithObject:@"txt"]];
+    [saveFolderPanel setNameFieldStringValue:[NSString stringWithFormat: _NS("VLC Debug Log (%s).txt"), VERSION_MESSAGE]];
     [saveFolderPanel beginSheetModalForWindow: self.window completionHandler:^(NSInteger returnCode) {
         if (returnCode == NSOKButton) {
             NSUInteger count = [_messageArray count];
-            NSMutableAttributedString * string = [[NSMutableAttributedString alloc] init];
+            NSMutableString *string = [[NSMutableString alloc] init];
             for (NSUInteger i = 0; i < count; i++)
-                [string appendAttributedString: [_messageArray objectAtIndex:i]];
-
-            NSData *data = [string RTFFromRange:NSMakeRange(0, [string length])
-                             documentAttributes:[NSDictionary dictionaryWithObject: NSRTFTextDocumentType forKey: NSDocumentTypeDocumentAttribute]];
+                [string appendString: [[_messageArray objectAtIndex:i] string]];
 
+            NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];
             if ([data writeToFile: [[saveFolderPanel URL] path] atomically: YES] == NO)
                 msg_Warn(VLCIntf, "Error while saving the debug log");
         }



More information about the vlc-commits mailing list