From 0a9dbda92034654d20a12e3d616e93e3ac382849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= Date: Sun, 30 Jul 2006 22:00:44 +0000 Subject: [PATCH] * additional interaction enhancements - intf_UserFatal takes an addition bool-argument now to set whether the error message will be blocking in the interface or not (so TRUE = blocking) - intf_UserWarn is always non-blocking and is used to check important, localised warnings to the user * wx: a compilation fix, but no update to the current API * osx: complete implementation of the interaction framework using some Carbon (!) functions, because the needed icons aren't accessible through Cocoa. Regrettably, I had to add yet another nib-file to keep the code clean and readable. The Error-dialogue is no longer re-usable (so the specific ID was removed). The interface needs to keep track of the reported errors and warnings. Thus, it may discard them as requested by the user and doesn't need to care about the core. --- Makefile.am | 3 + .../InteractionErrorPanel.nib/classes.nib | 13 + .../InteractionErrorPanel.nib/info.nib | 16 + .../keyedobjects.nib | Bin 0 -> 6667 bytes extras/MacOSX/vlc.pbproj/project.pbxproj | 16 + include/vlc_interaction.h | 13 +- modules/gui/macosx/interaction.h | 25 ++ modules/gui/macosx/interaction.m | 298 +++++++++++++----- modules/gui/wxwidgets/dialogs/interaction.cpp | 2 +- modules/gui/wxwidgets/interface.cpp | 10 +- src/interface/interaction.c | 57 ++-- 11 files changed, 344 insertions(+), 109 deletions(-) create mode 100644 extras/MacOSX/Resources/English.lproj/InteractionErrorPanel.nib/classes.nib create mode 100644 extras/MacOSX/Resources/English.lproj/InteractionErrorPanel.nib/info.nib create mode 100644 extras/MacOSX/Resources/English.lproj/InteractionErrorPanel.nib/keyedobjects.nib diff --git a/Makefile.am b/Makefile.am index 653e9fd185..b096ac0c8d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -82,6 +82,9 @@ EXTRA_DIST += \ extras/MacOSX/Resources/English.lproj/Interaction.nib/classes.nib \ extras/MacOSX/Resources/English.lproj/Interaction.nib/info.nib \ extras/MacOSX/Resources/English.lproj/Interaction.nib/keyedobjects.nib \ + extras/MacOSX/Resources/English.lproj/InteractionErrorPanel.nib/classes.nib \ + extras/MacOSX/Resources/English.lproj/InteractionErrorPanel.nib/info.nib \ + extras/MacOSX/Resources/English.lproj/InteractionErrorPanel.nib/keyedobjects.nib \ extras/MacOSX/Resources/English.lproj/InfoPlist.strings \ extras/MacOSX/Resources/a52.icns \ extras/MacOSX/Resources/aac.icns \ diff --git a/extras/MacOSX/Resources/English.lproj/InteractionErrorPanel.nib/classes.nib b/extras/MacOSX/Resources/English.lproj/InteractionErrorPanel.nib/classes.nib new file mode 100644 index 0000000000..da12b4648b --- /dev/null +++ b/extras/MacOSX/Resources/English.lproj/InteractionErrorPanel.nib/classes.nib @@ -0,0 +1,13 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {cleanupTable = id; }; + CLASS = VLCErrorInteractionPanel; + LANGUAGE = ObjC; + OUTLETS = {"o_cleanup_button" = id; "o_error_table" = id; "o_window" = id; }; + SUPERCLASS = NSObject; + } + ); + IBVersion = 1; +} \ No newline at end of file diff --git a/extras/MacOSX/Resources/English.lproj/InteractionErrorPanel.nib/info.nib b/extras/MacOSX/Resources/English.lproj/InteractionErrorPanel.nib/info.nib new file mode 100644 index 0000000000..ad5fd3f1ba --- /dev/null +++ b/extras/MacOSX/Resources/English.lproj/InteractionErrorPanel.nib/info.nib @@ -0,0 +1,16 @@ + + + + + IBDocumentLocation + 69 66 356 240 0 0 1440 878 + IBFramework Version + 446.1 + IBOpenObjects + + 5 + + IBSystem Version + 8J135 + + diff --git a/extras/MacOSX/Resources/English.lproj/InteractionErrorPanel.nib/keyedobjects.nib b/extras/MacOSX/Resources/English.lproj/InteractionErrorPanel.nib/keyedobjects.nib new file mode 100644 index 0000000000000000000000000000000000000000..97c124958b7232022f3f629a29608f5e1b260802 GIT binary patch literal 6667 zcmZ`-2YgfY_CM#BeY0+IF9?WGYH>pCqAV5KvT0LjN-4EaLV78IkklkCqZWRk;=tzy z-V;=0$>ZTf5fv2|PE>~aP!UAj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tc+&w7EipEcK-Z!NT5YOSmutl))m$@*3H(3tlO>u1c5*bS!pU>$t^nr(=s_n`4J#x8tM)5|hl5 zL-I(nQi)V1jg&@90cno3Kx&iPrNz<`=}PHZ=}zfx=^kmlv{8Ce zdRcl++9Ms6j!Bkm9ud|!8w=>sS>>Tf`a8^1eI)l!s&e_hm^K$1x=QYmT zop(96Iv;iJbnbT^b)Izo=={m~i}N>EH&+i=PggHjZ&$V}$90Ztplh&esOu8fFjtLh zx$92XgRW;>2V6&8Ke#2g%k6Q?ZogY~cXfAj_i>-??(4q5-Orux9^xMA9^nqSC%C7$ zr@IsGHuqKTo7`*MTin~+PrF}ozvuqSecb(x`#bkZ&v~AUJpoUxXQn6RS>n0T^LNii z&jX$(J$pU-J#Ty7^&IrP?>Xc-?D@#^vFB^g3D38l@4asC+1`HMB5$#Gn0JJCl(*7b z?XB_Fdh5K)y{o)yy<5Fccwh3q;(g7#$NQ#tuXn%q9q&Q!``$y|!`|<`zsXEC%T`KW zNmk^payPk$oG*`($H?R4aycM3$tju3OXcPA?eg97F8LLCzx;vxp?pL>Dj$HQtQ|YB-Dd#J>%0OkDQmzD)2}+ext<)&BN}W=#OjDYaR%O1jP`N@` zq;O@aa+R`7xk> z)j{eI^b+}rpj!;LbW7KhKxf)O>s8wpUI#uQBQuQiznR=~yy?TRsqk6M?t9rY- zQvJJnhq^|+OI@q3Q#Yua)XnM^b*p;6`k?x-`iQz+-Jw3A?o?k?cdIX}d)0mF0rimj Xp?XC9LOlWchq3f=o^j0ltAG3-v&G<7 literal 0 HcmV?d00001 diff --git a/extras/MacOSX/vlc.pbproj/project.pbxproj b/extras/MacOSX/vlc.pbproj/project.pbxproj index 052574e572..e23f63a64f 100644 --- a/extras/MacOSX/vlc.pbproj/project.pbxproj +++ b/extras/MacOSX/vlc.pbproj/project.pbxproj @@ -72,8 +72,10 @@ C2F2A707095AE51700018C74 /* play_embedded_blue.png in Resources */ = {isa = PBXBuildFile; fileRef = C2F2A703095AE51600018C74 /* play_embedded_blue.png */; }; C2F2A708095AE51700018C74 /* skip_forward_embedded_blue.png in Resources */ = {isa = PBXBuildFile; fileRef = C2F2A704095AE51600018C74 /* skip_forward_embedded_blue.png */; }; C2F2A709095AE51700018C74 /* skip_previous_embedded_blue.png in Resources */ = {isa = PBXBuildFile; fileRef = C2F2A705095AE51600018C74 /* skip_previous_embedded_blue.png */; }; + CC1AC1BC0A7BDA41002478C3 /* InteractionErrorPanel.nib in Resources */ = {isa = PBXBuildFile; fileRef = CC1AC1BA0A7BDA41002478C3 /* InteractionErrorPanel.nib */; }; CC1B4B4D09A8CF9E0078AD2E /* Interaction.nib in Resources */ = {isa = PBXBuildFile; fileRef = CC1B4B4B09A8CF9E0078AD2E /* Interaction.nib */; }; CC26BF2C09A7A05000E94D62 /* Update.nib in Resources */ = {isa = PBXBuildFile; fileRef = CC26BF2A09A7A05000E94D62 /* Update.nib */; }; + CC3DC89C0A7CDB9600B53F32 /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CC3DC89B0A7CDB9600B53F32 /* ApplicationServices.framework */; }; CCF3C64C0923B99D00401862 /* SFilters.nib in Resources */ = {isa = PBXBuildFile; fileRef = CCF3C64A0923B99D00401862 /* SFilters.nib */; }; DC7F46ED08A183FC0027DB24 /* Extended.nib in Resources */ = {isa = PBXBuildFile; fileRef = DC7F46EB08A183FC0027DB24 /* Extended.nib */; }; DCA00AA9075F948800E6BF46 /* About.nib in Resources */ = {isa = PBXBuildFile; fileRef = DCA00AA7075F948800E6BF46 /* About.nib */; }; @@ -904,12 +906,14 @@ C2F2A703095AE51600018C74 /* play_embedded_blue.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = play_embedded_blue.png; path = Resources/play_embedded_blue.png; sourceTree = ""; }; C2F2A704095AE51600018C74 /* skip_forward_embedded_blue.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = skip_forward_embedded_blue.png; path = Resources/skip_forward_embedded_blue.png; sourceTree = ""; }; C2F2A705095AE51600018C74 /* skip_previous_embedded_blue.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = skip_previous_embedded_blue.png; path = Resources/skip_previous_embedded_blue.png; sourceTree = ""; }; + CC1AC1BB0A7BDA41002478C3 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = Resources/English.lproj/InteractionErrorPanel.nib; sourceTree = ""; }; CC1B4B4C09A8CF9E0078AD2E /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = Resources/English.lproj/Interaction.nib; sourceTree = ""; }; CC1B4C1409A8EC690078AD2E /* interaction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = interaction.h; path = ../../modules/gui/macosx/interaction.h; sourceTree = ""; }; CC1B4C1509A8EC690078AD2E /* interaction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = interaction.m; path = ../../modules/gui/macosx/interaction.m; sourceTree = ""; }; CC26BF2B09A7A05000E94D62 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = Resources/English.lproj/Update.nib; sourceTree = ""; }; CC26BF3109A7A08C00E94D62 /* update.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = update.h; path = ../../modules/gui/macosx/update.h; sourceTree = SOURCE_ROOT; }; CC26BF3209A7A08C00E94D62 /* update.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = update.m; path = ../../modules/gui/macosx/update.m; sourceTree = SOURCE_ROOT; }; + CC3DC89B0A7CDB9600B53F32 /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = ""; }; CCF3C64B0923B99D00401862 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = Resources/English.lproj/SFilters.nib; sourceTree = ""; }; CCF3C6500923B9D100401862 /* sfilters.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = sfilters.h; path = ../../modules/gui/macosx/sfilters.h; sourceTree = SOURCE_ROOT; }; CCF3C6510923B9D100401862 /* sfilters.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = sfilters.m; path = ../../modules/gui/macosx/sfilters.m; sourceTree = SOURCE_ROOT; }; @@ -943,6 +947,7 @@ buildActionMask = 2147483647; files = ( 1058C7AFFEA557BF11CA2CBB /* Cocoa.framework in Frameworks */, + CC3DC89C0A7CDB9600B53F32 /* ApplicationServices.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1039,6 +1044,7 @@ 1058C7ACFEA557BF11CA2CBB /* Linked Frameworks */ = { isa = PBXGroup; children = ( + CC3DC89B0A7CDB9600B53F32 /* ApplicationServices.framework */, 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */, ); name = "Linked Frameworks"; @@ -1153,6 +1159,7 @@ CCF3C64A0923B99D00401862 /* SFilters.nib */, CC26BF2A09A7A05000E94D62 /* Update.nib */, CC1B4B4B09A8CF9E0078AD2E /* Interaction.nib */, + CC1AC1BA0A7BDA41002478C3 /* InteractionErrorPanel.nib */, ); name = nibs; sourceTree = ""; @@ -1261,6 +1268,7 @@ C2F2A709095AE51700018C74 /* skip_previous_embedded_blue.png in Resources */, CC26BF2C09A7A05000E94D62 /* Update.nib in Resources */, CC1B4B4D09A8CF9E0078AD2E /* Interaction.nib in Resources */, + CC1AC1BC0A7BDA41002478C3 /* InteractionErrorPanel.nib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1277,6 +1285,14 @@ /* End PBXRezBuildPhase section */ /* Begin PBXVariantGroup section */ + CC1AC1BA0A7BDA41002478C3 /* InteractionErrorPanel.nib */ = { + isa = PBXVariantGroup; + children = ( + CC1AC1BB0A7BDA41002478C3 /* English */, + ); + name = InteractionErrorPanel.nib; + sourceTree = ""; + }; CC1B4B4B09A8CF9E0078AD2E /* Interaction.nib */ = { isa = PBXVariantGroup; children = ( diff --git a/include/vlc_interaction.h b/include/vlc_interaction.h index c8b2940723..82741f7e41 100644 --- a/include/vlc_interaction.h +++ b/include/vlc_interaction.h @@ -87,9 +87,12 @@ struct interaction_dialog_t #define DIALOG_CLEAR_NOSHOW 0x08 #define DIALOG_GOT_ANSWER 0x10 #define DIALOG_LOGIN_PW_OK_CANCEL 0x20 +#define DIALOG_BLOCKING_ERROR 0x24 +#define DIALOG_NONBLOCKING_ERROR 0x200 #define DIALOG_USER_PROGRESS 0x40 #define DIALOG_PSZ_INPUT_OK_CANCEL 0x80 #define DIALOG_INTF_PROGRESS 0x100 +#define DIALOG_WARNING 0x400 /** * Possible return codes @@ -121,7 +124,6 @@ enum */ enum { - INTERACT_PROGRESS, ///< Progress bar (in the main interface ?) INTERACT_DIALOG_ONEWAY, ///< Dialog box without feedback INTERACT_DIALOG_TWOWAY, ///< Dialog box with feedback }; @@ -132,14 +134,13 @@ enum enum { DIALOG_FIRST, - DIALOG_ERRORS, DIALOG_LAST_PREDEFINED, }; /** * This structure contains the active interaction dialogs, and is - * used by teh manager + * used by the manager */ struct interaction_t { @@ -170,8 +171,10 @@ enum #define intf_Interact( a,b ) __intf_Interact( VLC_OBJECT(a), b ) VLC_EXPORT( int,__intf_Interact,( vlc_object_t *,interaction_dialog_t * ) ); -#define intf_UserFatal( a, c, d, e... ) __intf_UserFatal( VLC_OBJECT(a),c,d, ## e ) -VLC_EXPORT( void, __intf_UserFatal,( vlc_object_t*, const char*, const char*, ...) ); +#define intf_UserFatal( a, b, c, d, e... ) __intf_UserFatal( VLC_OBJECT(a),b,c,d, ## e ) +VLC_EXPORT( void, __intf_UserFatal,( vlc_object_t*, vlc_bool_t, const char*, const char*, ...) ); +#define intf_UserWarn( a, c, d, e... ) __intf_UserWarn( VLC_OBJECT(a),c,d, ## e ) +VLC_EXPORT( void, __intf_UserWarn,( vlc_object_t*, const char*, const char*, ...) ); #define intf_UserLoginPassword( a, b, c, d, e... ) __intf_UserLoginPassword( VLC_OBJECT(a),b,c,d,e) VLC_EXPORT( int, __intf_UserLoginPassword,( vlc_object_t*, const char*, const char*, char **, char **) ); #define intf_UserYesNo( a, b, c, d, e, f ) __intf_UserYesNo( VLC_OBJECT(a),b,c, d, e, f ) diff --git a/modules/gui/macosx/interaction.h b/modules/gui/macosx/interaction.h index 28978997cc..1fb5f00c32 100644 --- a/modules/gui/macosx/interaction.h +++ b/modules/gui/macosx/interaction.h @@ -76,16 +76,41 @@ @end +@interface VLCErrorInteractionPanel : NSObject +{ + IBOutlet id o_window; + IBOutlet id o_cleanup_button; + IBOutlet id o_error_table; + + NSMutableArray * o_errors; + NSMutableArray * o_icons; + + NSImage * warnIcon; + NSImage * errorIcon; + + BOOL nib_interact_errpanel_loaded; +} +- (IBAction)cleanupTable:(id)sender; + +-(void)showPanel; +-(void)addError: (NSString *)o_error withMsg:(NSString *)o_msg; +-(void)addWarning: (NSString *)o_warning withMsg:(NSString *)o_msg; + +@end + /***************************************************************************** * VLCInteractionList interface *****************************************************************************/ @interface VLCInteractionList : NSObject { NSMutableArray *o_interaction_list; + VLCErrorInteractionPanel *o_error_panel; } -(void)newInteractionEvent: (NSNotification *)o_notification; -(void)addInteraction: (interaction_dialog_t *)p_dialog; -(void)removeInteraction: (VLCInteraction *)p_interaction; +-(id)getErrorPanel; + @end diff --git a/modules/gui/macosx/interaction.m b/modules/gui/macosx/interaction.m index 789bfebe86..dcb7d2c51f 100644 --- a/modules/gui/macosx/interaction.m +++ b/modules/gui/macosx/interaction.m @@ -25,6 +25,9 @@ #import "intf.h" #import "interaction.h" +/* for the icons in our custom error panel */ +#import + /***************************************************************************** * VLCInteractionList implementation *****************************************************************************/ @@ -39,6 +42,8 @@ name: @"VLCNewInteractionEventNotification" object:self]; + o_error_panel = [[VLCErrorInteractionPanel alloc] init]; + return self; } @@ -72,7 +77,6 @@ -(void)addInteraction: (interaction_dialog_t *)p_dialog { - VLCInteraction *o_interaction = [[VLCInteraction alloc] initDialog: p_dialog]; p_dialog->p_private = (void *)o_interaction; @@ -85,6 +89,11 @@ [o_interaction_list removeObject:o_interaction]; } +-(id)getErrorPanel +{ + return o_error_panel; +} + -(void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; @@ -92,7 +101,6 @@ [o_interaction_list release]; [super dealloc]; } - @end /***************************************************************************** @@ -128,10 +136,10 @@ o_mainIntfPgbar = [[VLCMain sharedInstance] getMainIntfPgbar]; } - NSString *o_title = [NSString stringWithUTF8String:p_dialog->psz_title ? p_dialog->psz_title : "title"]; + NSString *o_title = [NSString stringWithUTF8String:p_dialog->psz_title ? p_dialog->psz_title : _("Error")]; NSString *o_description = [NSString stringWithUTF8String:p_dialog->psz_description ? p_dialog->psz_description : ""]; - NSString *o_defaultButton = [NSString stringWithUTF8String:p_dialog->psz_defaultButton]; - NSString *o_alternateButton = [NSString stringWithUTF8String:p_dialog->psz_alternateButton]; + NSString *o_defaultButton = p_dialog->psz_defaultButton ? [NSString stringWithUTF8String:p_dialog->psz_defaultButton] : nil; + NSString *o_alternateButton = p_dialog->psz_alternateButton ? [NSString stringWithUTF8String:p_dialog->psz_alternateButton] : nil; NSString *o_otherButton = p_dialog->psz_otherButton ? [NSString stringWithUTF8String:p_dialog->psz_otherButton] : nil; vout_thread_t *p_vout = vlc_object_find( VLCIntf, VLC_OBJECT_VOUT, FIND_ANYWHERE ); @@ -154,81 +162,86 @@ o_window = [NSApp mainWindow]; } - #if 0 +#if 0 msg_Dbg( p_intf, "Title: %s", [o_title UTF8String] ); msg_Dbg( p_intf, "Description: %s", [o_description UTF8String] ); - #endif + msg_Dbg( p_intf, "Delivered flag: %i", p_dialog->i_flags ); +#endif - if( p_dialog->i_id == DIALOG_ERRORS ) + if( p_dialog->i_flags & DIALOG_BLOCKING_ERROR ) { msg_Dbg( p_intf, "error panel requested" ); - NSAlert * ourAlert = [NSAlert alertWithMessageText: - [NSString stringWithUTF8String:p_dialog->psz_title ? p_dialog->psz_title : _("Error")] - defaultButton: _NS("OK") alternateButton: nil otherButton: nil - informativeTextWithFormat: - [NSString stringWithUTF8String:p_dialog->psz_description]]; - [ourAlert setAlertStyle: NSWarningAlertStyle]; - [ourAlert runModal]; + NSBeginInformationalAlertSheet( o_title, _NS("OK"), nil, nil, + o_window, self, @selector(sheetDidEnd: returnCode: contextInfo:), + NULL, nil, o_description ); + } + else if( p_dialog->i_flags & DIALOG_NONBLOCKING_ERROR ) + { + msg_Dbg( p_intf, "addition to non-blocking error panel received" ); + [[[[VLCMain sharedInstance] getInteractionList] getErrorPanel] + addError: o_title withMsg: o_description]; + } + else if( p_dialog->i_flags & DIALOG_WARNING ) + { + msg_Dbg( p_intf, "addition to non-blocking warning panel received" ); + [[[[VLCMain sharedInstance] getInteractionList] getErrorPanel] + addWarning: o_title withMsg: o_description]; + } + else if( p_dialog->i_flags & DIALOG_YES_NO_CANCEL ) + { + msg_Dbg( p_intf, "yes-no-cancel-dialog requested" ); + NSBeginInformationalAlertSheet( o_title, o_defaultButton, + o_alternateButton, o_otherButton, o_window, self, + @selector(sheetDidEnd: returnCode: contextInfo:), NULL, nil, + o_description ); + } + else if( p_dialog->i_flags & DIALOG_LOGIN_PW_OK_CANCEL ) + { + msg_Dbg( p_intf, "dialog for login and pw requested" ); + [o_auth_title setStringValue: o_title]; + [o_auth_description setStringValue: o_description]; + [o_auth_login_fld setStringValue: @""]; + [o_auth_pw_fld setStringValue: @""]; + [NSApp beginSheet: o_auth_win modalForWindow: o_window + modalDelegate: self didEndSelector: nil contextInfo: nil]; + [o_auth_win makeKeyWindow]; + } + else if( p_dialog->i_flags & DIALOG_USER_PROGRESS ) + { + 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]; + } + else if( p_dialog->i_flags & DIALOG_PSZ_INPUT_OK_CANCEL ) + { + msg_Dbg( p_intf, "text input from user requested" ); + [o_input_title setStringValue: o_title]; + [o_input_description setStringValue: o_description]; + [o_input_fld setStringValue: @""]; + [NSApp beginSheet: o_input_win modalForWindow: o_window + modalDelegate: self didEndSelector: nil contextInfo: nil]; + [o_input_win makeKeyWindow]; + } + else if( p_dialog->i_flags & DIALOG_INTF_PROGRESS ) + { + msg_Dbg( p_intf, "progress-bar in main intf requested" ); + [[VLCMain sharedInstance] setScrollField: o_description stopAfter: -1]; + [o_mainIntfPgbar setDoubleValue: (double)p_dialog->val.f_float]; + [o_mainIntfPgbar setHidden: NO]; + [[[VLCMain sharedInstance] getControllerWindow] makeKeyWindow]; + [o_mainIntfPgbar setIndeterminate: NO]; } else - { - if( p_dialog->i_flags & DIALOG_YES_NO_CANCEL ) - { - msg_Dbg( p_intf, "yes-no-cancel-dialog requested" ); - NSBeginInformationalAlertSheet( o_title, o_defaultButton, - o_alternateButton, o_otherButton, o_window, self, - @selector(sheetDidEnd: returnCode: contextInfo:), NULL, nil, - o_description ); - } - else if( p_dialog->i_flags & DIALOG_LOGIN_PW_OK_CANCEL ) - { - msg_Dbg( p_intf, "dialog for login and pw requested" ); - [o_auth_title setStringValue: o_title]; - [o_auth_description setStringValue: o_description]; - [o_auth_login_fld setStringValue: @""]; - [o_auth_pw_fld setStringValue: @""]; - [NSApp beginSheet: o_auth_win modalForWindow: o_window - modalDelegate: self didEndSelector: nil contextInfo: nil]; - [o_auth_win makeKeyWindow]; - } - else if( p_dialog->i_flags & DIALOG_USER_PROGRESS ) - { - 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]; - } - else if( p_dialog->i_flags & DIALOG_PSZ_INPUT_OK_CANCEL ) - { - msg_Dbg( p_intf, "text input from user requested" ); - [o_input_title setStringValue: o_title]; - [o_input_description setStringValue: o_description]; - [o_input_fld setStringValue: @""]; - [NSApp beginSheet: o_input_win modalForWindow: o_window - modalDelegate: self didEndSelector: nil contextInfo: nil]; - [o_input_win makeKeyWindow]; - } - else if( p_dialog->i_flags & DIALOG_INTF_PROGRESS ) - { - msg_Dbg( p_intf, "progress-bar in main intf requested" ); - [[VLCMain sharedInstance] setScrollField: o_description stopAfter: -1]; - [o_mainIntfPgbar setDoubleValue: (double)p_dialog->val.f_float]; - [o_mainIntfPgbar setHidden: NO]; - [[[VLCMain sharedInstance] getControllerWindow] makeKeyWindow]; - [o_mainIntfPgbar setIndeterminate: NO]; - } - else - msg_Err( p_intf, "requested dialog type unknown (%i)", - p_dialog->i_flags ); - } + msg_Err( p_intf, "requested dialog type unknown (%i)", p_dialog->i_flags ); } - (void)sheetDidEnd:(NSWindow *)o_sheet returnCode:(int)i_return @@ -344,6 +357,7 @@ - (IBAction)okayAndClose:(id)sender { + msg_Dbg( p_intf, "running okayAndClose" ); vlc_mutex_lock( &p_dialog->p_interaction->object_lock ); if( p_dialog->i_flags == DIALOG_LOGIN_PW_OK_CANCEL ) { @@ -359,3 +373,141 @@ } @end + +/***************************************************************************** + * VLCErrorInteractionPanel implementation + *****************************************************************************/ +@implementation VLCErrorInteractionPanel +-(id)init +{ + [super init]; + nib_interact_errpanel_loaded = [NSBundle loadNibNamed:@"InteractionErrorPanel" owner:self]; + [o_window setTitle: _NS("Errors and Warnings")]; + [o_cleanup_button setTitle: _NS("Clean up")]; + o_errors = [[NSMutableArray alloc] init]; + o_icons = [[NSMutableArray alloc] init]; + + /* ugly Carbon stuff following... + * regrettably, you can't get the icons through clean Cocoa */ + + /* retrieve our error icon */ + IconRef ourIconRef; + int returnValue; + returnValue = GetIconRef(kOnSystemDisk, 'macs', 'stop', &ourIconRef); + errorIcon = [[NSImage alloc] initWithSize:NSMakeSize(32,32)]; + [errorIcon lockFocus]; + CGRect rect = CGRectMake(0,0,32,32); + PlotIconRefInContext((CGContextRef)[[NSGraphicsContext currentContext] + graphicsPort], + &rect, + kAlignNone, + kTransformNone, + NULL /*inLabelColor*/, + kPlotIconRefNormalFlags, + (IconRef)ourIconRef); + [errorIcon unlockFocus]; + returnValue = ReleaseIconRef(ourIconRef); + + /* retrieve our caution icon */ + returnValue = GetIconRef(kOnSystemDisk, 'macs', 'caut', &ourIconRef); + warnIcon = [[NSImage alloc] initWithSize:NSMakeSize(32,32)]; + [warnIcon lockFocus]; + PlotIconRefInContext((CGContextRef)[[NSGraphicsContext currentContext] + graphicsPort], + &rect, + kAlignNone, + kTransformNone, + NULL /*inLabelColor*/, + kPlotIconRefNormalFlags, + (IconRef)ourIconRef); + [warnIcon unlockFocus]; + returnValue = ReleaseIconRef(ourIconRef); + + return self; +} + +-(void)dealloc +{ + [errorIcon release]; + [warnIcon release]; + [o_errors release]; + [o_icons release]; + [super dealloc]; +} + +-(void)showPanel +{ + [o_window makeKeyAndOrderFront: self]; +} + +-(void)addError: (NSString *)o_error withMsg:(NSString *)o_msg +{ + /* format our string as desired */ + NSMutableAttributedString * ourError; + ourError = [[NSMutableAttributedString alloc] initWithString: + [NSString stringWithFormat:@"%@\n%@", o_error, o_msg] + attributes: + [NSDictionary dictionaryWithObject: [NSFont systemFontOfSize:11] forKey: NSFontAttributeName]]; + [ourError + addAttribute: NSFontAttributeName + value: [NSFont boldSystemFontOfSize:11] + range: NSMakeRange( 0, [o_error length])]; + [o_errors addObject: ourError]; + [ourError release]; + + [o_icons addObject: errorIcon]; + + [o_error_table reloadData]; + [self showPanel]; +} + +-(void)addWarning: (NSString *)o_warning withMsg:(NSString *)o_msg +{ + /* format our string as desired */ + NSMutableAttributedString * ourWarning; + ourWarning = [[NSMutableAttributedString alloc] initWithString: + [NSString stringWithFormat:@"%@\n%@", o_warning, o_msg] + attributes: + [NSDictionary dictionaryWithObject: [NSFont systemFontOfSize:11] forKey: NSFontAttributeName]]; + [ourWarning + addAttribute: NSFontAttributeName + value: [NSFont boldSystemFontOfSize:11] + range: NSMakeRange( 0, [o_warning length])]; + [o_errors addObject: ourWarning]; + [ourWarning release]; + + [o_icons addObject: warnIcon]; + + [o_error_table reloadData]; + + [self showPanel]; +} + +-(IBAction)cleanupTable:(id)sender +{ + [o_errors removeAllObjects]; + [o_icons removeAllObjects]; + [o_error_table reloadData]; +} + +/*---------------------------------------------------------------------------- + * data source methods + *---------------------------------------------------------------------------*/ +- (int)numberOfRowsInTableView:(NSTableView *)theDataTable +{ + return [o_errors count]; +} + +- (id)tableView:(NSTableView *)theDataTable objectValueForTableColumn: + (NSTableColumn *)theTableColumn row: (int)row +{ + if( [[theTableColumn identifier] isEqualToString: @"error_msg"] ) + return [o_errors objectAtIndex: row]; + + if( [[theTableColumn identifier] isEqualToString: @"icon"] ) + return [o_icons objectAtIndex: row]; + + return @"unknown identifier"; +} + +@end diff --git a/modules/gui/wxwidgets/dialogs/interaction.cpp b/modules/gui/wxwidgets/dialogs/interaction.cpp index 92dd5f4c52..1ae280e388 100644 --- a/modules/gui/wxwidgets/dialogs/interaction.cpp +++ b/modules/gui/wxwidgets/dialogs/interaction.cpp @@ -109,7 +109,7 @@ void InteractionDialog::Render() wxGauge *gauge; - if( p_dialog->i_id == DIALOG_ERRORS ) + if( p_dialog->i_id == DIALOG_NONBLOCKING_ERRORS ) { wxTextCtrl *errors ; // Special case label = new wxStaticText( widgets_panel, -1, diff --git a/modules/gui/wxwidgets/interface.cpp b/modules/gui/wxwidgets/interface.cpp index 4bb35c3067..028365e3ed 100644 --- a/modules/gui/wxwidgets/interface.cpp +++ b/modules/gui/wxwidgets/interface.cpp @@ -1239,15 +1239,9 @@ void Interface::OnInteraction( wxCommandEvent& event ) p_arg->p_dialog = p_dialog; p_arg->p_intf = p_intf; - if( p_dialog->i_type == INTERACT_PROGRESS ) - { - /// \todo Handle progress in the interface - } - else - { - p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_INTERACTION, + p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_INTERACTION, 0, p_arg ); - } + } static int InteractCallback( vlc_object_t *p_this, diff --git a/src/interface/interaction.c b/src/interface/interaction.c index 6d79622bc4..e0bf1b8adc 100644 --- a/src/interface/interaction.c +++ b/src/interface/interaction.c @@ -236,44 +236,57 @@ void intf_InteractionManage( playlist_t *p_playlist ) if( new->psz_title ) free( new->psz_title ); \ if( new->psz_description ) free( new->psz_description ); -/** Helper function to send an error message +/** Helper function to send an error message, both in a blocking and non-blocking way * \param p_this Parent vlc_object - * \param i_id A predefined ID, 0 if not applicable + * \param b_blocking Is this dialog blocking or not? * \param psz_title Title for the dialog * \param psz_format The message to display * */ void __intf_UserFatal( vlc_object_t *p_this, + vlc_bool_t b_blocking, const char *psz_title, const char *psz_format, ... ) { va_list args; interaction_dialog_t *p_new = NULL; - int i_id = DIALOG_ERRORS; - - if( i_id > 0 ) - { - p_new = intf_InteractionGetById( p_this, i_id ); - } - if( !p_new ) - { - INTERACT_INIT( p_new ); - if( i_id > 0 ) p_new->i_id = i_id ; - } - else - { - p_new->i_status = UPDATED_DIALOG; - } - - p_new->i_flags |= DIALOG_REUSABLE; - - p_new->i_type = INTERACT_DIALOG_ONEWAY; + + INTERACT_INIT( p_new ); + p_new->psz_title = strdup( psz_title ); va_start( args, psz_format ); vasprintf( &p_new->psz_description, psz_format, args ); va_end( args ); - p_new->i_flags |= DIALOG_CLEAR_NOSHOW; + if( b_blocking ) + p_new->i_flags = DIALOG_BLOCKING_ERROR; + else + p_new->i_flags = DIALOG_NONBLOCKING_ERROR; + + intf_Interact( p_this, p_new ); +} + +/** Helper function to send an warning, which is always shown non-blocking + * \param p_this Parent vlc_object + * \param psz_title Title for the dialog + * \param psz_format The message to display + * */ +void __intf_UserWarn( vlc_object_t *p_this, + const char *psz_title, + const char *psz_format, ... ) +{ + va_list args; + interaction_dialog_t *p_new = NULL; + + INTERACT_INIT( p_new ); + + p_new->psz_title = strdup( psz_title ); + + va_start( args, psz_format ); + vasprintf( &p_new->psz_description, psz_format, args ); + va_end( args ); + + p_new->i_flags = DIALOG_WARNING; intf_Interact( p_this, p_new ); }