Commit 0a9dbda9 authored by Felix Paul Kühne's avatar Felix Paul Kühne

* 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.
parent 87c7bdf0
......@@ -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 \
......
{
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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<string>69 66 356 240 0 0 1440 878 </string>
<key>IBFramework Version</key>
<string>446.1</string>
<key>IBOpenObjects</key>
<array>
<integer>5</integer>
</array>
<key>IBSystem Version</key>
<string>8J135</string>
</dict>
</plist>
......@@ -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 = "<group>"; };
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>"; };
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>"; };
CC1AC1BB0A7BDA41002478C3 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = Resources/English.lproj/InteractionErrorPanel.nib; sourceTree = "<group>"; };
CC1B4B4C09A8CF9E0078AD2E /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = Resources/English.lproj/Interaction.nib; sourceTree = "<group>"; };
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>"; };
CC26BF2B09A7A05000E94D62 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = Resources/English.lproj/Update.nib; sourceTree = "<group>"; };
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 = "<absolute>"; };
CCF3C64B0923B99D00401862 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = Resources/English.lproj/SFilters.nib; sourceTree = "<group>"; };
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 = "<group>";
......@@ -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 = "<group>";
};
CC1B4B4B09A8CF9E0078AD2E /* Interaction.nib */ = {
isa = PBXVariantGroup;
children = (
......
......@@ -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 )
......
......@@ -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
This diff is collapsed.
......@@ -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,
......
......@@ -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,
......
......@@ -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;
INTERACT_INIT( p_new );
p_new->psz_title = strdup( psz_title );
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 ;
}
va_start( args, psz_format );
vasprintf( &p_new->psz_description, psz_format, args );
va_end( args );
if( b_blocking )
p_new->i_flags = DIALOG_BLOCKING_ERROR;
else
{
p_new->i_status = UPDATED_DIALOG;
}
p_new->i_flags = DIALOG_NONBLOCKING_ERROR;
p_new->i_flags |= DIALOG_REUSABLE;
intf_Interact( p_this, p_new );
}
p_new->i_type = INTERACT_DIALOG_ONEWAY;
/** 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_CLEAR_NOSHOW;
p_new->i_flags = DIALOG_WARNING;
intf_Interact( p_this, p_new );
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment