Changeset 0a9dbda92034654d20a12e3d616e93e3ac382849

Show
Ignore:
Timestamp:
31/07/06 00:00:44 (2 years ago)
Author:
Felix Paul Kühne <fkuehne@videolan.org>
git-committer:
Felix Paul Kühne <fkuehne@videolan.org> 1154296844 +0000
git-parent:

[87c7bdf06f337b06cd2c19a45d3abd2115ef646f]

git-author:
Felix Paul Kühne <fkuehne@videolan.org> 1154296844 +0000
Message:

* 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.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Makefile.am

    r0e63174 r0a9dbda  
    8383    extras/MacOSX/Resources/English.lproj/Interaction.nib/info.nib \ 
    8484    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 \ 
    8588    extras/MacOSX/Resources/English.lproj/InfoPlist.strings \ 
    8689    extras/MacOSX/Resources/a52.icns \ 
  • extras/MacOSX/vlc.pbproj/project.pbxproj

    r3c47829 r0a9dbda  
    7373        C2F2A708095AE51700018C74 /* skip_forward_embedded_blue.png in Resources */ = {isa = PBXBuildFile; fileRef = C2F2A704095AE51600018C74 /* skip_forward_embedded_blue.png */; }; 
    7474        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 */; }; 
    7576        CC1B4B4D09A8CF9E0078AD2E /* Interaction.nib in Resources */ = {isa = PBXBuildFile; fileRef = CC1B4B4B09A8CF9E0078AD2E /* Interaction.nib */; }; 
    7677        CC26BF2C09A7A05000E94D62 /* Update.nib in Resources */ = {isa = PBXBuildFile; fileRef = CC26BF2A09A7A05000E94D62 /* Update.nib */; }; 
     78        CC3DC89C0A7CDB9600B53F32 /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CC3DC89B0A7CDB9600B53F32 /* ApplicationServices.framework */; }; 
    7779        CCF3C64C0923B99D00401862 /* SFilters.nib in Resources */ = {isa = PBXBuildFile; fileRef = CCF3C64A0923B99D00401862 /* SFilters.nib */; }; 
    7880        DC7F46ED08A183FC0027DB24 /* Extended.nib in Resources */ = {isa = PBXBuildFile; fileRef = DC7F46EB08A183FC0027DB24 /* Extended.nib */; }; 
     
    905907        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>"; }; 
    906908        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>"; }; 
    907910        CC1B4B4C09A8CF9E0078AD2E /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = Resources/English.lproj/Interaction.nib; sourceTree = "<group>"; }; 
    908911        CC1B4C1409A8EC690078AD2E /* interaction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = interaction.h; path = ../../modules/gui/macosx/interaction.h; sourceTree = "<group>"; }; 
     
    911914        CC26BF3109A7A08C00E94D62 /* update.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = update.h; path = ../../modules/gui/macosx/update.h; sourceTree = SOURCE_ROOT; }; 
    912915        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>"; }; 
    913917        CCF3C64B0923B99D00401862 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = Resources/English.lproj/SFilters.nib; sourceTree = "<group>"; }; 
    914918        CCF3C6500923B9D100401862 /* sfilters.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = sfilters.h; path = ../../modules/gui/macosx/sfilters.h; sourceTree = SOURCE_ROOT; }; 
     
    944948            files = ( 
    945949                1058C7AFFEA557BF11CA2CBB /* Cocoa.framework in Frameworks */, 
     950                CC3DC89C0A7CDB9600B53F32 /* ApplicationServices.framework in Frameworks */, 
    946951            ); 
    947952            runOnlyForDeploymentPostprocessing = 0; 
     
    10401045            isa = PBXGroup; 
    10411046            children = ( 
     1047                CC3DC89B0A7CDB9600B53F32 /* ApplicationServices.framework */, 
    10421048                1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */, 
    10431049            ); 
     
    11541160                CC26BF2A09A7A05000E94D62 /* Update.nib */, 
    11551161                CC1B4B4B09A8CF9E0078AD2E /* Interaction.nib */, 
     1162                CC1AC1BA0A7BDA41002478C3 /* InteractionErrorPanel.nib */, 
    11561163            ); 
    11571164            name = nibs; 
     
    12621269                CC26BF2C09A7A05000E94D62 /* Update.nib in Resources */, 
    12631270                CC1B4B4D09A8CF9E0078AD2E /* Interaction.nib in Resources */, 
     1271                CC1AC1BC0A7BDA41002478C3 /* InteractionErrorPanel.nib in Resources */, 
    12641272            ); 
    12651273            runOnlyForDeploymentPostprocessing = 0; 
     
    12781286 
    12791287/* Begin PBXVariantGroup section */ 
     1288        CC1AC1BA0A7BDA41002478C3 /* InteractionErrorPanel.nib */ = { 
     1289            isa = PBXVariantGroup; 
     1290            children = ( 
     1291                CC1AC1BB0A7BDA41002478C3 /* English */, 
     1292            ); 
     1293            name = InteractionErrorPanel.nib; 
     1294            sourceTree = "<group>"; 
     1295        }; 
    12801296        CC1B4B4B09A8CF9E0078AD2E /* Interaction.nib */ = { 
    12811297            isa = PBXVariantGroup; 
  • include/vlc_interaction.h

    r6cb1101 r0a9dbda  
    8888#define DIALOG_GOT_ANSWER           0x10 
    8989#define DIALOG_LOGIN_PW_OK_CANCEL   0x20 
     90#define DIALOG_BLOCKING_ERROR       0x24 
     91#define DIALOG_NONBLOCKING_ERROR    0x200 
    9092#define DIALOG_USER_PROGRESS        0x40 
    9193#define DIALOG_PSZ_INPUT_OK_CANCEL      0x80 
    9294#define DIALOG_INTF_PROGRESS        0x100 
     95#define DIALOG_WARNING              0x400 
    9396 
    9497/** 
     
    122125enum 
    123126{ 
    124     INTERACT_PROGRESS,          ///< Progress bar (in the main interface ?) 
    125127    INTERACT_DIALOG_ONEWAY,     ///< Dialog box without feedback 
    126128    INTERACT_DIALOG_TWOWAY,     ///< Dialog box with feedback 
     
    133135{ 
    134136    DIALOG_FIRST, 
    135     DIALOG_ERRORS, 
    136137 
    137138    DIALOG_LAST_PREDEFINED, 
     
    140141/** 
    141142 * This structure contains the active interaction dialogs, and is 
    142  * used by teh manager 
     143 * used by the manager 
    143144 */ 
    144145struct interaction_t 
     
    171172VLC_EXPORT( int,__intf_Interact,( vlc_object_t *,interaction_dialog_t * ) ); 
    172173 
    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 ) 
     175VLC_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 ) 
     177VLC_EXPORT( void, __intf_UserWarn,( vlc_object_t*, const char*, const char*, ...) ); 
    175178#define intf_UserLoginPassword( a, b, c, d, e... ) __intf_UserLoginPassword( VLC_OBJECT(a),b,c,d,e) 
    176179VLC_EXPORT( int, __intf_UserLoginPassword,( vlc_object_t*, const char*, const char*, char **, char **) ); 
  • modules/gui/macosx/interaction.h

    r6cb1101 r0a9dbda  
    7777@end 
    7878 
     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 
    79101/***************************************************************************** 
    80102 * VLCInteractionList interface 
     
    83105{ 
    84106    NSMutableArray *o_interaction_list; 
     107    VLCErrorInteractionPanel *o_error_panel; 
    85108} 
    86109 
     
    89112-(void)removeInteraction: (VLCInteraction *)p_interaction; 
    90113 
     114-(id)getErrorPanel; 
     115 
    91116@end 
  • modules/gui/macosx/interaction.m

    r6cb1101 r0a9dbda  
    2626#import "interaction.h" 
    2727 
     28/* for the icons in our custom error panel */ 
     29#import <ApplicationServices/ApplicationServices.h>  
     30 
    2831/***************************************************************************** 
    2932 * VLCInteractionList implementation 
     
    3942        name: @"VLCNewInteractionEventNotification" 
    4043        object:self]; 
     44 
     45    o_error_panel = [[VLCErrorInteractionPanel alloc] init]; 
    4146 
    4247    return self; 
     
    7378-(void)addInteraction: (interaction_dialog_t *)p_dialog 
    7479{ 
    75  
    7680    VLCInteraction *o_interaction = [[VLCInteraction alloc] initDialog: p_dialog]; 
    7781     
     
    8690} 
    8791 
     92-(id)getErrorPanel 
     93{ 
     94    return o_error_panel; 
     95} 
     96 
    8897-(void)dealloc 
    8998{ 
     
    93102    [super dealloc]; 
    94103} 
    95  
    96104@end 
    97105 
     
    129137    } 
    130138 
    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")]; 
    132140    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
    135143    NSString *o_otherButton = p_dialog->psz_otherButton ? [NSString stringWithUTF8String:p_dialog->psz_otherButton] : nil; 
    136144 
     
    155163    } 
    156164 
    157     #if 0 
     165#if 0 
    158166    msg_Dbg( p_intf, "Title: %s", [o_title UTF8String] ); 
    159167    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 ) 
    163172    { 
    164173        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]; 
    172242    } 
    173243    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 ); 
    232245} 
    233246 
     
    345358- (IBAction)okayAndClose:(id)sender 
    346359{ 
     360    msg_Dbg( p_intf, "running okayAndClose" ); 
    347361    vlc_mutex_lock( &p_dialog->p_interaction->object_lock ); 
    348362    if( p_dialog->i_flags == DIALOG_LOGIN_PW_OK_CANCEL ) 
     
    360374 
    361375@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  
    110110 
    111111 
    112     if( p_dialog->i_id == DIALOG_ERRORS ) 
     112    if( p_dialog->i_id == DIALOG_NONBLOCKING_ERRORS ) 
    113113    { 
    114114        wxTextCtrl *errors ; // Special case 
  • modules/gui/wxwidgets/interface.cpp

    raf23abe r0a9dbda  
    12401240    p_arg->p_intf = p_intf; 
    12411241 
    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, 
    12491243                                       0, p_arg ); 
    1250     } 
     1244 
    12511245} 
    12521246 
  • src/interface/interaction.c

    r9c964ad r0a9dbda  
    237237        if( new->psz_description ) free( new->psz_description ); 
    238238 
    239 /** Helper function to send an error message 
     239/** Helper function to send an error message, both in a blocking and non-blocking way 
    240240 *  \param p_this     Parent vlc_object 
    241  *  \param i_id       A predefined ID, 0 if not applicable 
     241 *  \param b_blocking Is this dialog blocking or not? 
    242242 *  \param psz_title  Title for the dialog 
    243243 *  \param psz_format The message to display 
    244244 *  */ 
    245245void __intf_UserFatal( vlc_object_t *p_this, 
     246                       vlc_bool_t b_blocking, 
    246247                       const char *psz_title, 
    247248                       const char *psz_format, ... ) 
     
    249250    va_list args; 
    250251    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     
    270255    p_new->psz_title = strdup( psz_title ); 
    271256 
     
    274259    va_end( args ); 
    275260 
    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 *  */ 
     274void __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; 
    277290 
    278291    intf_Interact( p_this, p_new );