[vlc-commits] macosx: messages panel: create outlets in the new style

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:21:55 2016 +0100| [6f31dda7037872663809b0c5ad9774ab3f1c7566] | committer: David Fuhrmann

macosx: messages panel: create outlets in the new style

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

 .../English.lproj/DebugMessageVisualizer.xib       |    8 ++---
 modules/gui/macosx/DebugMessageVisualizer.h        |   11 +++----
 modules/gui/macosx/DebugMessageVisualizer.m        |   32 ++++++++++----------
 3 files changed, 25 insertions(+), 26 deletions(-)

diff --git a/extras/package/macosx/Resources/English.lproj/DebugMessageVisualizer.xib b/extras/package/macosx/Resources/English.lproj/DebugMessageVisualizer.xib
index 7e287d5..d1edd07 100644
--- a/extras/package/macosx/Resources/English.lproj/DebugMessageVisualizer.xib
+++ b/extras/package/macosx/Resources/English.lproj/DebugMessageVisualizer.xib
@@ -7,10 +7,10 @@
     <objects>
         <customObject id="-2" userLabel="File's Owner" customClass="VLCDebugMessageVisualizer">
             <connections>
-                <outlet property="_clearButton" destination="RCj-GY-IGn" id="chJ-sn-o6c"/>
-                <outlet property="_msgs_refresh_btn" destination="4" id="17"/>
-                <outlet property="_msgs_save_btn" destination="3" id="19"/>
-                <outlet property="_msgs_table" destination="6" id="20"/>
+                <outlet property="clearButton" destination="RCj-GY-IGn" id="bi1-74-dyp"/>
+                <outlet property="messageTable" destination="6" id="BzW-Qh-PMq"/>
+                <outlet property="refreshButton" destination="4" id="bdj-c0-rau"/>
+                <outlet property="saveButton" destination="3" id="WDG-KN-R01"/>
                 <outlet property="window" destination="1" id="24"/>
             </connections>
         </customObject>
diff --git a/modules/gui/macosx/DebugMessageVisualizer.h b/modules/gui/macosx/DebugMessageVisualizer.h
index 0a4178b..83bd570 100644
--- a/modules/gui/macosx/DebugMessageVisualizer.h
+++ b/modules/gui/macosx/DebugMessageVisualizer.h
@@ -26,12 +26,11 @@
 #import <Cocoa/Cocoa.h>
 
 @interface VLCDebugMessageVisualizer : NSWindowController
-{
-    IBOutlet NSButton *_clearButton;
-    IBOutlet NSButton * _msgs_save_btn;
-    IBOutlet NSButton * _msgs_refresh_btn;
-    IBOutlet id _msgs_table;
-}
+
+ at property (assign) IBOutlet NSTableView *messageTable;
+ at property (assign) IBOutlet NSButton *saveButton;
+ at property (assign) IBOutlet NSButton *clearButton;
+ at property (assign) IBOutlet NSButton *refreshButton;
 
 - (void)showWindow:(id)sender;
 
diff --git a/modules/gui/macosx/DebugMessageVisualizer.m b/modules/gui/macosx/DebugMessageVisualizer.m
index fb5a28c..409e7fc 100644
--- a/modules/gui/macosx/DebugMessageVisualizer.m
+++ b/modules/gui/macosx/DebugMessageVisualizer.m
@@ -37,7 +37,7 @@ static void MsgCallback(void *data, int type, const vlc_log_t *item, const char
 
 @interface VLCDebugMessageVisualizer () <NSWindowDelegate>
 {
-    NSMutableArray * _msg_arr;
+    NSMutableArray * _messageArray;
 }
 - (void)appendMessage:(NSMutableAttributedString *) message;
 
@@ -91,7 +91,7 @@ static void MsgCallback(void *data, int type, const vlc_log_t *item, const char
 {
     self = [super initWithWindowNibName:@"DebugMessageVisualizer"];
     if (self) {
-        _msg_arr = [NSMutableArray arrayWithCapacity:600];
+        _messageArray = [NSMutableArray arrayWithCapacity:600];
     }
     return self;
 }
@@ -106,9 +106,9 @@ static void MsgCallback(void *data, int type, const vlc_log_t *item, const char
     [self.window setExcludedFromWindowsMenu: YES];
     [self.window setDelegate: self];
     [self.window setTitle: _NS("Messages")];
-    [_msgs_save_btn setTitle: _NS("Save this Log...")];
+    [_saveButton setTitle: _NS("Save this Log...")];
     [_clearButton setTitle:_NS("Clear")];
-    [_msgs_refresh_btn setImage: [NSImage imageNamed: NSImageNameRefreshTemplate]];
+    [_refreshButton setImage: [NSImage imageNamed: NSImageNameRefreshTemplate]];
 }
 
 #pragma mark - UI interaction
@@ -128,8 +128,8 @@ static void MsgCallback(void *data, int type, const vlc_log_t *item, const char
 
 - (void)windowDidBecomeKey:(NSNotification *)notification
 {
-    [_msgs_table reloadData];
-    [_msgs_table scrollRowToVisible: [_msg_arr count] - 1];
+    [_messageTable reloadData];
+    [_messageTable scrollRowToVisible: [_messageArray count] - 1];
 }
 
 - (void)windowWillClose:(NSNotification *)notification
@@ -148,10 +148,10 @@ static void MsgCallback(void *data, int type, const vlc_log_t *item, const char
     [saveFolderPanel setNameFieldStringValue:[NSString stringWithFormat: _NS("VLC Debug Log (%s).rtf"), VERSION_MESSAGE]];
     [saveFolderPanel beginSheetModalForWindow: self.window completionHandler:^(NSInteger returnCode) {
         if (returnCode == NSOKButton) {
-            NSUInteger count = [_msg_arr count];
+            NSUInteger count = [_messageArray count];
             NSMutableAttributedString * string = [[NSMutableAttributedString alloc] init];
             for (NSUInteger i = 0; i < count; i++)
-                [string appendAttributedString: [_msg_arr objectAtIndex:i]];
+                [string appendAttributedString: [_messageArray objectAtIndex:i]];
 
             NSData *data = [string RTFFromRange:NSMakeRange(0, [string length])
                              documentAttributes:[NSDictionary dictionaryWithObject: NSRTFTextDocumentType forKey: NSDocumentTypeDocumentAttribute]];
@@ -164,35 +164,35 @@ static void MsgCallback(void *data, int type, const vlc_log_t *item, const char
 
 - (IBAction)clearLog:(id)sender
 {
-    [_msg_arr removeAllObjects];
+    [_messageArray removeAllObjects];
 
     // Reregister handler, to write new header to log
     vlc_LogSet(VLCIntf->p_libvlc, NULL, NULL);
     vlc_LogSet(VLCIntf->p_libvlc, MsgCallback, (__bridge void*)self);
 
-    [_msgs_table reloadData];
+    [_messageTable reloadData];
 }
 
 #pragma mark - data handling
 
 - (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView
 {
-    return [_msg_arr count];
+    return [_messageArray count];
 }
 
 - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
 {
-    return [_msg_arr objectAtIndex:rowIndex];
+    return [_messageArray objectAtIndex:rowIndex];
 }
 
 - (void)appendMessage:(NSMutableAttributedString *) message
 {
-    if ([_msg_arr count] > 1000000) {
-        [_msg_arr removeObjectAtIndex: 0];
-        [_msg_arr removeObjectAtIndex: 1];
+    if ([_messageArray count] > 1000000) {
+        [_messageArray removeObjectAtIndex: 0];
+        [_messageArray removeObjectAtIndex: 1];
     }
 
-    [_msg_arr addObject:message];
+    [_messageArray addObject:message];
 }
 
 @end



More information about the vlc-commits mailing list