Commit 41ed8b15 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx/full prefs: move from explicit singleton to a functional singleton

parent 761bddc9
......@@ -10,7 +10,7 @@
<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="34m-Dr-em4"/>
<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"/>
......@@ -19,7 +19,7 @@
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Preferences" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="prefs" animationBehavior="default" id="1530" userLabel="Com. Preferences" customClass="NSPanel">
<windowStyleMask key="styleMask" titled="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
......@@ -42,7 +42,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<outlineView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnReordering="NO" multipleSelection="NO" autosaveColumns="NO" indentationPerLevel="16" autoresizesOutlineColumn="YES" outlineTableColumn="1535" id="1534">
<rect key="frame" x="0.0" y="0.0" width="188" height="392"/>
<rect key="frame" x="0.0" y="0.0" width="188" height="19"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
<size key="intercellSpacing" width="3" height="2"/>
......@@ -63,6 +63,10 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
</tableColumn>
</tableColumns>
<connections>
<outlet property="dataSource" destination="-2" id="mjP-Y3-e81"/>
<outlet property="delegate" destination="-2" id="Wdi-xB-wsa"/>
</connections>
</outlineView>
</subviews>
<animations/>
......
......@@ -29,8 +29,6 @@
*****************************************************************************/
@interface VLCPrefs : NSObject
+ (VLCPrefs *)sharedInstance;
@property (readwrite, weak) IBOutlet NSWindow *prefsWindow;
@property (readwrite, weak) IBOutlet NSTextField *titleLabel;
@property (readwrite, weak) IBOutlet NSOutlineView *tree;
......
......@@ -75,6 +75,7 @@
NSMutableArray *_options;
NSMutableArray *_subviews;
}
@property (readwrite, weak) VLCPrefs *prefsViewController;
- (id)initWithName:(NSString*)name;
......@@ -84,7 +85,7 @@
- (NSString *)name;
- (NSMutableArray *)children;
- (NSMutableArray *)options;
- (void)showView:(NSScrollView *)prefsView;
- (void)showView;
- (void)applyChanges;
- (void)resetView;
......@@ -131,7 +132,6 @@
module_config_t * _configItem;
}
- (id)initWithConfigItem:(module_config_t *)configItem;
- (module_config_t *)configItem;
@end
......@@ -147,7 +147,7 @@
@interface VLCPrefs()
{
VLCTreeMainItem * _rootTreeItem;
VLCTreeMainItem *_rootTreeItem;
NSView *o_emptyView;
NSMutableDictionary *o_save_prefs;
}
......@@ -155,18 +155,6 @@
@implementation VLCPrefs
+ (VLCPrefs *)sharedInstance
{
static VLCPrefs *sharedInstance = nil;
static dispatch_once_t pred;
dispatch_once(&pred, ^{
sharedInstance = [VLCPrefs new];
});
return sharedInstance;
}
- (void)awakeFromNib
{
o_emptyView = [[NSView alloc] init];
......@@ -190,14 +178,14 @@
- (void)setTitle: (NSString *) o_title_name
{
[_titleLabel setStringValue: o_title_name];
[self.titleLabel setStringValue: o_title_name];
}
- (void)showPrefsWithLevel:(NSInteger)iWindow_level
{
[_prefsWindow setLevel: iWindow_level];
[_prefsWindow center];
[_prefsWindow makeKeyAndOrderFront:self];
[self.prefsWindow setLevel: iWindow_level];
[self.prefsWindow center];
[self.prefsWindow makeKeyAndOrderFront:self];
[_rootTreeItem resetView];
}
......@@ -237,7 +225,9 @@
/* update the document view to the view of the selected tree item */
- (void)outlineViewSelectionDidChange:(NSNotification *)o_notification
{
[[_tree itemAtRow:[_tree selectedRow]] showView: _prefsView];
VLCTreeItem *treeItem = [_tree itemAtRow:[_tree selectedRow]];
treeItem.prefsViewController = self;
[treeItem showView];
[_tree expandItem:[_tree itemAtRow:[_tree selectedRow]]];
}
......@@ -296,12 +286,13 @@
return _name;
}
- (void)showView:(NSScrollView *)prefsView
- (void)showView
{
NSScrollView *prefsView = self.prefsViewController.prefsView;
NSRect s_vrc;
NSView *view;
[[VLCPrefs sharedInstance] setTitle: [self name]];
[self.prefsViewController setTitle: [self name]];
s_vrc = [[prefsView contentView] bounds]; s_vrc.size.height -= 4;
view = [[NSView alloc] initWithFrame: s_vrc];
[view setAutoresizingMask: NSViewWidthSizable | NSViewMinYMargin | NSViewMaxYMargin];
......
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