[vlc-commits] macosx: error panel: Adapt code style

David Fuhrmann git at videolan.org
Fri Apr 14 13:43:12 CEST 2017


vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Fri Apr 14 13:18:16 2017 +0200| [fecb9063e00a7b16865c5f49c949db2cb7cb572f] | committer: David Fuhrmann

macosx: error panel: Adapt code style

refs #1726

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

 modules/gui/macosx/UI/ErrorPanel.xib          |  4 +--
 modules/gui/macosx/VLCErrorWindowController.h | 11 +++----
 modules/gui/macosx/VLCErrorWindowController.m | 41 ++++++++++++++++-----------
 3 files changed, 31 insertions(+), 25 deletions(-)

diff --git a/modules/gui/macosx/UI/ErrorPanel.xib b/modules/gui/macosx/UI/ErrorPanel.xib
index 9a33498e3f..6b5e59748f 100644
--- a/modules/gui/macosx/UI/ErrorPanel.xib
+++ b/modules/gui/macosx/UI/ErrorPanel.xib
@@ -7,8 +7,8 @@
     <objects>
         <customObject id="-2" userLabel="File's Owner" customClass="VLCErrorWindowController">
             <connections>
-                <outlet property="o_cleanup_button" destination="11" id="13"/>
-                <outlet property="o_error_table" destination="8" id="12"/>
+                <outlet property="cleanupButton" destination="11" id="9oD-4y-Lho"/>
+                <outlet property="errorTable" destination="8" id="4tg-CT-oZG"/>
                 <outlet property="window" destination="5" id="75"/>
             </connections>
         </customObject>
diff --git a/modules/gui/macosx/VLCErrorWindowController.h b/modules/gui/macosx/VLCErrorWindowController.h
index d01a5456cb..8aa8f342c7 100644
--- a/modules/gui/macosx/VLCErrorWindowController.h
+++ b/modules/gui/macosx/VLCErrorWindowController.h
@@ -25,16 +25,13 @@
 #import <Cocoa/Cocoa.h>
 
 @interface VLCErrorWindowController : NSWindowController
-{
-    IBOutlet id o_cleanup_button;
-    IBOutlet id o_error_table;
 
-    NSMutableArray *o_errors;
-    NSMutableArray *o_icons;
-}
+ at property (readwrite, weak) IBOutlet NSButton    *cleanupButton;
+ at property (readwrite, weak) IBOutlet NSTableView *errorTable;
+
 
 - (IBAction)cleanupTable:(id)sender;
 
--(void)addError:(NSString *)o_error withMsg:(NSString *)o_msg;
+- (void)addError:(NSString *)title withMsg:(NSString *)message;
 
 @end
diff --git a/modules/gui/macosx/VLCErrorWindowController.m b/modules/gui/macosx/VLCErrorWindowController.m
index 4bbf9abca5..fc305bc70a 100644
--- a/modules/gui/macosx/VLCErrorWindowController.m
+++ b/modules/gui/macosx/VLCErrorWindowController.m
@@ -26,6 +26,15 @@
 
 #import "VLCStringUtility.h"
 
+
+ at interface VLCErrorWindowController()
+{
+    NSMutableArray *_errors;
+    NSMutableArray *_icons;
+}
+
+ at end
+
 @implementation VLCErrorWindowController
 
 - (id)init
@@ -33,8 +42,8 @@
     self = [super initWithWindowNibName:@"ErrorPanel"];
     if (self) {
         /* init data sources */
-        o_errors = [[NSMutableArray alloc] init];
-        o_icons = [[NSMutableArray alloc] init];
+        _errors = [[NSMutableArray alloc] init];
+        _icons = [[NSMutableArray alloc] init];
     }
 
     return self;
@@ -43,34 +52,34 @@
 - (void)windowDidLoad
 {
     /* init strings */
-    [[self window] setTitle: _NS("Errors and Warnings")];
-    [o_cleanup_button setTitle: _NS("Clean up")];
+    [self.window setTitle: _NS("Errors and Warnings")];
+    [self.cleanupButton setTitle: _NS("Clean up")];
 }
 
--(void)addError: (NSString *)o_error withMsg:(NSString *)o_msg
+- (void)addError:(NSString *)title withMsg:(NSString *)message;
 {
     /* format our string as desired */
     NSMutableAttributedString * ourError;
     ourError = [[NSMutableAttributedString alloc] initWithString:
-                [NSString stringWithFormat:@"%@\n%@", o_error, o_msg]
+                [NSString stringWithFormat:@"%@\n%@", title, message]
                                                       attributes:
                 [NSDictionary dictionaryWithObject: [NSFont systemFontOfSize:11] forKey: NSFontAttributeName]];
     [ourError
      addAttribute: NSFontAttributeName
      value: [NSFont boldSystemFontOfSize:11]
-     range: NSMakeRange(0, [o_error length])];
-    [o_errors addObject: ourError];
+     range: NSMakeRange(0, [title length])];
+    [_errors addObject: ourError];
 
-    [o_icons addObject: [[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kAlertStopIcon)]];
+    [_icons addObject: [[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kAlertStopIcon)]];
 
-    [o_error_table reloadData];
+    [self.errorTable reloadData];
 }
 
 -(IBAction)cleanupTable:(id)sender
 {
-    [o_errors removeAllObjects];
-    [o_icons removeAllObjects];
-    [o_error_table reloadData];
+    [_errors removeAllObjects];
+    [_icons removeAllObjects];
+    [self.errorTable reloadData];
 }
 
 /*----------------------------------------------------------------------------
@@ -78,17 +87,17 @@
  *---------------------------------------------------------------------------*/
 - (NSInteger)numberOfRowsInTableView:(NSTableView *)theDataTable
 {
-    return [o_errors count];
+    return [_errors count];
 }
 
 - (id)tableView:(NSTableView *)theDataTable objectValueForTableColumn:
 (NSTableColumn *)theTableColumn row: (NSInteger)row
 {
     if ([[theTableColumn identifier] isEqualToString: @"error_msg"])
-        return [o_errors objectAtIndex:row];
+        return [_errors objectAtIndex:row];
 
     if ([[theTableColumn identifier] isEqualToString: @"icon"])
-        return [o_icons objectAtIndex:row];
+        return [_icons objectAtIndex:row];
 
     return @"";
 }



More information about the vlc-commits mailing list