Changeset 0a9dbda92034654d20a12e3d616e93e3ac382849
- Timestamp:
- 31/07/06 00:00:44 (2 years ago)
- git-parent:
- Files:
-
- Makefile.am (modified) (1 diff)
- extras/MacOSX/Resources/English.lproj/InteractionErrorPanel.nib/classes.nib (added)
- extras/MacOSX/Resources/English.lproj/InteractionErrorPanel.nib/info.nib (added)
- extras/MacOSX/Resources/English.lproj/InteractionErrorPanel.nib/keyedobjects.nib (added)
- extras/MacOSX/vlc.pbproj/project.pbxproj (modified) (8 diffs)
- include/vlc_interaction.h (modified) (5 diffs)
- modules/gui/macosx/interaction.h (modified) (3 diffs)
- modules/gui/macosx/interaction.m (modified) (9 diffs)
- modules/gui/wxwidgets/dialogs/interaction.cpp (modified) (1 diff)
- modules/gui/wxwidgets/interface.cpp (modified) (1 diff)
- src/interface/interaction.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Makefile.am
r0e63174 r0a9dbda 83 83 extras/MacOSX/Resources/English.lproj/Interaction.nib/info.nib \ 84 84 extras/MacOSX/Resources/English.lproj/Interaction.nib/keyedobjects.nib \ 85 extras/MacOSX/Resources/English.lproj/InteractionErrorPanel.nib/classes.nib \ 86 extras/MacOSX/Resources/English.lproj/InteractionErrorPanel.nib/info.nib \ 87 extras/MacOSX/Resources/English.lproj/InteractionErrorPanel.nib/keyedobjects.nib \ 85 88 extras/MacOSX/Resources/English.lproj/InfoPlist.strings \ 86 89 extras/MacOSX/Resources/a52.icns \ extras/MacOSX/vlc.pbproj/project.pbxproj
r3c47829 r0a9dbda 73 73 C2F2A708095AE51700018C74 /* skip_forward_embedded_blue.png in Resources */ = {isa = PBXBuildFile; fileRef = C2F2A704095AE51600018C74 /* skip_forward_embedded_blue.png */; }; 74 74 C2F2A709095AE51700018C74 /* skip_previous_embedded_blue.png in Resources */ = {isa = PBXBuildFile; fileRef = C2F2A705095AE51600018C74 /* skip_previous_embedded_blue.png */; }; 75 CC1AC1BC0A7BDA41002478C3 /* InteractionErrorPanel.nib in Resources */ = {isa = PBXBuildFile; fileRef = CC1AC1BA0A7BDA41002478C3 /* InteractionErrorPanel.nib */; }; 75 76 CC1B4B4D09A8CF9E0078AD2E /* Interaction.nib in Resources */ = {isa = PBXBuildFile; fileRef = CC1B4B4B09A8CF9E0078AD2E /* Interaction.nib */; }; 76 77 CC26BF2C09A7A05000E94D62 /* Update.nib in Resources */ = {isa = PBXBuildFile; fileRef = CC26BF2A09A7A05000E94D62 /* Update.nib */; }; 78 CC3DC89C0A7CDB9600B53F32 /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CC3DC89B0A7CDB9600B53F32 /* ApplicationServices.framework */; }; 77 79 CCF3C64C0923B99D00401862 /* SFilters.nib in Resources */ = {isa = PBXBuildFile; fileRef = CCF3C64A0923B99D00401862 /* SFilters.nib */; }; 78 80 DC7F46ED08A183FC0027DB24 /* Extended.nib in Resources */ = {isa = PBXBuildFile; fileRef = DC7F46EB08A183FC0027DB24 /* Extended.nib */; }; … … 905 907 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 = "<group>"; }; 906 908 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 = "<group>"; }; 909 CC1AC1BB0A7BDA41002478C3 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = Resources/English.lproj/InteractionErrorPanel.nib; sourceTree = "<group>"; }; 907 910 CC1B4B4C09A8CF9E0078AD2E /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = Resources/English.lproj/Interaction.nib; sourceTree = "<group>"; }; 908 911 CC1B4C1409A8EC690078AD2E /* interaction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = interaction.h; path = ../../modules/gui/macosx/interaction.h; sourceTree = "<group>"; }; … … 911 914 CC26BF3109A7A08C00E94D62 /* update.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = update.h; path = ../../modules/gui/macosx/update.h; sourceTree = SOURCE_ROOT; }; 912 915 CC26BF3209A7A08C00E94D62 /* update.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = update.m; path = ../../modules/gui/macosx/update.m; sourceTree = SOURCE_ROOT; }; 916 CC3DC89B0A7CDB9600B53F32 /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = "<absolute>"; }; 913 917 CCF3C64B0923B99D00401862 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = Resources/English.lproj/SFilters.nib; sourceTree = "<group>"; }; 914 918 CCF3C6500923B9D100401862 /* sfilters.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = sfilters.h; path = ../../modules/gui/macosx/sfilters.h; sourceTree = SOURCE_ROOT; }; … … 944 948 files = ( 945 949 1058C7AFFEA557BF11CA2CBB /* Cocoa.framework in Frameworks */, 950 CC3DC89C0A7CDB9600B53F32 /* ApplicationServices.framework in Frameworks */, 946 951 ); 947 952 runOnlyForDeploymentPostprocessing = 0; … … 1040 1045 isa = PBXGroup; 1041 1046 children = ( 1047 CC3DC89B0A7CDB9600B53F32 /* ApplicationServices.framework */, 1042 1048 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */, 1043 1049 ); … … 1154 1160 CC26BF2A09A7A05000E94D62 /* Update.nib */, 1155 1161 CC1B4B4B09A8CF9E0078AD2E /* Interaction.nib */, 1162 CC1AC1BA0A7BDA41002478C3 /* InteractionErrorPanel.nib */, 1156 1163 ); 1157 1164 name = nibs; … … 1262 1269 CC26BF2C09A7A05000E94D62 /* Update.nib in Resources */, 1263 1270 CC1B4B4D09A8CF9E0078AD2E /* Interaction.nib in Resources */, 1271 CC1AC1BC0A7BDA41002478C3 /* InteractionErrorPanel.nib in Resources */, 1264 1272 ); 1265 1273 runOnlyForDeploymentPostprocessing = 0; … … 1278 1286 1279 1287 /* Begin PBXVariantGroup section */ 1288 CC1AC1BA0A7BDA41002478C3 /* InteractionErrorPanel.nib */ = { 1289 isa = PBXVariantGroup; 1290 children = ( 1291 CC1AC1BB0A7BDA41002478C3 /* English */, 1292 ); 1293 name = InteractionErrorPanel.nib; 1294 sourceTree = "<group>"; 1295 }; 1280 1296 CC1B4B4B09A8CF9E0078AD2E /* Interaction.nib */ = { 1281 1297 isa = PBXVariantGroup; include/vlc_interaction.h
r6cb1101 r0a9dbda 88 88 #define DIALOG_GOT_ANSWER 0x10 89 89 #define DIALOG_LOGIN_PW_OK_CANCEL 0x20 90 #define DIALOG_BLOCKING_ERROR 0x24 91 #define DIALOG_NONBLOCKING_ERROR 0x200 90 92 #define DIALOG_USER_PROGRESS 0x40 91 93 #define DIALOG_PSZ_INPUT_OK_CANCEL 0x80 92 94 #define DIALOG_INTF_PROGRESS 0x100 95 #define DIALOG_WARNING 0x400 93 96 94 97 /** … … 122 125 enum 123 126 { 124 INTERACT_PROGRESS, ///< Progress bar (in the main interface ?)125 127 INTERACT_DIALOG_ONEWAY, ///< Dialog box without feedback 126 128 INTERACT_DIALOG_TWOWAY, ///< Dialog box with feedback … … 133 135 { 134 136 DIALOG_FIRST, 135 DIALOG_ERRORS,136 137 137 138 DIALOG_LAST_PREDEFINED, … … 140 141 /** 141 142 * This structure contains the active interaction dialogs, and is 142 * used by t ehmanager143 * used by the manager 143 144 */ 144 145 struct interaction_t … … 171 172 VLC_EXPORT( int,__intf_Interact,( vlc_object_t *,interaction_dialog_t * ) ); 172 173 173 #define intf_UserFatal( a, c, d, e... ) __intf_UserFatal( VLC_OBJECT(a),c,d, ## e ) 174 VLC_EXPORT( void, __intf_UserFatal,( vlc_object_t*, const char*, const char*, ...) ); 174 #define intf_UserFatal( a, b, c, d, e... ) __intf_UserFatal( VLC_OBJECT(a),b,c,d, ## e ) 175 VLC_EXPORT( void, __intf_UserFatal,( vlc_object_t*, vlc_bool_t, const char*, const char*, ...) ); 176 #define intf_UserWarn( a, c, d, e... ) __intf_UserWarn( VLC_OBJECT(a),c,d, ## e ) 177 VLC_EXPORT( void, __intf_UserWarn,( vlc_object_t*, const char*, const char*, ...) ); 175 178 #define intf_UserLoginPassword( a, b, c, d, e... ) __intf_UserLoginPassword( VLC_OBJECT(a),b,c,d,e) 176 179 VLC_EXPORT( int, __intf_UserLoginPassword,( vlc_object_t*, const char*, const char*, char **, char **) ); modules/gui/macosx/interaction.h
r6cb1101 r0a9dbda 77 77 @end 78 78 79 @interface VLCErrorInteractionPanel : NSObject 80 { 81 IBOutlet id o_window; 82 IBOutlet id o_cleanup_button; 83 IBOutlet id o_error_table; 84 85 NSMutableArray * o_errors; 86 NSMutableArray * o_icons; 87 88 NSImage * warnIcon; 89 NSImage * errorIcon; 90 91 BOOL nib_interact_errpanel_loaded; 92 } 93 - (IBAction)cleanupTable:(id)sender; 94 95 -(void)showPanel; 96 -(void)addError: (NSString *)o_error withMsg:(NSString *)o_msg; 97 -(void)addWarning: (NSString *)o_warning withMsg:(NSString *)o_msg; 98 99 @end 100 79 101 /***************************************************************************** 80 102 * VLCInteractionList interface … … 83 105 { 84 106 NSMutableArray *o_interaction_list; 107 VLCErrorInteractionPanel *o_error_panel; 85 108 } 86 109 … … 89 112 -(void)removeInteraction: (VLCInteraction *)p_interaction; 90 113 114 -(id)getErrorPanel; 115 91 116 @end modules/gui/macosx/interaction.m
r6cb1101 r0a9dbda 26 26 #import "interaction.h" 27 27 28 /* for the icons in our custom error panel */ 29 #import <ApplicationServices/ApplicationServices.h> 30 28 31 /***************************************************************************** 29 32 * VLCInteractionList implementation … … 39 42 name: @"VLCNewInteractionEventNotification" 40 43 object:self]; 44 45 o_error_panel = [[VLCErrorInteractionPanel alloc] init]; 41 46 42 47 return self; … … 73 78 -(void)addInteraction: (interaction_dialog_t *)p_dialog 74 79 { 75 76 80 VLCInteraction *o_interaction = [[VLCInteraction alloc] initDialog: p_dialog]; 77 81 … … 86 90 } 87 91 92 -(id)getErrorPanel 93 { 94 return o_error_panel; 95 } 96 88 97 -(void)dealloc 89 98 { … … 93 102 [super dealloc]; 94 103 } 95 96 104 @end 97 105 … … 129 137 } 130 138 131 NSString *o_title = [NSString stringWithUTF8String:p_dialog->psz_title ? p_dialog->psz_title : "title"];139 NSString *o_title = [NSString stringWithUTF8String:p_dialog->psz_title ? p_dialog->psz_title : _("Error")]; 132 140 NSString *o_description = [NSString stringWithUTF8String:p_dialog->psz_description ? p_dialog->psz_description : ""]; 133 NSString *o_defaultButton = [NSString stringWithUTF8String:p_dialog->psz_defaultButton];134 NSString *o_alternateButton = [NSString stringWithUTF8String:p_dialog->psz_alternateButton];141 NSString *o_defaultButton = p_dialog->psz_defaultButton ? [NSString stringWithUTF8String:p_dialog->psz_defaultButton] : nil; 142 NSString *o_alternateButton = p_dialog->psz_alternateButton ? [NSString stringWithUTF8String:p_dialog->psz_alternateButton] : nil; 135 143 NSString *o_otherButton = p_dialog->psz_otherButton ? [NSString stringWithUTF8String:p_dialog->psz_otherButton] : nil; 136 144 … … 155 163 } 156 164 157 #if 0165 #if 0 158 166 msg_Dbg( p_intf, "Title: %s", [o_title UTF8String] ); 159 167 msg_Dbg( p_intf, "Description: %s", [o_description UTF8String] ); 160 #endif 161 162 if( p_dialog->i_id == DIALOG_ERRORS ) 168 msg_Dbg( p_intf, "Delivered flag: %i", p_dialog->i_flags ); 169 #endif 170 171 if( p_dialog->i_flags & DIALOG_BLOCKING_ERROR ) 163 172 { 164 173 msg_Dbg( p_intf, "error panel requested" ); 165 NSAlert * ourAlert = [NSAlert alertWithMessageText: 166 [NSString stringWithUTF8String:p_dialog->psz_title ? p_dialog->psz_title : _("Error")] 167 defaultButton: _NS("OK") alternateButton: nil otherButton: nil 168 informativeTextWithFormat: 169 [NSString stringWithUTF8String:p_dialog->psz_description]]; 170 [ourAlert setAlertStyle: NSWarningAlertStyle]; 171 [ourAlert runModal]; 174 NSBeginInformationalAlertSheet( o_title, _NS("OK"), nil, nil, 175 o_window, self, @selector(sheetDidEnd: returnCode: contextInfo:), 176 NULL, nil, o_description ); 177 } 178 else if( p_dialog->i_flags & DIALOG_NONBLOCKING_ERROR ) 179 { 180 msg_Dbg( p_intf, "addition to non-blocking error panel received" ); 181 [[[[VLCMain sharedInstance] getInteractionList] getErrorPanel] 182 addError: o_title withMsg: o_description]; 183 } 184 else if( p_dialog->i_flags & DIALOG_WARNING ) 185 { 186 msg_Dbg( p_intf, "addition to non-blocking warning panel received" ); 187 [[[[VLCMain sharedInstance] getInteractionList] getErrorPanel] 188 addWarning: o_title withMsg: o_description]; 189 } 190 else if( p_dialog->i_flags & DIALOG_YES_NO_CANCEL ) 191 { 192 msg_Dbg( p_intf, "yes-no-cancel-dialog requested" ); 193 NSBeginInformationalAlertSheet( o_title, o_defaultButton, 194 o_alternateButton, o_otherButton, o_window, self, 195 @selector(sheetDidEnd: returnCode: contextInfo:), NULL, nil, 196 o_description ); 197 } 198 else if( p_dialog->i_flags & DIALOG_LOGIN_PW_OK_CANCEL ) 199 { 200 msg_Dbg( p_intf, "dialog for login and pw requested" ); 201 [o_auth_title setStringValue: o_title]; 202 [o_auth_description setStringValue: o_description]; 203 [o_auth_login_fld setStringValue: @""]; 204 [o_auth_pw_fld setStringValue: @""]; 205 [NSApp beginSheet: o_auth_win modalForWindow: o_window 206 modalDelegate: self didEndSelector: nil contextInfo: nil]; 207 [o_auth_win makeKeyWindow]; 208 } 209 else if( p_dialog->i_flags & DIALOG_USER_PROGRESS ) 210 { 211 msg_Dbg( p_intf, "user progress dialog requested" ); 212 [o_prog_title setStringValue: o_title]; 213 [o_prog_description setStringValue: o_description]; 214 [o_prog_bar setDoubleValue: (double)p_dialog->val.f_float]; 215 if( p_dialog->i_timeToGo < 1 ) 216 [o_prog_timeToGo setStringValue: @""]; 217 else 218 [o_prog_timeToGo setStringValue: [NSString stringWithFormat: 219 _NS("Remaining time: %i seconds"), p_dialog->i_timeToGo]]; 220 [NSApp beginSheet: o_prog_win modalForWindow: o_window 221 modalDelegate: self didEndSelector: nil contextInfo: nil]; 222 [o_prog_win makeKeyWindow]; 223 } 224 else if( p_dialog->i_flags & DIALOG_PSZ_INPUT_OK_CANCEL ) 225 { 226 msg_Dbg( p_intf, "text input from user requested" ); 227 [o_input_title setStringValue: o_title]; 228 [o_input_description setStringValue: o_description]; 229 [o_input_fld setStringValue: @""]; 230 [NSApp beginSheet: o_input_win modalForWindow: o_window 231 modalDelegate: self didEndSelector: nil contextInfo: nil]; 232 [o_input_win makeKeyWindow]; 233 } 234 else if( p_dialog->i_flags & DIALOG_INTF_PROGRESS ) 235 { 236 msg_Dbg( p_intf, "progress-bar in main intf requested" ); 237 [[VLCMain sharedInstance] setScrollField: o_description stopAfter: -1]; 238 [o_mainIntfPgbar setDoubleValue: (double)p_dialog->val.f_float]; 239 [o_mainIntfPgbar setHidden: NO]; 240 [[[VLCMain sharedInstance] getControllerWindow] makeKeyWindow]; 241 [o_mainIntfPgbar setIndeterminate: NO]; 172 242 } 173 243 else 174 { 175 if( p_dialog->i_flags & DIALOG_YES_NO_CANCEL ) 176 { 177 msg_Dbg( p_intf, "yes-no-cancel-dialog requested" ); 178 NSBeginInformationalAlertSheet( o_title, o_defaultButton, 179 o_alternateButton, o_otherButton, o_window, self, 180 @selector(sheetDidEnd: returnCode: contextInfo:), NULL, nil, 181 o_description ); 182 } 183 else if( p_dialog->i_flags & DIALOG_LOGIN_PW_OK_CANCEL ) 184 { 185 msg_Dbg( p_intf, "dialog for login and pw requested" ); 186 [o_auth_title setStringValue: o_title]; 187 [o_auth_description setStringValue: o_description]; 188 [o_auth_login_fld setStringValue: @""]; 189 [o_auth_pw_fld setStringValue: @""]; 190 [NSApp beginSheet: o_auth_win modalForWindow: o_window 191 modalDelegate: self didEndSelector: nil contextInfo: nil]; 192 [o_auth_win makeKeyWindow]; 193 } 194 else if( p_dialog->i_flags & DIALOG_USER_PROGRESS ) 195 { 196 msg_Dbg( p_intf, "user progress dialog requested" ); 197 [o_prog_title setStringValue: o_title]; 198 [o_prog_description setStringValue: o_description]; 199 [o_prog_bar setDoubleValue: (double)p_dialog->val.f_float]; 200 if( p_dialog->i_timeToGo < 1 ) 201 [o_prog_timeToGo setStringValue: @""]; 202 else 203 [o_prog_timeToGo setStringValue: [NSString stringWithFormat: 204 _NS("Remaining time: %i seconds"), p_dialog->i_timeToGo]]; 205 [NSApp beginSheet: o_prog_win modalForWindow: o_window 206 modalDelegate: self didEndSelector: nil contextInfo: nil]; 207 [o_prog_win makeKeyWindow]; 208 } 209 else if( p_dialog->i_flags & DIALOG_PSZ_INPUT_OK_CANCEL ) 210 { 211 msg_Dbg( p_intf, "text input from user requested" ); 212 [o_input_title setStringValue: o_title]; 213 [o_input_description setStringValue: o_description]; 214 [o_input_fld setStringValue: @""]; 215 [NSApp beginSheet: o_input_win modalForWindow: o_window 216 modalDelegate: self didEndSelector: nil contextInfo: nil]; 217 [o_input_win makeKeyWindow]; 218 } 219 else if( p_dialog->i_flags & DIALOG_INTF_PROGRESS ) 220 { 221 msg_Dbg( p_intf, "progress-bar in main intf requested" ); 222 [[VLCMain sharedInstance] setScrollField: o_description stopAfter: -1]; 223 [o_mainIntfPgbar setDoubleValue: (double)p_dialog->val.f_float]; 224 [o_mainIntfPgbar setHidden: NO]; 225 [[[VLCMain sharedInstance] getControllerWindow] makeKeyWindow]; 226 [o_mainIntfPgbar setIndeterminate: NO]; 227 } 228 else 229 msg_Err( p_intf, "requested dialog type unknown (%i)", 230 p_dialog->i_flags ); 231 } 244 msg_Err( p_intf, "requested dialog type unknown (%i)", p_dialog->i_flags ); 232 245 } 233 246 … … 345 358 - (IBAction)okayAndClose:(id)sender 346 359 { 360 msg_Dbg( p_intf, "running okayAndClose" ); 347 361 vlc_mutex_lock( &p_dialog->p_interaction->object_lock ); 348 362 if( p_dialog->i_flags == DIALOG_LOGIN_PW_OK_CANCEL ) … … 360 374 361 375 @end 376 377 /***************************************************************************** 378 * VLCErrorInteractionPanel implementation 379 *****************************************************************************/ 380 @implementation VLCErrorInteractionPanel 381 -(id)init 382 { 383 [super init]; 384 nib_interact_errpanel_loaded = [NSBundle loadNibNamed:@"InteractionErrorPanel" owner:self]; 385 [o_window setTitle: _NS("Errors and Warnings")]; 386 [o_cleanup_button setTitle: _NS("Clean up")]; 387 o_errors = [[NSMutableArray alloc] init]; 388 o_icons = [[NSMutableArray alloc] init]; 389 390 /* ugly Carbon stuff following... 391 * regrettably, you can't get the icons through clean Cocoa */ 392 393 /* retrieve our error icon */ 394 IconRef ourIconRef; 395 int returnValue; 396 returnValue = GetIconRef(kOnSystemDisk, 'macs', 'stop', &ourIconRef); 397 errorIcon = [[NSImage alloc] initWithSize:NSMakeSize(32,32)]; 398 [errorIcon lockFocus]; 399 CGRect rect = CGRectMake(0,0,32,32); 400 PlotIconRefInContext((CGContextRef)[[NSGraphicsContext currentContext] 401 graphicsPort], 402 &rect, 403 kAlignNone, 404 kTransformNone, 405 NULL /*inLabelColor*/, 406 kPlotIconRefNormalFlags, 407 (IconRef)ourIconRef); 408 [errorIcon unlockFocus]; 409 returnValue = ReleaseIconRef(ourIconRef); 410 411 /* retrieve our caution icon */ 412 returnValue = GetIconRef(kOnSystemDisk, 'macs', 'caut', &ourIconRef); 413 warnIcon = [[NSImage alloc] initWithSize:NSMakeSize(32,32)]; 414 [warnIcon lockFocus]; 415 PlotIconRefInContext((CGContextRef)[[NSGraphicsContext currentContext] 416 graphicsPort], 417 &rect, 418 kAlignNone, 419 kTransformNone, 420 NULL /*inLabelColor*/, 421 kPlotIconRefNormalFlags, 422 (IconRef)ourIconRef); 423 [warnIcon unlockFocus]; 424 returnValue = ReleaseIconRef(ourIconRef); 425 426 return self; 427 } 428 429 -(void)dealloc 430 { 431 [errorIcon release]; 432 [warnIcon release]; 433 [o_errors release]; 434 [o_icons release]; 435 [super dealloc]; 436 } 437 438 -(void)showPanel 439 { 440 [o_window makeKeyAndOrderFront: self]; 441 } 442 443 -(void)addError: (NSString *)o_error withMsg:(NSString *)o_msg 444 { 445 /* format our string as desired */ 446 NSMutableAttributedString * ourError; 447 ourError = [[NSMutableAttributedString alloc] initWithString: 448 [NSString stringWithFormat:@"%@\n%@", o_error, o_msg] 449 attributes: 450 [NSDictionary dictionaryWithObject: [NSFont systemFontOfSize:11] forKey: NSFontAttributeName]]; 451 [ourError 452 addAttribute: NSFontAttributeName 453 value: [NSFont boldSystemFontOfSize:11] 454 range: NSMakeRange( 0, [o_error length])]; 455 [o_errors addObject: ourError]; 456 [ourError release]; 457 458 [o_icons addObject: errorIcon]; 459 460 [o_error_table reloadData]; 461 [self showPanel]; 462 } 463 464 -(void)addWarning: (NSString *)o_warning withMsg:(NSString *)o_msg 465 { 466 /* format our string as desired */ 467 NSMutableAttributedString * ourWarning; 468 ourWarning = [[NSMutableAttributedString alloc] initWithString: 469 [NSString stringWithFormat:@"%@\n%@", o_warning, o_msg] 470 attributes: 471 [NSDictionary dictionaryWithObject: [NSFont systemFontOfSize:11] forKey: NSFontAttributeName]]; 472 [ourWarning 473 addAttribute: NSFontAttributeName 474 value: [NSFont boldSystemFontOfSize:11] 475 range: NSMakeRange( 0, [o_warning length])]; 476 [o_errors addObject: ourWarning]; 477 [ourWarning release]; 478 479 [o_icons addObject: warnIcon]; 480 481 [o_error_table reloadData]; 482 483 [self showPanel]; 484 } 485 486 -(IBAction)cleanupTable:(id)sender 487 { 488 [o_errors removeAllObjects]; 489 [o_icons removeAllObjects]; 490 [o_error_table reloadData]; 491 } 492 493 /*---------------------------------------------------------------------------- 494 * data source methods 495 *---------------------------------------------------------------------------*/ 496 - (int)numberOfRowsInTableView:(NSTableView *)theDataTable 497 { 498 return [o_errors count]; 499 } 500 501 - (id)tableView:(NSTableView *)theDataTable objectValueForTableColumn: 502 (NSTableColumn *)theTableColumn row: (int)row 503 { 504 if( [[theTableColumn identifier] isEqualToString: @"error_msg"] ) 505 return [o_errors objectAtIndex: row]; 506 507 if( [[theTableColumn identifier] isEqualToString: @"icon"] ) 508 return [o_icons objectAtIndex: row]; 509 510 return @"unknown identifier"; 511 } 512 513 @end modules/gui/wxwidgets/dialogs/interaction.cpp
r9c964ad r0a9dbda 110 110 111 111 112 if( p_dialog->i_id == DIALOG_ ERRORS )112 if( p_dialog->i_id == DIALOG_NONBLOCKING_ERRORS ) 113 113 { 114 114 wxTextCtrl *errors ; // Special case modules/gui/wxwidgets/interface.cpp
raf23abe r0a9dbda 1240 1240 p_arg->p_intf = p_intf; 1241 1241 1242 if( p_dialog->i_type == INTERACT_PROGRESS ) 1243 { 1244 /// \todo Handle progress in the interface 1245 } 1246 else 1247 { 1248 p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_INTERACTION, 1242 p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_INTERACTION, 1249 1243 0, p_arg ); 1250 } 1244 1251 1245 } 1252 1246 src/interface/interaction.c
r9c964ad r0a9dbda 237 237 if( new->psz_description ) free( new->psz_description ); 238 238 239 /** Helper function to send an error message 239 /** Helper function to send an error message, both in a blocking and non-blocking way 240 240 * \param p_this Parent vlc_object 241 * \param i_id A predefined ID, 0 if not applicable241 * \param b_blocking Is this dialog blocking or not? 242 242 * \param psz_title Title for the dialog 243 243 * \param psz_format The message to display 244 244 * */ 245 245 void __intf_UserFatal( vlc_object_t *p_this, 246 vlc_bool_t b_blocking, 246 247 const char *psz_title, 247 248 const char *psz_format, ... ) … … 249 250 va_list args; 250 251 interaction_dialog_t *p_new = NULL; 251 int i_id = DIALOG_ERRORS; 252 253 if( i_id > 0 ) 254 { 255 p_new = intf_InteractionGetById( p_this, i_id ); 256 } 257 if( !p_new ) 258 { 259 INTERACT_INIT( p_new ); 260 if( i_id > 0 ) p_new->i_id = i_id ; 261 } 262 else 263 { 264 p_new->i_status = UPDATED_DIALOG; 265 } 266 267 p_new->i_flags |= DIALOG_REUSABLE; 268 269 p_new->i_type = INTERACT_DIALOG_ONEWAY; 252 253 INTERACT_INIT( p_new ); 254 270 255 p_new->psz_title = strdup( psz_title ); 271 256 … … 274 259 va_end( args ); 275 260 276 p_new->i_flags |= DIALOG_CLEAR_NOSHOW; 261 if( b_blocking ) 262 p_new->i_flags = DIALOG_BLOCKING_ERROR; 263 else 264 p_new->i_flags = DIALOG_NONBLOCKING_ERROR; 265 266 intf_Interact( p_this, p_new ); 267 } 268 269 /** Helper function to send an warning, which is always shown non-blocking 270 * \param p_this Parent vlc_object 271 * \param psz_title Title for the dialog 272 * \param psz_format The message to display 273 * */ 274 void __intf_UserWarn( vlc_object_t *p_this, 275 const char *psz_title, 276 const char *psz_format, ... ) 277 { 278 va_list args; 279 interaction_dialog_t *p_new = NULL; 280 281 INTERACT_INIT( p_new ); 282 283 p_new->psz_title = strdup( psz_title ); 284 285 va_start( args, psz_format ); 286 vasprintf( &p_new->psz_description, psz_format, args ); 287 va_end( args ); 288 289 p_new->i_flags = DIALOG_WARNING; 277 290 278 291 intf_Interact( p_this, p_new );
