Commit 0aad5ff3 authored by David Fuhrmann's avatar David Fuhrmann

macosx: Use NSWindowController for error panel, lazy initialization

parent d7657086
......@@ -32,7 +32,7 @@
</object>
<array class="NSMutableArray" key="IBDocument.RootObjects" id="638050510">
<object class="NSCustomObject" id="923016430">
<string key="NSClassName">VLCErrorPanel</string>
<string key="NSClassName">ErrorWindowController</string>
</object>
<object class="NSCustomObject" id="159526500">
<string key="NSClassName">FirstResponder</string>
......@@ -303,14 +303,6 @@
</object>
<int key="connectionID">13</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">o_window</string>
<reference key="source" ref="923016430"/>
<reference key="destination" ref="883469087"/>
</object>
<int key="connectionID">14</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">cleanupTable:</string>
......@@ -319,6 +311,14 @@
</object>
<int key="connectionID">15</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">window</string>
<reference key="source" ref="923016430"/>
<reference key="destination" ref="883469087"/>
</object>
<int key="connectionID">75</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">dataSource</string>
......@@ -474,13 +474,13 @@
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">74</int>
<int key="maxID">75</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">VLCErrorPanel</string>
<string key="superclassName">NSObject</string>
<string key="className">ErrorWindowController</string>
<string key="superclassName">NSWindowController</string>
<object class="NSMutableDictionary" key="actions">
<string key="NS.key.0">cleanupTable:</string>
<string key="NS.object.0">id</string>
......@@ -517,7 +517,7 @@
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">VLCErrorPanel</string>
<string key="className">ErrorWindowController</string>
<object class="NSMutableDictionary" key="actions">
<string key="NS.key.0">cleanupTable:</string>
<string key="NS.object.0">id</string>
......@@ -680,6 +680,25 @@
<string key="minorKey">AppKit.framework/Headers/NSWindow.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSWindowController</string>
<string key="superclassName">NSResponder</string>
<object class="NSMutableDictionary" key="actions">
<string key="NS.key.0">showWindow:</string>
<string key="NS.object.0">id</string>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<string key="NS.key.0">showWindow:</string>
<object class="IBActionInfo" key="NS.object.0">
<string key="name">showWindow:</string>
<string key="candidateClassName">id</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSWindowController.h</string>
</object>
</object>
</array>
</object>
<int key="IBDocument.localizationMode">0</int>
......
......@@ -1262,7 +1262,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
- (IBAction)viewErrorsAndWarnings:(id)sender
{
[[[[VLCMain sharedInstance] coreDialogProvider] errorPanel] showPanel];
[[[[VLCMain sharedInstance] coreDialogProvider] errorPanel] showWindow:self];
}
- (IBAction)showInformationPanel:(id)sender
......
......@@ -25,35 +25,15 @@
#import <vlc_dialog.h>
#import <Cocoa/Cocoa.h>
/*****************************************************************************
* VLCErrorPanel interface
* VLCCoreDialogProvider interface
*****************************************************************************/
@interface VLCErrorPanel : NSObject
{
IBOutlet id o_window;
IBOutlet id o_cleanup_button;
IBOutlet id o_error_table;
NSMutableArray * o_errors;
NSMutableArray * o_icons;
BOOL b_nib_loaded;
}
- (IBAction)cleanupTable:(id)sender;
-(void)showPanel;
-(void)addError: (NSString *)o_error withMsg:(NSString *)o_msg;
@end
@class ErrorWindowController;
/*****************************************************************************
* VLCCoreDialogProvider interface
*****************************************************************************/
@interface VLCCoreDialogProvider : NSObject
{
VLCErrorPanel *o_error_panel;
ErrorWindowController *o_error_panel;
/* authentication dialogue */
IBOutlet id o_auth_cancel_btn;
......@@ -96,3 +76,23 @@
-(id)errorPanel;
@end
/*****************************************************************************
* VLCErrorPanel interface
*****************************************************************************/
@interface ErrorWindowController : NSWindowController
{
IBOutlet id o_cleanup_button;
IBOutlet id o_error_table;
NSMutableArray *o_errors;
NSMutableArray *o_icons;
}
- (IBAction)cleanupTable:(id)sender;
-(void)addError:(NSString *)o_error withMsg:(NSString *)o_msg;
@end
......@@ -49,7 +49,6 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
[self dealloc];
else {
_o_sharedInstance = [super init];
o_error_panel = [[VLCErrorPanel alloc] init];
b_progress_cancelled = NO;
}
......@@ -89,8 +88,8 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
{
dialog_fatal_t *p_dialog = [o_value pointerValue];
[o_error_panel addError: toNSStr(p_dialog->title) withMsg: toNSStr(p_dialog->message)];
[o_error_panel showPanel];
[[self errorPanel] addError: toNSStr(p_dialog->title) withMsg: toNSStr(p_dialog->message)];
[[self errorPanel] showWindow:self];
}
-(void)showFatalWaitDialog: (NSValue *)o_value
......@@ -211,6 +210,9 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
-(id)errorPanel
{
if (!o_error_panel)
o_error_panel = [[ErrorWindowController alloc] init];
return o_error_panel;
}
......@@ -219,25 +221,25 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
/*****************************************************************************
* VLCErrorPanel implementation
*****************************************************************************/
@implementation VLCErrorPanel
-(id)init
{
[super init];
if (!b_nib_loaded)
b_nib_loaded = [NSBundle loadNibNamed:@"ErrorPanel" owner:self];
@implementation ErrorWindowController
- (id)init
{
self = [super initWithWindowNibName:@"ErrorPanel"];
if (self) {
/* init data sources */
o_errors = [[NSMutableArray alloc] init];
o_icons = [[NSMutableArray alloc] init];
}
return self;
}
- (void)awakeFromNib
- (void)windowDidLoad
{
/* init strings */
[o_window setTitle: _NS("Errors and Warnings")];
[[self window] setTitle: _NS("Errors and Warnings")];
[o_cleanup_button setTitle: _NS("Clean up")];
}
......@@ -248,11 +250,6 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
[super dealloc];
}
-(void)showPanel
{
[o_window makeKeyAndOrderFront: self];
}
-(void)addError: (NSString *)o_error withMsg:(NSString *)o_msg
{
/* format our string as desired */
......
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