CC0B723C0D54F2B000448E00 /* spref_cone_Video_64.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = spref_cone_Video_64.png; path = Resources/spref_cone_Video_64.png; sourceTree = "<group>"; };
CC0FB34B0F8BED1100F057F7 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = Resources/English.lproj/CoreDialogs.nib; sourceTree = "<group>"; };
CC1941240B9C1F8400635F6B /* QTKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QTKit.framework; path = /System/Library/Frameworks/QTKit.framework; sourceTree = "<absolute>"; };
- CC1B4C1409A8EC690078AD2E /* interaction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = interaction.h; path = ../../../modules/gui/macosx/interaction.h; sourceTree = "<group>"; };
- CC1B4C1509A8EC690078AD2E /* interaction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = interaction.m; path = ../../../modules/gui/macosx/interaction.m; sourceTree = "<group>"; };
CC1C41D00D9BAD7F002728FA /* noart.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = noart.png; path = Resources/noart.png; sourceTree = "<group>"; };
CC26BF2B09A7A05000E94D62 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = Resources/English.lproj/Update.nib; sourceTree = "<group>"; };
CC26BF3109A7A08C00E94D62 /* update.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = update.h; path = ../../../modules/gui/macosx/update.h; sourceTree = SOURCE_ROOT; };
CC33C2500D2578F5008C4683 /* fullscreen_graphite.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = fullscreen_graphite.png; path = Resources/fullscreen_graphite.png; sourceTree = "<group>"; };
CC3DC89B0A7CDB9600B53F32 /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = "<absolute>"; };
CC402F4B0E00ABBB006A4BA4 /* VLC.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = VLC.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
+ CC4A33210F8CB017000FC4A7 /* coredialogs.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = coredialogs.m; path = ../../../modules/gui/macosx/coredialogs.m; sourceTree = SOURCE_ROOT; };
+ CC4A33220F8CB017000FC4A7 /* coredialogs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = coredialogs.h; path = ../../../modules/gui/macosx/coredialogs.h; sourceTree = SOURCE_ROOT; };
CC4ED9AC0ABE07C800CA4CC5 /* add_embedded_blue.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = add_embedded_blue.png; path = Resources/add_embedded_blue.png; sourceTree = "<group>"; };
CC4ED9AD0ABE07C800CA4CC5 /* add_embedded.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = add_embedded.png; path = Resources/add_embedded.png; sourceTree = "<group>"; };
CC4ED9AE0ABE07C800CA4CC5 /* repeat_embedded_blue.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = repeat_embedded_blue.png; path = Resources/repeat_embedded_blue.png; sourceTree = "<group>"; };
8ED6C27E03E2EB1C0059A3A7 /* macosx.m */,
8ED6C27C03E2EB1C0059A3A7 /* intf.h */,
8ED6C27D03E2EB1C0059A3A7 /* intf.m */,
- CC1B4C1409A8EC690078AD2E /* interaction.h */,
- CC1B4C1509A8EC690078AD2E /* interaction.m */,
+ CC4A33220F8CB017000FC4A7 /* coredialogs.h */,
+ CC4A33210F8CB017000FC4A7 /* coredialogs.m */,
8E6BC6FA041684EC0059A3A7 /* controls.h */,
8ED6C27B03E2EB1C0059A3A7 /* controls.m */,
8E6BC6F6041643860059A3A7 /* applescript.h */,
#import "coredialogs.h"
#import "misc.h"
-/* for the icons in our custom error panel */
+/* for the icon in our custom error panel */
#import <ApplicationServices/ApplicationServices.h>
+
+/*****************************************************************************
+ * Local prototypes.
+ *****************************************************************************/
+
+bool b_progress_cancelled;
+static void updateProgressPanel (void *, const char *, float);
+static bool checkProgressPanel (void *);
+static void destroyProgressPanel (void *);
+
/*****************************************************************************
* VLCCoreDialogProvider implementation
*****************************************************************************/
selector:@selector(performDialogEvent:)
name: @"VLCNewCoreDialogEventNotification"
object:self];
-
+ [[NSNotificationCenter defaultCenter] addObserver: self
+ selector:@selector(performProgressBarEvent:)
+ name:@"VLCCoreDialogProgressBarUpdateNotification"
+ object: self];
+ [[NSNotificationCenter defaultCenter] addObserver: self
+ selector:@selector(performProgressBarEvent:)
+ name:@"VLCCoreDialogProgressBarDestroyNotification"
+ object: self];
o_error_panel = [[VLCErrorPanel alloc] init];
+ b_progress_cancelled = NO;
}
return _o_sharedInstance;
[self showQuestionDialog: o_value];
else if( [o_type isEqualToString: @"dialog-login"] )
[self showLoginDialog: o_value];
+ else if( [o_type isEqualToString: @"dialog-progress-bar"] )
+ [self showProgressDialog: o_value];
else
msg_Err( VLCIntf, "unhandled dialog type: '%s'", [o_type UTF8String] );
}
[NSApp stopModalWithCode: 0];
}
+-(void)showProgressDialog: (NSValue *)o_value
+{
+ dialog_progress_bar_t *p_dialog = [o_value pointerValue];
+
+ if( p_dialog->title != NULL )
+ {
+ [o_prog_win setTitle: [NSString stringWithUTF8String: p_dialog->title]];
+ [o_prog_title_txt setStringValue: [NSString stringWithUTF8String: p_dialog->title]];
+ }
+ else
+ {
+ [o_prog_win setTitle: @""];
+ [o_prog_title_txt setStringValue: @""];
+ }
+ if( p_dialog->cancel != NULL )
+ [o_prog_cancel_btn setTitle: [NSString stringWithUTF8String: p_dialog->cancel]];
+ else
+ [o_prog_cancel_btn setTitle: _NS("Cancel")];
+ if( p_dialog->message != NULL )
+ [o_prog_description_txt setStringValue: [NSString stringWithUTF8String: p_dialog->message]];
+ else
+ [o_prog_description_txt setStringValue: @""];
+ [o_prog_bar setDoubleValue: 0];
+
+ p_dialog->pf_update = updateProgressPanel;
+ p_dialog->pf_check = checkProgressPanel;
+ p_dialog->pf_destroy = destroyProgressPanel;
+ p_dialog->p_sys = self;
+
+ [NSApp runModalForWindow: o_prog_win];
+}
+
+-(void)performProgressBarEvent: (NSNotification *)o_notification
+{
+ NSLog( @"%@ received", [o_notification name] );
+ if( [[o_notification name] isEqualToString: @"VLCCoreDialogProgressBarUpdateNotification"] )
+ {
+ NSNumber *o_number = [[o_notification userInfo] objectForKey:@"IntValue"];
+ NSString *o_text = [[o_notification userInfo] objectForKey:@"Text"];
+ [o_prog_description_txt setStringValue: o_text];
+ [o_prog_bar setDoubleValue: [o_number doubleValue]];
+ }
+ if( [[o_notification name] isEqualToString: @"VLCCoreDialogProgressBarDestroyNotification"] )
+ {
+ [NSApp stopModalWithCode: 0];
+ [o_prog_win close];
+ }
+}
+
+void updateProgressPanel (void *priv, const char *text, float value)
+{
+ NSLog( @"we were updated with %s (%f)", text, value );
+ NSString *o_txt;
+ if( text != NULL )
+ o_txt = [NSString stringWithUTF8String: text];
+ [[NSNotificationCenter defaultCenter] postNotificationName: @"VLCCoreDialogProgressBarUpdateNotification" object:[[VLCMain sharedInstance] getCoreDialogProvider] userInfo:[NSDictionary dictionaryWithObjectsAndKeys: o_txt, @"Text", [NSNumber numberWithInt: ((int)(value * 1000.))], @"IntValue", nil]];
+}
+
+void destroyProgressPanel (void *priv)
+{
+ NSLog( @"we should destroy" );
+ [[NSNotificationCenter defaultCenter] postNotificationName: @"VLCCoreDialogProgressBarDestroyNotification" object:[[VLCMain sharedInstance] getCoreDialogProvider] userInfo: nil];
+}
+
+bool checkProgressPanel (void *priv)
+{
+ NSLog( @"we were checked" );
+ return b_progress_cancelled;
+}
+
+-(IBAction)progDialogAction:(id)sender
+{
+ NSLog( @"buttonAction!" );
+ b_progress_cancelled = YES;
+}
+
-(id)getErrorPanel
{
return o_error_panel;
}
@end
-#if 0
- dialog_progress_bar_t
- {
- msg_Dbg( p_intf, "user progress dialog requested" );
- [o_prog_title setStringValue: o_title];
- [o_prog_description setStringValue: o_description];
- [o_prog_bar setDoubleValue: (double)p_dialog->val.f_float];
- if( p_dialog->i_timeToGo < 1 )
- [o_prog_timeToGo setStringValue: @""];
- else
- [o_prog_timeToGo setStringValue: [NSString stringWithFormat:
- _NS("Remaining time: %i seconds"), p_dialog->i_timeToGo]];
- [NSApp beginSheet: o_prog_win modalForWindow: o_window
- modalDelegate: self didEndSelector: nil contextInfo: nil];
- [o_prog_win makeKeyWindow];
- }
--(void)updateDialog
-{
- if( p_dialog->i_flags & DIALOG_USER_PROGRESS )
- {
- [o_prog_description setStringValue:
- [NSString stringWithUTF8String: p_dialog->psz_description]];
- [o_prog_bar setDoubleValue: (double)p_dialog->val.f_float];
-
- if( [o_prog_bar doubleValue] == 100.0 )
- {
- /* we are done, let's hide */
- [self hideDialog];
- }
-
- if( p_dialog->i_timeToGo < 1 )
- [o_prog_timeToGo setStringValue: @""];
- else
- [o_prog_timeToGo setStringValue: [NSString stringWithFormat:
- _NS("Remaining time: %i seconds"), p_dialog->i_timeToGo]];
-
- return;
- }
-}
-#endif
-
/*****************************************************************************
* VLCErrorPanel implementation
*****************************************************************************/