[vlc-commits] macosx: Convert VLCPrefs to NSWindowController subclass

David Fuhrmann git at videolan.org
Sun Aug 2 13:26:38 CEST 2015


vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Sun Aug  2 12:44:31 2015 +0200| [c95d33f94d1ba0bbf75e0ab814d208dba27e90f6] | committer: David Fuhrmann

macosx: Convert VLCPrefs to NSWindowController subclass

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

 .../macosx/Resources/English.lproj/Preferences.xib |    6 ++---
 modules/gui/macosx/intf.m                          |    4 ---
 modules/gui/macosx/prefs.h                         |    3 +--
 modules/gui/macosx/prefs.m                         |   28 +++++++++++++-------
 4 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/extras/package/macosx/Resources/English.lproj/Preferences.xib b/extras/package/macosx/Resources/English.lproj/Preferences.xib
index c9db124..5f2643b 100644
--- a/extras/package/macosx/Resources/English.lproj/Preferences.xib
+++ b/extras/package/macosx/Resources/English.lproj/Preferences.xib
@@ -1,21 +1,21 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="8152.3" systemVersion="15A216g" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7706" systemVersion="14F19a" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
     <dependencies>
         <deployment version="1070" identifier="macosx"/>
         <development version="5100" identifier="xcode"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="8152.3"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7706"/>
     </dependencies>
     <objects>
         <customObject id="-2" userLabel="File's Owner" customClass="VLCPrefs">
             <connections>
                 <outlet property="cancelButton" destination="1543" id="xKX-e8-dhh"/>
                 <outlet property="prefsView" destination="1537" id="Yv9-bn-gFQ"/>
-                <outlet property="prefsWindow" destination="1530" id="GrB-uU-B7B"/>
                 <outlet property="resetButton" destination="1542" id="2QZ-tp-Blv"/>
                 <outlet property="saveButton" destination="1541" id="Ng1-aE-PqI"/>
                 <outlet property="showBasicButton" destination="3642" id="E0I-T2-hF5"/>
                 <outlet property="titleLabel" destination="2257" id="Dzk-M9-HUc"/>
                 <outlet property="tree" destination="1534" id="ZfU-1d-7BL"/>
+                <outlet property="window" destination="1530" id="tB4-5c-gLR"/>
             </connections>
         </customObject>
         <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index 6c755ac..7ffc099 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -141,7 +141,6 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
 
     BOOL nib_main_loaded;       /* main nibfile */
     BOOL nib_about_loaded;      /* about nibfile */
-    BOOL nib_prefs_loaded;      /* preferences xibfile */
     BOOL nib_coredialogs_loaded; /* CoreDialogs nibfile */
     BOOL b_active_videoplayback;
 
@@ -556,9 +555,6 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
     if (!_prefs)
         _prefs = [[VLCPrefs alloc] init];
 
-    if (!nib_prefs_loaded)
-        nib_prefs_loaded = [NSBundle loadNibNamed:@"Preferences" owner: _prefs];
-
     return _prefs;
 }
 
diff --git a/modules/gui/macosx/prefs.h b/modules/gui/macosx/prefs.h
index 6ee116e..2dcca55 100644
--- a/modules/gui/macosx/prefs.h
+++ b/modules/gui/macosx/prefs.h
@@ -27,9 +27,8 @@
 /*****************************************************************************
  * VLCPrefs interface
  *****************************************************************************/
- at interface VLCPrefs : NSObject
+ at interface VLCPrefs : NSWindowController
 
- at property (readwrite, weak) IBOutlet NSWindow *prefsWindow;
 @property (readwrite, weak) IBOutlet NSTextField *titleLabel;
 @property (readwrite, weak) IBOutlet NSOutlineView *tree;
 @property (readwrite, weak) IBOutlet NSScrollView *prefsView;
diff --git a/modules/gui/macosx/prefs.m b/modules/gui/macosx/prefs.m
index 851b667..0f6f8b1 100644
--- a/modules/gui/macosx/prefs.m
+++ b/modules/gui/macosx/prefs.m
@@ -155,15 +155,23 @@
 
 @implementation VLCPrefs
 
-- (void)awakeFromNib
+- (id)init
+{
+    self = [super initWithWindowNibName:@"Preferences"];
+
+    return self;
+}
+
+- (void)windowDidLoad
+
 {
     o_emptyView = [[NSView alloc] init];
     _rootTreeItem = [[VLCTreeMainItem alloc] init];
 
-    [_prefsWindow setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
-    [_prefsWindow setHidesOnDeactivate:YES];
+    [self.window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
+    [self.window setHidesOnDeactivate:YES];
 
-    [_prefsWindow setTitle: _NS("Preferences")];
+    [self.window setTitle: _NS("Preferences")];
     [_saveButton setTitle: _NS("Save")];
     [_cancelButton setTitle: _NS("Cancel")];
     [_resetButton setTitle: _NS("Reset All")];
@@ -183,9 +191,9 @@
 
 - (void)showPrefsWithLevel:(NSInteger)iWindow_level
 {
-    [self.prefsWindow setLevel: iWindow_level];
-    [self.prefsWindow center];
-    [self.prefsWindow makeKeyAndOrderFront:self];
+    [self.window setLevel: iWindow_level];
+    [self.window center];
+    [self.window makeKeyAndOrderFront:self];
     [_rootTreeItem resetView];
 }
 
@@ -195,17 +203,17 @@
     [_rootTreeItem applyChanges];
     [[VLCCoreInteraction sharedInstance] fixPreferences];
     config_SaveConfigFile(VLCIntf);
-    [_prefsWindow orderOut:self];
+    [self.window orderOut:self];
 }
 
 - (IBAction)closePrefs: (id)sender
 {
-    [_prefsWindow orderOut:self];
+    [self.window orderOut:self];
 }
 
 - (IBAction)showSimplePrefs: (id)sender
 {
-    [_prefsWindow orderOut: self];
+    [self.window orderOut: self];
     [[[VLCMain sharedInstance] simplePreferences] showSimplePrefs];
 }
 



More information about the vlc-commits mailing list