Commit 7b66b72d authored by David Fuhrmann's avatar David Fuhrmann

macosx: Convert VLCVideoEffects to NSWindowController subclass

parent f6c4ab14
...@@ -53,13 +53,11 @@ ...@@ -53,13 +53,11 @@
@interface VLCMainMenu() @interface VLCMainMenu()
{ {
BOOL b_nib_videoeffects_loaded;
BOOL b_nib_bookmarks_loaded; BOOL b_nib_bookmarks_loaded;
BOOL b_nib_convertandsave_loaded; BOOL b_nib_convertandsave_loaded;
AboutWindowController *_aboutWindowController; AboutWindowController *_aboutWindowController;
HelpWindowController *_helpWindowController; HelpWindowController *_helpWindowController;
VLCVideoEffects *_videoEffectsWindowController;
VLCConvertAndSave *_convertAndSaveWindowController; VLCConvertAndSave *_convertAndSaveWindowController;
AddonsWindowController *_addonsController; AddonsWindowController *_addonsController;
...@@ -1279,13 +1277,7 @@ ...@@ -1279,13 +1277,7 @@
- (IBAction)showVideoEffects:(id)sender - (IBAction)showVideoEffects:(id)sender
{ {
if (_videoEffectsWindowController == nil) [[[VLCMain sharedInstance] videoEffectsPanel] toggleWindow:sender];
_videoEffectsWindowController = [[VLCVideoEffects alloc] init];
if (!b_nib_videoeffects_loaded)
b_nib_videoeffects_loaded = [NSBundle loadNibNamed:@"VideoEffects" owner: _videoEffectsWindowController];
[_videoEffectsWindowController toggleWindow:sender];
} }
- (IBAction)showTrackSynchronization:(id)sender - (IBAction)showTrackSynchronization:(id)sender
......
...@@ -589,7 +589,7 @@ void WindowClose(vout_window_t *p_wnd) ...@@ -589,7 +589,7 @@ void WindowClose(vout_window_t *p_wnd)
VLCMain *main = [VLCMain sharedInstance]; VLCMain *main = [VLCMain sharedInstance];
[[VLCMainWindow sharedInstance] setWindowLevel:i_level]; [[VLCMainWindow sharedInstance] setWindowLevel:i_level];
[[VLCVideoEffects sharedInstance] updateCocoaWindowLevel:currentStatusWindowLevel]; [[main videoEffectsPanel] updateCocoaWindowLevel:currentStatusWindowLevel];
[[main audioEffectsPanel] updateCocoaWindowLevel:currentStatusWindowLevel]; [[main audioEffectsPanel] updateCocoaWindowLevel:currentStatusWindowLevel];
[[VLCInfo sharedInstance] updateCocoaWindowLevel:currentStatusWindowLevel]; [[VLCInfo sharedInstance] updateCocoaWindowLevel:currentStatusWindowLevel];
[[main bookmarks] updateCocoaWindowLevel:currentStatusWindowLevel]; [[main bookmarks] updateCocoaWindowLevel:currentStatusWindowLevel];
......
...@@ -23,10 +23,9 @@ ...@@ -23,10 +23,9 @@
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
@interface VLCVideoEffects : NSObject @interface VLCVideoEffects : NSWindowController
/* generic */ /* generic */
@property (readwrite, weak) IBOutlet NSWindow *window;
@property (readwrite, weak) IBOutlet NSTabView *tabView; @property (readwrite, weak) IBOutlet NSTabView *tabView;
@property (readwrite, weak) IBOutlet NSPopUpButton *profilePopup; @property (readwrite, weak) IBOutlet NSPopUpButton *profilePopup;
...@@ -162,7 +161,6 @@ ...@@ -162,7 +161,6 @@
@property (nonatomic) int posterizeValue; @property (nonatomic) int posterizeValue;
/* generic */ /* generic */
+ (VLCVideoEffects *)sharedInstance;
- (void)updateCocoaWindowLevel:(NSInteger)i_level; - (void)updateCocoaWindowLevel:(NSInteger)i_level;
- (void)saveCurrentProfile; - (void)saveCurrentProfile;
......
...@@ -38,18 +38,6 @@ ...@@ -38,18 +38,6 @@
@implementation VLCVideoEffects @implementation VLCVideoEffects
+ (VLCVideoEffects *)sharedInstance
{
static VLCVideoEffects *sharedInstance = nil;
static dispatch_once_t pred;
dispatch_once(&pred, ^{
sharedInstance = [VLCVideoEffects new];
});
return sharedInstance;
}
+ (void)initialize + (void)initialize
{ {
NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithObject:@";;;0;1.000000;1.000000;1.000000;1.000000;0.050000;16;2.000000;OTA=;4;4;16711680;20;15;120;Z3JhZGllbnQ=;1;0;16711680;6;80;VkxD;-1;;-1;255;2;3;3"], @"VideoEffectProfiles", NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithObject:@";;;0;1.000000;1.000000;1.000000;1.000000;0.050000;16;2.000000;OTA=;4;4;16711680;20;15;120;Z3JhZGllbnQ=;1;0;16711680;6;80;VkxD;-1;;-1;255;2;3;3"], @"VideoEffectProfiles",
...@@ -59,17 +47,19 @@ ...@@ -59,17 +47,19 @@
- (id)init - (id)init
{ {
self = [super init]; self = [super initWithWindowNibName:@"VideoEffects"];
if (self) {
i_old_profile_index = -1; i_old_profile_index = -1;
}
return self; return self;
} }
- (void)awakeFromNib - (void)windowDidLoad
{ {
[_window setTitle: _NS("Video Effects")]; [self.window setTitle: _NS("Video Effects")];
[_window setExcludedFromWindowsMenu:YES]; [self.window setExcludedFromWindowsMenu:YES];
[_window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary]; [self.window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
[[_tabView tabViewItemAtIndex:[_tabView indexOfTabViewItemWithIdentifier:@"basic"]] setLabel:_NS("Basic")]; [[_tabView tabViewItemAtIndex:[_tabView indexOfTabViewItemWithIdentifier:@"basic"]] setLabel:_NS("Basic")];
[[_tabView tabViewItemAtIndex:[_tabView indexOfTabViewItemWithIdentifier:@"crop"]] setLabel:_NS("Crop")]; [[_tabView tabViewItemAtIndex:[_tabView indexOfTabViewItemWithIdentifier:@"crop"]] setLabel:_NS("Crop")];
...@@ -217,8 +207,8 @@ ...@@ -217,8 +207,8 @@
- (void)updateCocoaWindowLevel:(NSInteger)i_level - (void)updateCocoaWindowLevel:(NSInteger)i_level
{ {
if (_window && [_window isVisible] && [_window level] != i_level) if (self.window && [self.window isVisible] && [self.window level] != i_level)
[_window setLevel: i_level]; [self.window setLevel: i_level];
} }
#pragma mark - #pragma mark -
...@@ -562,11 +552,11 @@ ...@@ -562,11 +552,11 @@
- (IBAction)toggleWindow:(id)sender - (IBAction)toggleWindow:(id)sender
{ {
if ([_window isKeyWindow]) if ([self.window isKeyWindow])
[_window orderOut:sender]; [self.window orderOut:sender];
else { else {
[_window setLevel: [[[VLCMain sharedInstance] voutController] currentStatusWindowLevel]]; [self.window setLevel: [[[VLCMain sharedInstance] voutController] currentStatusWindowLevel]];
[_window makeKeyAndOrderFront:sender]; [self.window makeKeyAndOrderFront:sender];
} }
} }
...@@ -683,7 +673,7 @@ ...@@ -683,7 +673,7 @@
[panel setOKButtonLabel: _NS("Save")]; [panel setOKButtonLabel: _NS("Save")];
[panel setTarget:self]; [panel setTarget:self];
[panel runModalForWindow:_window]; [panel runModalForWindow:self.window];
} }
- (void)panel:(VLCEnterTextPanel *)panel returnValue:(NSUInteger)value text:(NSString *)text - (void)panel:(VLCEnterTextPanel *)panel returnValue:(NSUInteger)value text:(NSString *)text
...@@ -706,7 +696,7 @@ ...@@ -706,7 +696,7 @@
[alert setMessageText:_NS("Please enter a unique name for the new profile.")]; [alert setMessageText:_NS("Please enter a unique name for the new profile.")];
[alert setInformativeText:_NS("Multiple profiles with the same name are not allowed.")]; [alert setInformativeText:_NS("Multiple profiles with the same name are not allowed.")];
[alert beginSheetModalForWindow:_window [alert beginSheetModalForWindow:self.window
modalDelegate:nil modalDelegate:nil
didEndSelector:nil didEndSelector:nil
contextInfo:nil]; contextInfo:nil];
...@@ -745,7 +735,7 @@ ...@@ -745,7 +735,7 @@
[panel setPopupButtonContent:[[NSUserDefaults standardUserDefaults] objectForKey:@"VideoEffectProfileNames"]]; [panel setPopupButtonContent:[[NSUserDefaults standardUserDefaults] objectForKey:@"VideoEffectProfileNames"]];
[panel setTarget:self]; [panel setTarget:self];
[panel runModalForWindow:_window]; [panel runModalForWindow:self.window];
} }
- (void)panel:(VLCSelectItemInPopupPanel *)panel returnValue:(NSUInteger)value item:(NSUInteger)item - (void)panel:(VLCSelectItemInPopupPanel *)panel returnValue:(NSUInteger)value item:(NSUInteger)item
......
...@@ -67,6 +67,7 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification"; ...@@ -67,6 +67,7 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification";
@class VLCDebugMessageVisualizer; @class VLCDebugMessageVisualizer;
@class VLCTrackSynchronization; @class VLCTrackSynchronization;
@class VLCAudioEffects; @class VLCAudioEffects;
@class VLCVideoEffects;
@interface VLCMain : NSObject <NSWindowDelegate, NSApplicationDelegate> @interface VLCMain : NSObject <NSWindowDelegate, NSApplicationDelegate>
{ {
...@@ -95,6 +96,7 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification"; ...@@ -95,6 +96,7 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification";
- (VLCTrackSynchronization *)trackSyncPanel; - (VLCTrackSynchronization *)trackSyncPanel;
- (VLCAudioEffects *)audioEffectsPanel; - (VLCAudioEffects *)audioEffectsPanel;
- (VLCVideoEffects *)videoEffectsPanel;
- (void)setActiveVideoPlayback:(BOOL)b_value; - (void)setActiveVideoPlayback:(BOOL)b_value;
- (BOOL)activeVideoPlayback; - (BOOL)activeVideoPlayback;
......
...@@ -157,6 +157,7 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable, ...@@ -157,6 +157,7 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
VLCDebugMessageVisualizer *_messagePanelController; VLCDebugMessageVisualizer *_messagePanelController;
VLCTrackSynchronization *_trackSyncPanel; VLCTrackSynchronization *_trackSyncPanel;
VLCAudioEffects *_audioEffectsPanel; VLCAudioEffects *_audioEffectsPanel;
VLCVideoEffects *_videoEffectsPanel;
bool b_intf_terminating; /* Makes sure applicationWillTerminate will be called only once */ bool b_intf_terminating; /* Makes sure applicationWillTerminate will be called only once */
} }
...@@ -344,7 +345,7 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable, ...@@ -344,7 +345,7 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
playlist_t * p_playlist = pl_Get(p_intf); playlist_t * p_playlist = pl_Get(p_intf);
/* save current video and audio profiles */ /* save current video and audio profiles */
[[VLCVideoEffects sharedInstance] saveCurrentProfile]; [[self videoEffectsPanel] saveCurrentProfile];
[[self audioEffectsPanel] saveCurrentProfile]; [[self audioEffectsPanel] saveCurrentProfile];
/* Save some interface state in configuration, at module quit */ /* Save some interface state in configuration, at module quit */
...@@ -544,6 +545,14 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable, ...@@ -544,6 +545,14 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
return _audioEffectsPanel; return _audioEffectsPanel;
} }
- (VLCVideoEffects *)videoEffectsPanel
{
if (!_videoEffectsPanel)
_videoEffectsPanel = [[VLCVideoEffects alloc] init];
return _videoEffectsPanel;
}
- (VLCBookmarks *)bookmarks - (VLCBookmarks *)bookmarks
{ {
if (!_bookmarks) if (!_bookmarks)
......
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