Commit c95d33f9 authored by David Fuhrmann's avatar David Fuhrmann

macosx: Convert VLCPrefs to NSWindowController subclass

parent e91c0ed1
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?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> <dependencies>
<deployment version="1070" identifier="macosx"/> <deployment version="1070" identifier="macosx"/>
<development version="5100" identifier="xcode"/> <development version="5100" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="8152.3"/> <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7706"/>
</dependencies> </dependencies>
<objects> <objects>
<customObject id="-2" userLabel="File's Owner" customClass="VLCPrefs"> <customObject id="-2" userLabel="File's Owner" customClass="VLCPrefs">
<connections> <connections>
<outlet property="cancelButton" destination="1543" id="xKX-e8-dhh"/> <outlet property="cancelButton" destination="1543" id="xKX-e8-dhh"/>
<outlet property="prefsView" destination="1537" id="Yv9-bn-gFQ"/> <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="resetButton" destination="1542" id="2QZ-tp-Blv"/>
<outlet property="saveButton" destination="1541" id="Ng1-aE-PqI"/> <outlet property="saveButton" destination="1541" id="Ng1-aE-PqI"/>
<outlet property="showBasicButton" destination="3642" id="E0I-T2-hF5"/> <outlet property="showBasicButton" destination="3642" id="E0I-T2-hF5"/>
<outlet property="titleLabel" destination="2257" id="Dzk-M9-HUc"/> <outlet property="titleLabel" destination="2257" id="Dzk-M9-HUc"/>
<outlet property="tree" destination="1534" id="ZfU-1d-7BL"/> <outlet property="tree" destination="1534" id="ZfU-1d-7BL"/>
<outlet property="window" destination="1530" id="tB4-5c-gLR"/>
</connections> </connections>
</customObject> </customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
......
...@@ -141,7 +141,6 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable, ...@@ -141,7 +141,6 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
BOOL nib_main_loaded; /* main nibfile */ BOOL nib_main_loaded; /* main nibfile */
BOOL nib_about_loaded; /* about nibfile */ BOOL nib_about_loaded; /* about nibfile */
BOOL nib_prefs_loaded; /* preferences xibfile */
BOOL nib_coredialogs_loaded; /* CoreDialogs nibfile */ BOOL nib_coredialogs_loaded; /* CoreDialogs nibfile */
BOOL b_active_videoplayback; BOOL b_active_videoplayback;
...@@ -556,9 +555,6 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable, ...@@ -556,9 +555,6 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
if (!_prefs) if (!_prefs)
_prefs = [[VLCPrefs alloc] init]; _prefs = [[VLCPrefs alloc] init];
if (!nib_prefs_loaded)
nib_prefs_loaded = [NSBundle loadNibNamed:@"Preferences" owner: _prefs];
return _prefs; return _prefs;
} }
......
...@@ -27,9 +27,8 @@ ...@@ -27,9 +27,8 @@
/***************************************************************************** /*****************************************************************************
* VLCPrefs interface * VLCPrefs interface
*****************************************************************************/ *****************************************************************************/
@interface VLCPrefs : NSObject @interface VLCPrefs : NSWindowController
@property (readwrite, weak) IBOutlet NSWindow *prefsWindow;
@property (readwrite, weak) IBOutlet NSTextField *titleLabel; @property (readwrite, weak) IBOutlet NSTextField *titleLabel;
@property (readwrite, weak) IBOutlet NSOutlineView *tree; @property (readwrite, weak) IBOutlet NSOutlineView *tree;
@property (readwrite, weak) IBOutlet NSScrollView *prefsView; @property (readwrite, weak) IBOutlet NSScrollView *prefsView;
......
...@@ -155,15 +155,23 @@ ...@@ -155,15 +155,23 @@
@implementation VLCPrefs @implementation VLCPrefs
- (void)awakeFromNib - (id)init
{
self = [super initWithWindowNibName:@"Preferences"];
return self;
}
- (void)windowDidLoad
{ {
o_emptyView = [[NSView alloc] init]; o_emptyView = [[NSView alloc] init];
_rootTreeItem = [[VLCTreeMainItem alloc] init]; _rootTreeItem = [[VLCTreeMainItem alloc] init];
[_prefsWindow setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary]; [self.window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
[_prefsWindow setHidesOnDeactivate:YES]; [self.window setHidesOnDeactivate:YES];
[_prefsWindow setTitle: _NS("Preferences")]; [self.window setTitle: _NS("Preferences")];
[_saveButton setTitle: _NS("Save")]; [_saveButton setTitle: _NS("Save")];
[_cancelButton setTitle: _NS("Cancel")]; [_cancelButton setTitle: _NS("Cancel")];
[_resetButton setTitle: _NS("Reset All")]; [_resetButton setTitle: _NS("Reset All")];
...@@ -183,9 +191,9 @@ ...@@ -183,9 +191,9 @@
- (void)showPrefsWithLevel:(NSInteger)iWindow_level - (void)showPrefsWithLevel:(NSInteger)iWindow_level
{ {
[self.prefsWindow setLevel: iWindow_level]; [self.window setLevel: iWindow_level];
[self.prefsWindow center]; [self.window center];
[self.prefsWindow makeKeyAndOrderFront:self]; [self.window makeKeyAndOrderFront:self];
[_rootTreeItem resetView]; [_rootTreeItem resetView];
} }
...@@ -195,17 +203,17 @@ ...@@ -195,17 +203,17 @@
[_rootTreeItem applyChanges]; [_rootTreeItem applyChanges];
[[VLCCoreInteraction sharedInstance] fixPreferences]; [[VLCCoreInteraction sharedInstance] fixPreferences];
config_SaveConfigFile(VLCIntf); config_SaveConfigFile(VLCIntf);
[_prefsWindow orderOut:self]; [self.window orderOut:self];
} }
- (IBAction)closePrefs: (id)sender - (IBAction)closePrefs: (id)sender
{ {
[_prefsWindow orderOut:self]; [self.window orderOut:self];
} }
- (IBAction)showSimplePrefs: (id)sender - (IBAction)showSimplePrefs: (id)sender
{ {
[_prefsWindow orderOut: self]; [self.window orderOut: self];
[[[VLCMain sharedInstance] simplePreferences] showSimplePrefs]; [[[VLCMain sharedInstance] simplePreferences] showSimplePrefs];
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment