[vlc-devel] [PATCH] macosx: Refactor MainWindow class for better code-style consistency

epirat07 at gmail.com epirat07 at gmail.com
Thu Sep 24 13:43:56 CEST 2015


From: Marvin Scholz <epirat07 at gmail.com>

Most of the IBOutlets that used Hungarian notation are renamed and
the bindings in the MainWindow.xib were adjusted accordingly.
Removed spacing in front of arguments in Objective C methods.
Replace another unnecessary iteration used for source list item
expansion.
---
 .../macosx/Resources/English.lproj/MainWindow.xib  |  64 ++--
 modules/gui/macosx/MainWindow.h                    |  70 +++--
 modules/gui/macosx/MainWindow.m                    | 331 +++++++++++----------
 3 files changed, 244 insertions(+), 221 deletions(-)

diff --git a/extras/package/macosx/Resources/English.lproj/MainWindow.xib b/extras/package/macosx/Resources/English.lproj/MainWindow.xib
index 971375e..bd77ed6 100644
--- a/extras/package/macosx/Resources/English.lproj/MainWindow.xib
+++ b/extras/package/macosx/Resources/English.lproj/MainWindow.xib
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7706" systemVersion="14F25a" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
     <dependencies>
         <deployment version="1070" identifier="macosx"/>
         <development version="5100" identifier="xcode"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7706"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="8191"/>
     </dependencies>
     <objects>
         <customObject id="-2" userLabel="File's Owner" customClass="NSWindowController">
@@ -371,36 +371,36 @@
                 </subviews>
             </view>
             <connections>
+                <outlet property="categoryLabel" destination="5610" id="28H-0K-uf4"/>
                 <outlet property="controlsBar" destination="5339" id="5624"/>
-                <outlet property="o_chosen_category_lbl" destination="5610" id="5616"/>
-                <outlet property="o_dropzone_box" destination="4739" id="5007"/>
-                <outlet property="o_dropzone_btn" destination="4729" id="4735"/>
-                <outlet property="o_dropzone_img" destination="4725" id="5620"/>
-                <outlet property="o_dropzone_lbl" destination="4727" id="4734"/>
-                <outlet property="o_dropzone_view" destination="4722" id="4733"/>
-                <outlet property="o_left_split_view" destination="4681" id="4752"/>
-                <outlet property="o_outline_view" destination="4376" id="S1z-yM-tJQ"/>
-                <outlet property="o_playlist_table" destination="4372" id="4664"/>
-                <outlet property="o_podcast_add_btn" destination="5263" id="5292"/>
-                <outlet property="o_podcast_remove_btn" destination="5302" id="5412"/>
-                <outlet property="o_podcast_subscribe_cancel_btn" destination="5268" id="5293"/>
-                <outlet property="o_podcast_subscribe_ok_btn" destination="5269" id="5294"/>
-                <outlet property="o_podcast_subscribe_subtitle_lbl" destination="5274" id="5295"/>
-                <outlet property="o_podcast_subscribe_title_lbl" destination="5275" id="5296"/>
-                <outlet property="o_podcast_subscribe_url_fld" destination="5289" id="5297"/>
-                <outlet property="o_podcast_subscribe_window" destination="5265" id="5298"/>
-                <outlet property="o_podcast_unsubscribe_cancel_btn" destination="5307" id="5325"/>
-                <outlet property="o_podcast_unsubscribe_ok_btn" destination="5308" id="5326"/>
-                <outlet property="o_podcast_unsubscribe_pop" destination="5319" id="5327"/>
-                <outlet property="o_podcast_unsubscribe_subtitle_lbl" destination="5310" id="5328"/>
-                <outlet property="o_podcast_unsubscribe_title_lbl" destination="5311" id="5329"/>
-                <outlet property="o_podcast_unsubscribe_window" destination="5305" id="5330"/>
-                <outlet property="o_podcast_view" destination="5260" id="5291"/>
-                <outlet property="o_right_split_view" destination="4682" id="4738"/>
-                <outlet property="o_search_fld" destination="5614" id="5617"/>
-                <outlet property="o_sidebar_scrollview" destination="4713" id="4925"/>
-                <outlet property="o_sidebar_view" destination="4714" id="4721"/>
-                <outlet property="o_split_view" destination="4680" id="4691"/>
+                <outlet property="dropzoneBox" destination="4739" id="3sx-Uq-aFL"/>
+                <outlet property="dropzoneButton" destination="4729" id="uUO-5x-qmU"/>
+                <outlet property="dropzoneImageView" destination="4725" id="Ck9-vp-aDM"/>
+                <outlet property="dropzoneLabel" destination="4727" id="HkS-xv-7B6"/>
+                <outlet property="dropzoneView" destination="4722" id="a41-TD-aJs"/>
+                <outlet property="outlineView" destination="4376" id="92d-4j-4PK"/>
+                <outlet property="playlistScrollView" destination="4372" id="QDP-7m-wKJ"/>
+                <outlet property="podcastAddButton" destination="5263" id="Rg8-kX-6dU"/>
+                <outlet property="podcastRemoveButton" destination="5302" id="T6b-Y8-Usc"/>
+                <outlet property="podcastSubscribeCancelButton" destination="5268" id="nSd-2J-TCb"/>
+                <outlet property="podcastSubscribeOkButton" destination="5269" id="vHf-fh-21u"/>
+                <outlet property="podcastSubscribeSubtitle" destination="5274" id="wLI-Bk-rB1"/>
+                <outlet property="podcastSubscribeTitle" destination="5275" id="foW-M7-zvQ"/>
+                <outlet property="podcastSubscribeUrlField" destination="5289" id="atN-De-g9Y"/>
+                <outlet property="podcastSubscribeWindow" destination="5265" id="dbr-XL-jEV"/>
+                <outlet property="podcastUnsubscirbeTitle" destination="5311" id="XeP-LX-gv4"/>
+                <outlet property="podcastUnsubscribeCancelButton" destination="5307" id="5ns-Wt-16P"/>
+                <outlet property="podcastUnsubscribeOkButton" destination="5308" id="n0p-PI-HLp"/>
+                <outlet property="podcastUnsubscribePopUpButton" destination="5319" id="dnR-ci-Uv7"/>
+                <outlet property="podcastUnsubscribeSubtitle" destination="5310" id="oMV-ik-riY"/>
+                <outlet property="podcastUnsubscribeWindow" destination="5305" id="9yb-CN-b5O"/>
+                <outlet property="podcastView" destination="5260" id="gOv-Pi-fkF"/>
+                <outlet property="searchField" destination="5614" id="Qkl-Wo-cAe"/>
+                <outlet property="sidebarScrollView" destination="4713" id="7Th-UT-wuq"/>
+                <outlet property="sidebarView" destination="4714" id="Hsb-LW-VTd"/>
+                <outlet property="splitView" destination="4680" id="30m-4q-XzK"/>
+                <outlet property="splitViewLeft" destination="4681" id="ryK-3z-wuu"/>
+                <outlet property="splitViewRight" destination="4682" id="REX-fd-CCP"/>
                 <outlet property="titlebarView" destination="4850" id="5625"/>
                 <outlet property="videoView" destination="4665" id="5622"/>
             </connections>
@@ -557,7 +557,7 @@
                 </configuration>
             </ciFilter>
         </customView>
-        <customView id="5260" userLabel="podcast">
+        <customView id="5260" userLabel="Podcast">
             <rect key="frame" x="0.0" y="0.0" width="403" height="19"/>
             <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
             <subviews>
diff --git a/modules/gui/macosx/MainWindow.h b/modules/gui/macosx/MainWindow.h
index 63b197a..bad6fe8 100644
--- a/modules/gui/macosx/MainWindow.h
+++ b/modules/gui/macosx/MainWindow.h
@@ -50,38 +50,44 @@ typedef enum {
 
 @interface VLCMainWindow : VLCVideoWindowCommon
 {
-    IBOutlet id o_search_fld;
-
-    IBOutlet id o_playlist_table;
-    IBOutlet id o_outline_view;
-    IBOutlet id o_split_view;
-    IBOutlet id o_left_split_view;
-    IBOutlet id o_right_split_view;
-    IBOutlet id o_sidebar_view;
-    IBOutlet id o_sidebar_scrollview;
-    IBOutlet id o_chosen_category_lbl;
-
-    IBOutlet id o_dropzone_view;
-    IBOutlet id o_dropzone_btn;
-    IBOutlet id o_dropzone_lbl;
-    IBOutlet id o_dropzone_box;
-    IBOutlet id o_dropzone_img;
-
-    IBOutlet id o_podcast_view;
-    IBOutlet id o_podcast_add_btn;
-    IBOutlet id o_podcast_remove_btn;
-    IBOutlet id o_podcast_subscribe_window;
-    IBOutlet id o_podcast_subscribe_title_lbl;
-    IBOutlet id o_podcast_subscribe_subtitle_lbl;
-    IBOutlet id o_podcast_subscribe_url_fld;
-    IBOutlet id o_podcast_subscribe_cancel_btn;
-    IBOutlet id o_podcast_subscribe_ok_btn;
-    IBOutlet id o_podcast_unsubscribe_window;
-    IBOutlet id o_podcast_unsubscribe_title_lbl;
-    IBOutlet id o_podcast_unsubscribe_subtitle_lbl;
-    IBOutlet id o_podcast_unsubscribe_pop;
-    IBOutlet id o_podcast_unsubscribe_ok_btn;
-    IBOutlet id o_podcast_unsubscribe_cancel_btn;
+    // General MainWindow outlets
+    IBOutlet NSTextField        *searchField;
+    IBOutlet NSScrollView       *playlistScrollView;
+    IBOutlet NSOutlineView      *outlineView;
+    IBOutlet NSSplitView        *splitView;
+    IBOutlet NSView             *splitViewLeft;
+    IBOutlet NSView             *splitViewRight;
+    IBOutlet PXSourceList       *sidebarView;
+    IBOutlet NSScrollView       *sidebarScrollView;
+    IBOutlet NSTextField        *categoryLabel;
+    
+    // Dropzone outlets
+    IBOutlet NSView             *dropzoneView;
+    IBOutlet NSButton           *dropzoneButton;
+    IBOutlet NSTextField        *dropzoneLabel;
+    IBOutlet NSBox              *dropzoneBox;
+    IBOutlet NSImageView        *dropzoneImageView;
+    
+    // Podcast View outlets
+    IBOutlet NSView             *podcastView;
+    IBOutlet NSButton           *podcastAddButton;
+    IBOutlet NSButton           *podcastRemoveButton;
+    
+    // Podcast Subscribe Window outlets
+    IBOutlet NSWindow           *podcastSubscribeWindow;
+    IBOutlet NSTextField        *podcastSubscribeTitle;
+    IBOutlet NSTextField        *podcastSubscribeSubtitle;
+    IBOutlet NSTextField        *podcastSubscribeUrlField;
+    IBOutlet NSButton           *podcastSubscribeOkButton;
+    IBOutlet NSButton           *podcastSubscribeCancelButton;
+    
+    // Podcast Unsubscribe Window outlets
+    IBOutlet NSWindow           *podcastUnsubscribeWindow;
+    IBOutlet NSTextField        *podcastUnsubscirbeTitle;
+    IBOutlet NSTextField        *podcastUnsubscribeSubtitle;
+    IBOutlet NSPopUpButton      *podcastUnsubscribePopUpButton;
+    IBOutlet NSButton           *podcastUnsubscribeOkButton;
+    IBOutlet NSButton           *podcastUnsubscribeCancelButton;
 }
 
 @property (readonly) BOOL nativeFullscreenMode;
diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
index df0a7f4..31b2c59 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -48,6 +48,11 @@
 
 @interface VLCMainWindow() <PXSourceListDataSource, PXSourceListDelegate, NSWindowDelegate, NSAnimationDelegate, NSSplitViewDelegate>
 {
+    BOOL videoPlaybackEnabled;
+    BOOL dropzoneActive;
+    BOOL splitViewRemoved;
+    BOOL minimizedView;
+    
     BOOL b_video_playback_enabled;
     BOOL b_dropzone_active;
     BOOL b_splitview_removed;
@@ -133,73 +138,95 @@ static const float f_min_window_height = 307.;
 
 - (void)awakeFromNib
 {
-    // sets lion fullscreen behaviour
     [super awakeFromNib];
-
-    BOOL b_splitviewShouldBeHidden = NO;
-
-    [self setRestorable: NO];
+    
+    /*
+     * General setup
+     */
+    
+    NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter];
+    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+    
+    BOOL splitViewShouldBeHidden = NO;
+    
+    [self setDelegate:self];
+    [self setRestorable:NO];
+    [self useOptimizedDrawing:YES];
+    [self setExcludedFromWindowsMenu:YES];
+    [self setAcceptsMouseMovedEvents:YES];
     [self setFrameAutosaveName:@"mainwindow"];
-
-    /* setup the styled interface */
+    
     _nativeFullscreenMode = var_InheritBool(VLCIntf, "macosx-nativefullscreenmode");
-    [self useOptimizedDrawing: YES];
-
-    [[o_search_fld cell] setPlaceholderString: _NS("Search")];
-    [[o_search_fld cell] accessibilitySetOverrideValue:_NS("Enter a term to search the playlist. Results will be selected in the table.") forAttribute:NSAccessibilityDescriptionAttribute];
-    [o_search_fld setToolTip: _NS("Search in Playlist")];
-
+    b_dropzone_active = YES;
+    
+    // Playlist setup
     VLCPlaylist *playlist = [[VLCMain sharedInstance] playlist];
-    playlist.outlineView = o_outline_view;
-    playlist.playlistHeaderView = [o_outline_view headerView];
-
-    [o_dropzone_btn setTitle: _NS("Open media...")];
-    [[o_dropzone_btn cell] accessibilitySetOverrideValue:_NS("Click to open an advanced dialog to select the media to play. You can also drop files here to play.") forAttribute:NSAccessibilityDescriptionAttribute];
-    [o_dropzone_lbl setStringValue: _NS("Drop media here")];
-    [o_dropzone_img setImage: imageFromRes(@"dropzone")];
-
-    [o_podcast_add_btn setTitle: _NS("Subscribe")];
-    [o_podcast_remove_btn setTitle: _NS("Unsubscribe")];
-    [o_podcast_subscribe_title_lbl setStringValue: _NS("Subscribe to a podcast")];
-    [o_podcast_subscribe_subtitle_lbl setStringValue: _NS("Enter URL of the podcast to subscribe to:")];
-    [o_podcast_subscribe_cancel_btn setTitle: _NS("Cancel")];
-    [o_podcast_subscribe_ok_btn setTitle: _NS("Subscribe")];
-    [o_podcast_unsubscribe_title_lbl setStringValue: _NS("Unsubscribe from a podcast")];
-    [o_podcast_unsubscribe_subtitle_lbl setStringValue: _NS("Select the podcast you would like to unsubscribe from:")];
-    [o_podcast_unsubscribe_ok_btn setTitle: _NS("Unsubscribe")];
-    [o_podcast_unsubscribe_cancel_btn setTitle: _NS("Cancel")];
+    [playlist setOutlineView:(VLCPlaylistView *)outlineView];
+    [playlist setPlaylistHeaderView:outlineView.headerView];
+    
+    // (Re)load sidebar for the first time and select first item
+    [self reloadSidebar];
+    [sidebarView selectRowIndexes:[NSIndexSet indexSetWithIndex:1] byExtendingSelection:NO];
+
+    // Setup view frame sizes
+    [dropzoneView setFrame:playlistScrollView.frame];
+    [splitViewLeft setFrame:sidebarView.frame];
+    
+    /*
+     * Set up translatable strings for the UI elements
+     */
+    
+    // Window title
+    [self setTitle:_NS("VLC media player")];
+    
+    // Search Field
+    [searchField setToolTip:_NS("Search in Playlist")];
+    [searchField.cell setPlaceholderString:_NS("Search")];
+    [searchField.cell accessibilitySetOverrideValue:_NS("Enter a term to search the playlist. Results will be selected in the table.")
+                                       forAttribute:NSAccessibilityDescriptionAttribute];
+    
+    // Dropzone
+    [dropzoneLabel setStringValue:_NS("Drop media here")];
+    [dropzoneImageView setImage:imageFromRes(@"dropzone")];
+    [dropzoneButton setTitle:_NS("Open media...")];
+    [dropzoneButton.cell accessibilitySetOverrideValue:_NS("Click to open an advanced dialog to select the media to play. You can also drop files here to play.")
+                                          forAttribute:NSAccessibilityDescriptionAttribute];
+    
+    // Podcast view
+    [podcastAddButton setTitle:_NS("Subscribe")];
+    [podcastRemoveButton setTitle:_NS("Unsubscribe")];
+    
+    // Podcast subscribe window
+    [podcastSubscribeTitle setStringValue:_NS("Subscribe to a podcast")];
+    [podcastSubscribeSubtitle setStringValue:_NS("Enter URL of the podcast to subscribe to:")];
+    [podcastSubscribeOkButton setTitle:_NS("Subscribe")];
+    [podcastSubscribeCancelButton setTitle:_NS("Cancel")];
+    
+    // Podcast unsubscribe window
+    [podcastUnsubscirbeTitle setStringValue:_NS("Unsubscribe from a podcast")];
+    [podcastUnsubscribeSubtitle setStringValue:_NS("Select the podcast you would like to unsubscribe from:")];
+    [podcastUnsubscribeOkButton setTitle:_NS("Unsubscribe")];
+    [podcastUnsubscribeCancelButton setTitle:_NS("Cancel")];
 
     /* interface builder action */
     CGFloat f_threshold_height = f_min_video_height + [self.controlsBar height];
     if (self.darkInterface)
         f_threshold_height += [self.titlebarView frame].size.height;
     if ([[self contentView] frame].size.height < f_threshold_height)
-        b_splitviewShouldBeHidden = YES;
+        splitViewShouldBeHidden = YES;
 
-    [self setDelegate: self];
-    [self setExcludedFromWindowsMenu: YES];
-    [self setAcceptsMouseMovedEvents: YES];
     // Set that here as IB seems to be buggy
     if (self.darkInterface)
         [self setContentMinSize:NSMakeSize(604., f_min_window_height + [self.titlebarView frame].size.height)];
     else
         [self setContentMinSize:NSMakeSize(604., f_min_window_height)];
 
-    [self setTitle: _NS("VLC media player")];
-
-    b_dropzone_active = YES;
-    [o_dropzone_view setFrame: [o_playlist_table frame]];
-    [o_left_split_view setFrame: [o_sidebar_view frame]];
-
     /* the default small size of the search field is slightly different on Lion, let's work-around that */
     NSRect frame;
-    frame = [o_search_fld frame];
+    frame = [searchField frame];
     frame.origin.y = frame.origin.y + 2.0;
     frame.size.height = frame.size.height - 1.0;
-    [o_search_fld setFrame: frame];
-
-    /* reload the sidebar */
-    [self reloadSidebar];
+    [searchField setFrame: frame];
 
     _fspanel = [[VLCFSPanel alloc] initWithContentRect:NSMakeRect(110.,267.,549.,87.)
                                              styleMask:NSTexturedBackgroundWindowMask
@@ -207,11 +234,10 @@ static const float f_min_window_height = 307.;
                                                  defer:YES];
 
     /* make sure we display the desired default appearance when VLC launches for the first time */
-    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
     if (![defaults objectForKey:@"VLCFirstRun"]) {
         [defaults setObject:[NSDate date] forKey:@"VLCFirstRun"];
 
-        [o_sidebar_view expandItem:nil expandChildren:YES];
+        [sidebarView expandItem:nil expandChildren:YES];
         [_fspanel center];
 
         NSAlert *albumArtAlert = [NSAlert alertWithMessageText:_NS("Check for album art and metadata?") defaultButton:_NS("Enable Metadata Retrieval") alternateButton:_NS("No, Thanks") otherButton:nil informativeTextWithFormat:@"%@",_NS("VLC can check online for album art and metadata to enrich your playback experience, e.g. by providing track information when playing Audio CDs. To provide this functionality, VLC will send information about your contents to trusted services in an anonymized form.")];
@@ -219,10 +245,6 @@ static const float f_min_window_height = 307.;
         config_PutInt(VLCIntf, "metadata-network-access", returnValue == NSAlertDefaultReturn);
     }
 
-    // select playlist item by default
-    [o_sidebar_view selectRowIndexes:[NSIndexSet indexSetWithIndex:1] byExtendingSelection:NO];
-
-    NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter];
     if (self.darkInterface) {
         [defaultCenter addObserver: self selector: @selector(windowResizedOrMoved:) name: NSWindowDidResizeNotification object: nil];
         [defaultCenter addObserver: self selector: @selector(windowResizedOrMoved:) name: NSWindowDidMoveNotification object: nil];
@@ -238,34 +260,34 @@ static const float f_min_window_height = 307.;
 
         [self.titlebarView setFrame: NSMakeRect(0, winrect.size.height - f_titleBarHeight,
                                               winrect.size.width, f_titleBarHeight)];
-        [[self contentView] addSubview: self.titlebarView positioned: NSWindowAbove relativeTo: o_split_view];
+        [[self contentView] addSubview: self.titlebarView positioned: NSWindowAbove relativeTo: splitView];
 
         if (winrect.size.height > 100) {
             [self setFrame: winrect display:YES animate:YES];
             self.previousSavedFrame = winrect;
         }
 
-        winrect = [o_split_view frame];
+        winrect = splitView.frame;
         winrect.size.height = winrect.size.height - f_titleBarHeight;
-        [o_split_view setFrame: winrect];
+        [splitView setFrame: winrect];
         [self.videoView setFrame: winrect];
 
-        o_color_backdrop = [[VLCColorView alloc] initWithFrame: [o_split_view frame]];
-        [[self contentView] addSubview: o_color_backdrop positioned: NSWindowBelow relativeTo: o_split_view];
+        o_color_backdrop = [[VLCColorView alloc] initWithFrame:splitView.frame];
+        [[self contentView] addSubview:o_color_backdrop positioned:NSWindowBelow relativeTo:splitView];
         [o_color_backdrop setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable];
     } else {
-        [self.videoView setFrame: [o_split_view frame]];
-        [o_playlist_table setBorderType: NSNoBorder];
-        [o_sidebar_scrollview setBorderType: NSNoBorder];
+        [self.videoView setFrame:splitView.frame];
+        [playlistScrollView setBorderType:NSNoBorder];
+        [sidebarScrollView setBorderType:NSNoBorder];
     }
 
     [defaultCenter addObserver: self selector: @selector(someWindowWillClose:) name: NSWindowWillCloseNotification object: nil];
     [defaultCenter addObserver: self selector: @selector(someWindowWillMiniaturize:) name: NSWindowWillMiniaturizeNotification object:nil];
     [defaultCenter addObserver: self selector: @selector(applicationWillTerminate:) name: NSApplicationWillTerminateNotification object: nil];
-    [defaultCenter addObserver: self selector: @selector(mainSplitViewDidResizeSubviews:) name: NSSplitViewDidResizeSubviewsNotification object:o_split_view];
+    [defaultCenter addObserver: self selector: @selector(mainSplitViewDidResizeSubviews:) name: NSSplitViewDidResizeSubviewsNotification object:splitView];
 
-    if (b_splitviewShouldBeHidden) {
-        [self hideSplitView: YES];
+    if (splitViewShouldBeHidden) {
+        [self hideSplitView:YES];
         f_lastSplitViewHeight = 300;
     }
 
@@ -382,49 +404,47 @@ static const float f_min_window_height = 307.;
     if ([internetItem hasChildren])
         [o_sidebaritems addObject: internetItem];
 
-    [o_sidebar_view reloadData];
-    [o_sidebar_view setDropItem:playlistItem dropChildIndex:NSOutlineViewDropOnItemIndex];
-    [o_sidebar_view registerForDraggedTypes:[NSArray arrayWithObjects:NSFilenamesPboardType, @"VLCPlaylistItemPboardType", nil]];
+    [sidebarView reloadData];
+    [sidebarView setDropItem:playlistItem dropChildIndex:NSOutlineViewDropOnItemIndex];
+    [sidebarView registerForDraggedTypes:[NSArray arrayWithObjects:NSFilenamesPboardType, @"VLCPlaylistItemPboardType", nil]];
 
-    [o_sidebar_view setAutosaveName:@"mainwindow-sidebar"];
-    [(PXSourceList *)o_sidebar_view setDataSource:self];
-    [o_sidebar_view setDelegate:self];
-    [o_sidebar_view setAutosaveExpandedItems:YES];
+    [sidebarView setAutosaveName:@"mainwindow-sidebar"];
+    [sidebarView setDataSource:self];
+    [sidebarView setDelegate:self];
+    [sidebarView setAutosaveExpandedItems:YES];
 
-    [o_sidebar_view expandItem: libraryItem expandChildren: YES];
+    [sidebarView expandItem:libraryItem expandChildren:YES];
 
     if (isAReload) {
-        NSUInteger i_sidebaritem_count = [o_sidebaritems count];
-        for (NSUInteger x = 0; x < i_sidebaritem_count; x++)
-            [o_sidebar_view expandItem: [o_sidebaritems objectAtIndex:x] expandChildren: YES];
+        [sidebarView expandItem:nil expandChildren:YES];
     }
 }
 
 - (void)resizePlaylistAfterCollapse
 {
     // no animation here since we might be in the middle of another resize animation
-    NSRect rightSplitRect = [o_right_split_view frame];
+    NSRect rightSplitRect = [splitViewRight frame];
 
     NSRect plrect;
     plrect.size.height = rightSplitRect.size.height - 20.0; // actual pl top bar height, which differs from its frame
     plrect.size.width = rightSplitRect.size.width;
     plrect.origin.x = plrect.origin.y = 0.;
 
-    NSRect dropzoneboxRect = [o_dropzone_box frame];
+    NSRect dropzoneboxRect = dropzoneBox.frame;
     dropzoneboxRect.origin.x = (plrect.size.width - dropzoneboxRect.size.width) / 2;
     dropzoneboxRect.origin.y = (plrect.size.height - dropzoneboxRect.size.height) / 2;
 
-    [o_dropzone_view setFrame: plrect];
-    [o_dropzone_box setFrame: dropzoneboxRect];
+    [dropzoneView setFrame:plrect];
+    [dropzoneBox setFrame:dropzoneboxRect];
 
     if (b_podcastView_displayed) {
-        plrect.size.height -= [o_podcast_view frame].size.height;
-        plrect.origin.y = [o_podcast_view frame].size.height;
+        plrect.size.height -= [podcastView frame].size.height;
+        plrect.origin.y = [podcastView frame].size.height;
     }
-    [o_playlist_table setFrame: plrect];
+    [playlistScrollView setFrame:plrect];
 
-    [o_dropzone_view setNeedsDisplay: YES];
-    [o_playlist_table setNeedsDisplay: YES];
+    [dropzoneView setNeedsDisplay:YES];
+    [playlistScrollView setNeedsDisplay:YES];
 }
 
 - (void)makeSplitViewVisible
@@ -441,17 +461,17 @@ static const float f_min_window_height = 307.;
         new_frame.origin.y = old_frame.origin.y + old_frame.size.height - newHeight;
         new_frame.size.height = newHeight;
 
-        [[self animator] setFrame: new_frame display: YES animate: YES];
+        [[self animator] setFrame:new_frame display:YES animate:YES];
     }
 
-    [self.videoView setHidden: YES];
-    [o_split_view setHidden: NO];
+    [self.videoView setHidden:YES];
+    [splitView setHidden:NO];
     if (self.nativeFullscreenMode && [self fullscreen]) {
-        [[self.controlsBar bottomBarView] setHidden: NO];
+        [[self.controlsBar bottomBarView] setHidden:NO];
         [self.fspanel setNonActive:nil];
     }
 
-    [self makeFirstResponder: o_playlist_table];
+    [self makeFirstResponder:playlistScrollView];
 }
 
 - (void)makeSplitViewHidden
@@ -461,10 +481,10 @@ static const float f_min_window_height = 307.;
     else
         [self setContentMinSize: NSMakeSize(604., f_min_video_height)];
 
-    [o_split_view setHidden: YES];
-    [self.videoView setHidden: NO];
+    [splitView setHidden:YES];
+    [self.videoView setHidden:NO];
     if (self.nativeFullscreenMode && [self fullscreen]) {
-        [[self.controlsBar bottomBarView] setHidden: YES];
+        [[self.controlsBar bottomBarView] setHidden:YES];
         [self.fspanel setActive:nil];
     }
 
@@ -528,8 +548,8 @@ static const float f_min_window_height = 307.;
             else
                 [self makeSplitViewVisible];
         } else {
-            [o_split_view setHidden: NO];
-            [o_playlist_table setHidden: NO];
+            [splitView setHidden: NO];
+            [playlistScrollView setHidden: NO];
             [self.videoView setHidden: YES];
         }
     }
@@ -547,14 +567,13 @@ static const float f_min_window_height = 307.;
 
 - (void)windowResizedOrMoved:(NSNotification *)notification
 {
-    [self saveFrameUsingName: [self frameAutosaveName]];
+    [self saveFrameUsingName:[self frameAutosaveName]];
 }
 
 - (void)applicationWillTerminate:(NSNotification *)notification
 {
-    config_PutInt(VLCIntf, "macosx-show-sidebar", ![o_split_view isSubviewCollapsed:o_left_split_view]);
-
-    [self saveFrameUsingName: [self frameAutosaveName]];
+    config_PutInt(VLCIntf, "macosx-show-sidebar", ![splitView isSubviewCollapsed:splitViewLeft]);
+    [self saveFrameUsingName:[self frameAutosaveName]];
 }
 
 
@@ -586,29 +605,29 @@ static const float f_min_window_height = 307.;
 - (void)showDropZone
 {
     b_dropzone_active = YES;
-    [o_right_split_view addSubview: o_dropzone_view positioned:NSWindowAbove relativeTo:o_playlist_table];
-    [o_dropzone_view setFrame: [o_playlist_table frame]];
-    [o_playlist_table setHidden:YES];
+    [splitViewRight addSubview: dropzoneView positioned:NSWindowAbove relativeTo:playlistScrollView];
+    [dropzoneView setFrame: playlistScrollView.frame];
+    [playlistScrollView setHidden:YES];
 }
 
 - (void)hideDropZone
 {
     b_dropzone_active = NO;
-    [o_dropzone_view removeFromSuperview];
-    [o_playlist_table setHidden: NO];
+    [dropzoneView removeFromSuperview];
+    [playlistScrollView setHidden:NO];
 }
 
-- (void)hideSplitView:(BOOL)b_with_resize
+- (void)hideSplitView:(BOOL)resize
 {
     // cancel pending pl resizes, in case of fast toggle between both modes
     [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(resizePlaylistAfterCollapse) object:nil];
 
-    if (b_with_resize) {
+    if (resize) {
         NSRect winrect = [self frame];
-        f_lastSplitViewHeight = [o_split_view frame].size.height;
+        f_lastSplitViewHeight = [splitView frame].size.height;
         winrect.size.height = winrect.size.height - f_lastSplitViewHeight;
         winrect.origin.y = winrect.origin.y + f_lastSplitViewHeight;
-        [self setFrame: winrect display: YES animate: YES];
+        [self setFrame:winrect display:YES animate:YES];
     }
 
     if (self.darkInterface) {
@@ -622,7 +641,7 @@ static const float f_min_window_height = 307.;
     b_splitview_removed = YES;
 }
 
-- (void)showSplitView:(BOOL)b_with_resize
+- (void)showSplitView:(BOOL)resize
 {
     [self updateWindow];
     if (self.darkInterface)
@@ -631,12 +650,12 @@ static const float f_min_window_height = 307.;
         [self setContentMinSize:NSMakeSize(604., f_min_window_height)];
     [self setContentMaxSize: NSMakeSize(FLT_MAX, FLT_MAX)];
 
-    if (b_with_resize) {
+    if (resize) {
         NSRect winrect;
         winrect = [self frame];
         winrect.size.height = winrect.size.height + f_lastSplitViewHeight;
         winrect.origin.y = winrect.origin.y - f_lastSplitViewHeight;
-        [self setFrame: winrect display: YES animate: YES];
+        [self setFrame:winrect display:YES animate:YES];
     }
 
     // cancel pending pl resizes, in case of fast toggle between both modes
@@ -660,7 +679,7 @@ static const float f_min_window_height = 307.;
 
 - (void)updateName
 {
-    input_thread_t * p_input;
+    input_thread_t *p_input;
     p_input = pl_CurrentInput(VLCIntf);
     if (p_input) {
         NSString *aString = @"";
@@ -727,8 +746,8 @@ static const float f_min_window_height = 307.;
 
     bool b_seekable = false;
 
-    playlist_t * p_playlist = pl_Get(VLCIntf);
-    input_thread_t * p_input = playlist_CurrentInput(p_playlist);
+    playlist_t *p_playlist = pl_Get(VLCIntf);
+    input_thread_t *p_input = playlist_CurrentInput(p_playlist);
     if (p_input) {
         /* seekable streams */
         b_seekable = var_GetBool(p_input, "can-seek");
@@ -747,7 +766,7 @@ static const float f_min_window_height = 307.;
     else
         [self showDropZone];
     PL_UNLOCK;
-    [o_sidebar_view setNeedsDisplay:YES];
+    [sidebarView setNeedsDisplay:YES];
 
     [self _updatePlaylistTitle];
 }
@@ -775,7 +794,7 @@ static const float f_min_window_height = 307.;
 - (void)updateVolumeSlider
 {
     [(VLCMainWindowControlsBar *)[self controlsBar] updateVolumeSlider];
-    [self.fspanel setVolumeLevel: [[VLCCoreInteraction sharedInstance] volume]];
+    [self.fspanel setVolumeLevel:[[VLCCoreInteraction sharedInstance] volume]];
 }
 
 #pragma mark -
@@ -813,7 +832,7 @@ static const float f_min_window_height = 307.;
             [self.controlsBar setFullscreenState:YES];
         }
 
-        [self makeFirstResponder: o_playlist_table];
+        [self makeFirstResponder: playlistScrollView];
         [[[VLCMain sharedInstance] voutController] updateWindowLevelForHelperWindows: NSNormalWindowLevel];
 
         // restore alpha value to 1 for the case that macosx-opaqueness is set to < 1
@@ -842,7 +861,7 @@ static const float f_min_window_height = 307.;
         NSRect frame = [[self contentView] frame];
         frame.origin.y += [self.controlsBar height];
         frame.size.height -= [self.controlsBar height];
-        [o_split_view setFrame:frame];
+        [splitView setFrame:frame];
     }
 }
 
@@ -852,9 +871,9 @@ static const float f_min_window_height = 307.;
 
     // update split view frame after readding title bar
     if (self.darkInterface) {
-        NSRect frame = [o_split_view frame];
+        NSRect frame = [splitView frame];
         frame.size.height -= [self.titlebarView frame].size.height;
-        [o_split_view setFrame:frame];
+        [splitView setFrame:frame];
     }
 }
 #pragma mark -
@@ -893,30 +912,28 @@ static const float f_min_window_height = 307.;
 
 - (BOOL)splitView:(NSSplitView *)splitView canCollapseSubview:(NSView *)subview
 {
-    return ([subview isEqual:o_left_split_view]);
+    return ([subview isEqual:splitViewLeft]);
 }
 
 - (BOOL)splitView:(NSSplitView *)splitView shouldAdjustSizeOfSubview:(NSView *)subview
 {
-    if ([subview isEqual:o_left_split_view])
-        return NO;
-    return YES;
+    return (![subview isEqual:splitViewLeft]);
 }
 
 - (void)mainSplitViewDidResizeSubviews:(id)object
 {
-    f_lastLeftSplitViewWidth = [o_left_split_view frame].size.width;
-    config_PutInt(VLCIntf, "macosx-show-sidebar", ![o_split_view isSubviewCollapsed:o_left_split_view]);
+    f_lastLeftSplitViewWidth = [splitViewLeft frame].size.width;
+    config_PutInt(VLCIntf, "macosx-show-sidebar", ![splitView isSubviewCollapsed:splitViewLeft]);
     [[[VLCMain sharedInstance] mainMenu] updateSidebarMenuItem];
 }
 
 - (void)toggleLeftSubSplitView
 {
-    [o_split_view adjustSubviews];
-    if ([o_split_view isSubviewCollapsed:o_left_split_view])
-        [o_split_view setPosition:f_lastLeftSplitViewWidth ofDividerAtIndex:0];
+    [splitView adjustSubviews];
+    if ([splitView isSubviewCollapsed:splitViewLeft])
+        [splitView setPosition:f_lastLeftSplitViewWidth ofDividerAtIndex:0];
     else
-        [o_split_view setPosition:[o_split_view minPossiblePositionOfDividerAtIndex:0] ofDividerAtIndex:0];
+        [splitView setPosition:[splitView minPossiblePositionOfDividerAtIndex:0] ofDividerAtIndex:0];
     [[[VLCMain sharedInstance] mainMenu] updateSidebarMenuItem];
 }
 
@@ -929,9 +946,9 @@ static const float f_min_window_height = 307.;
 
     PL_LOCK;
     if (root == ROOT_TYPE_PLAYLIST)
-        [o_chosen_category_lbl setStringValue: [_NS("Playlist") stringByAppendingString:[self _playbackDurationOfNode:p_playlist->p_local_category]]];
+        [categoryLabel setStringValue: [_NS("Playlist") stringByAppendingString:[self _playbackDurationOfNode:p_playlist->p_local_category]]];
     else if (root == ROOT_TYPE_MEDIALIBRARY)
-        [o_chosen_category_lbl setStringValue: [_NS("Media Library") stringByAppendingString:[self _playbackDurationOfNode:p_playlist->p_ml_category]]];
+        [categoryLabel setStringValue: [_NS("Media Library") stringByAppendingString:[self _playbackDurationOfNode:p_playlist->p_ml_category]]];
 
     PL_UNLOCK;
 }
@@ -961,7 +978,7 @@ static const float f_min_window_height = 307.;
 
 - (IBAction)searchItem:(id)sender
 {
-    [[[[VLCMain sharedInstance] playlist] model] searchUpdate:[o_search_fld stringValue]];
+    [[[[VLCMain sharedInstance] playlist] model] searchUpdate:[searchField stringValue]];
 }
 
 #pragma mark -
@@ -1099,8 +1116,8 @@ static const float f_min_window_height = 307.;
 {
     playlist_t * p_playlist = pl_Get(VLCIntf);
 
-    NSIndexSet *selectedIndexes = [o_sidebar_view selectedRowIndexes];
-    id item = [o_sidebar_view itemAtRow:[selectedIndexes firstIndex]];
+    NSIndexSet *selectedIndexes = [sidebarView selectedRowIndexes];
+    id item = [sidebarView itemAtRow:[selectedIndexes firstIndex]];
 
     //Set the label text to represent the new selection
     if ([item sdtype] > -1 && [[item identifier] length] > 0) {
@@ -1109,7 +1126,7 @@ static const float f_min_window_height = 307.;
             playlist_ServicesDiscoveryAdd(p_playlist, [[item identifier] UTF8String]);
     }
 
-    [o_chosen_category_lbl setStringValue:[item title]];
+    [categoryLabel setStringValue:[item title]];
 
     if ([[item identifier] isEqualToString:@"playlist"]) {
         PL_LOCK;
@@ -1245,20 +1262,20 @@ static const float f_min_window_height = 307.;
 
 - (IBAction)addPodcast:(id)sender
 {
-    [NSApp beginSheet:o_podcast_subscribe_window modalForWindow:self modalDelegate:self didEndSelector:NULL contextInfo:nil];
+    [NSApp beginSheet:podcastSubscribeWindow modalForWindow:self modalDelegate:self didEndSelector:NULL contextInfo:nil];
 }
 
 - (IBAction)addPodcastWindowAction:(id)sender
 {
-    [o_podcast_subscribe_window orderOut:sender];
-    [NSApp endSheet: o_podcast_subscribe_window];
+    [podcastSubscribeWindow orderOut:sender];
+    [NSApp endSheet: podcastSubscribeWindow];
 
-    if (sender == o_podcast_subscribe_ok_btn && [[o_podcast_subscribe_url_fld stringValue] length] > 0) {
+    if (sender == podcastSubscribeOkButton && [[podcastSubscribeUrlField stringValue] length] > 0) {
         NSMutableString * podcastConf = [[NSMutableString alloc] init];
         if (config_GetPsz(VLCIntf, "podcast-urls") != NULL)
             [podcastConf appendFormat:@"%s|", config_GetPsz(VLCIntf, "podcast-urls")];
 
-        [podcastConf appendString: [o_podcast_subscribe_url_fld stringValue]];
+        [podcastConf appendString: [podcastSubscribeUrlField stringValue]];
         config_PutPsz(VLCIntf, "podcast-urls", [podcastConf UTF8String]);
         var_SetString(pl_Get(VLCIntf), "podcast-urls", [podcastConf UTF8String]);
     }
@@ -1268,24 +1285,24 @@ static const float f_min_window_height = 307.;
 {
     char *psz_urls = var_InheritString(pl_Get(VLCIntf), "podcast-urls");
     if (psz_urls != NULL) {
-        [o_podcast_unsubscribe_pop removeAllItems];
-        [o_podcast_unsubscribe_pop addItemsWithTitles:[toNSStr(psz_urls) componentsSeparatedByString:@"|"]];
-        [NSApp beginSheet:o_podcast_unsubscribe_window modalForWindow:self modalDelegate:self didEndSelector:NULL contextInfo:nil];
+        [podcastUnsubscribePopUpButton removeAllItems];
+        [podcastUnsubscribePopUpButton addItemsWithTitles:[toNSStr(psz_urls) componentsSeparatedByString:@"|"]];
+        [NSApp beginSheet:podcastUnsubscribeWindow modalForWindow:self modalDelegate:self didEndSelector:NULL contextInfo:nil];
     }
     free(psz_urls);
 }
 
 - (IBAction)removePodcastWindowAction:(id)sender
 {
-    [o_podcast_unsubscribe_window orderOut:sender];
-    [NSApp endSheet: o_podcast_unsubscribe_window];
+    [podcastUnsubscribeWindow orderOut:sender];
+    [NSApp endSheet: podcastUnsubscribeWindow];
 
-    if (sender == o_podcast_unsubscribe_ok_btn) {
+    if (sender == podcastUnsubscribeOkButton) {
         playlist_t * p_playlist = pl_Get(VLCIntf);
         char *psz_urls = var_InheritString(p_playlist, "podcast-urls");
 
         NSMutableArray * urls = [[NSMutableArray alloc] initWithArray:[toNSStr(config_GetPsz(VLCIntf, "podcast-urls")) componentsSeparatedByString:@"|"]];
-        [urls removeObjectAtIndex: [o_podcast_unsubscribe_pop indexOfSelectedItem]];
+        [urls removeObjectAtIndex: [podcastUnsubscribePopUpButton indexOfSelectedItem]];
         const char *psz_new_urls = [[urls componentsJoinedByString:@"|"] UTF8String];
         var_SetString(pl_Get(VLCIntf), "podcast-urls", psz_new_urls);
         config_PutPsz(VLCIntf, "podcast-urls", psz_new_urls);
@@ -1301,34 +1318,34 @@ static const float f_min_window_height = 307.;
 
 - (void)showPodcastControls
 {
-    NSRect podcastViewDimensions = [o_podcast_view frame];
-    NSRect rightSplitRect = [o_right_split_view frame];
-    NSRect playlistTableRect = [o_playlist_table frame];
+    NSRect podcastViewDimensions = [podcastView frame];
+    NSRect rightSplitRect = [splitViewRight frame];
+    NSRect playlistTableRect = [playlistScrollView frame];
 
     podcastViewDimensions.size.width = rightSplitRect.size.width;
     podcastViewDimensions.origin.x = podcastViewDimensions.origin.y = .0;
-    [o_podcast_view setFrame:podcastViewDimensions];
+    [podcastView setFrame:podcastViewDimensions];
 
     playlistTableRect.origin.y = playlistTableRect.origin.y + podcastViewDimensions.size.height;
     playlistTableRect.size.height = playlistTableRect.size.height - podcastViewDimensions.size.height;
-    [o_playlist_table setFrame:playlistTableRect];
-    [o_playlist_table setNeedsDisplay:YES];
+    [playlistScrollView setFrame:playlistTableRect];
+    [playlistScrollView setNeedsDisplay:YES];
 
-    [o_right_split_view addSubview: o_podcast_view positioned: NSWindowAbove relativeTo: o_right_split_view];
+    [splitViewRight addSubview:podcastView positioned:NSWindowAbove relativeTo:splitViewRight];
     b_podcastView_displayed = YES;
 }
 
 - (void)hidePodcastControls
 {
     if (b_podcastView_displayed) {
-        NSRect podcastViewDimensions = [o_podcast_view frame];
-        NSRect playlistTableRect = [o_playlist_table frame];
+        NSRect podcastViewDimensions = [podcastView frame];
+        NSRect playlistTableRect = [playlistScrollView frame];
 
         playlistTableRect.origin.y = playlistTableRect.origin.y - podcastViewDimensions.size.height;
         playlistTableRect.size.height = playlistTableRect.size.height + podcastViewDimensions.size.height;
 
-        [o_podcast_view removeFromSuperviewWithoutNeedingDisplay];
-        [o_playlist_table setFrame: playlistTableRect];
+        [podcastView removeFromSuperviewWithoutNeedingDisplay];
+        [playlistScrollView setFrame:playlistTableRect];
         b_podcastView_displayed = NO;
     }
 }
-- 
2.2.1




More information about the vlc-devel mailing list