Changeset 6cb1101a9144409fe27ffd7984c58f33b66eb78c
- Timestamp:
- 07/29/06 17:07:42 (2 years ago)
- git-parent:
- Files:
-
- extras/MacOSX/Resources/English.lproj/Interaction.nib/classes.nib (modified) (2 diffs)
- extras/MacOSX/Resources/English.lproj/Interaction.nib/info.nib (modified) (1 diff)
- extras/MacOSX/Resources/English.lproj/Interaction.nib/keyedobjects.nib (modified) (previous)
- include/vlc_interaction.h (modified) (6 diffs)
- modules/demux/avi/avi.c (modified) (1 diff)
- modules/gui/macosx/interaction.h (modified) (3 diffs)
- modules/gui/macosx/interaction.m (modified) (7 diffs)
- modules/services_discovery/shout.c (modified) (2 diffs)
- src/interface/interaction.c (modified) (8 diffs)
- src/misc/update.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
extras/MacOSX/Resources/English.lproj/Interaction.nib/classes.nib
r5d04943 r6cb1101 3 3 {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 4 4 { 5 ACTIONS = {cancelAndClose = id; okayAndClose = id; };5 ACTIONS = {cancelAndClose = id; cancelDialog = id; okayAndClose = id; }; 6 6 CLASS = VLCInteraction; 7 7 LANGUAGE = ObjC; … … 25 25 "o_prog_cancel_btn" = id; 26 26 "o_prog_description" = id; 27 "o_prog_timeToGo" = id; 27 28 "o_prog_title" = id; 28 29 "o_prog_win" = id; extras/MacOSX/Resources/English.lproj/Interaction.nib/info.nib
r2adf9ed r6cb1101 9 9 <key>IBOpenObjects</key> 10 10 <array> 11 <integer>5</integer>12 11 <integer>55</integer> 13 12 <integer>79</integer> 13 <integer>5</integer> 14 14 </array> 15 15 <key>IBSystem Version</key> include/vlc_interaction.h
r1dcfa0f r6cb1101 25 25 /** 26 26 * This structure describes an interaction widget 27 * WIDGETS ARE OUTDATED! THIS IS ONLY A STUB TO KEEP WX COMPILING! 27 28 */ 28 29 struct user_widget_t … … 36 37 /** 37 38 * Possible widget types 39 * WIDGETS ARE OUTDATED! THIS IS ONLY A STUB TO KEEP WX COMPILING! 38 40 */ 39 41 enum … … 53 55 char *psz_title; ///< Title 54 56 char *psz_description; ///< Descriptor string 57 char *psz_defaultButton; ///< default button title (~OK) 58 char *psz_alternateButton;///< alternate button title (~NO) 59 char *psz_otherButton; ///< other button title (optional,~Cancel) 55 60 56 61 char *psz_returned[1]; ///< returned responses from the user 57 62 58 63 vlc_value_t val; ///< a value coming from core for dialogue 64 int i_timeToGo; ///< time (in sec) until shown progress is finished 65 vlc_bool_t b_cancelled; ///< was the dialogue cancelled by the user? 59 66 60 67 int i_widgets; ///< Number of dialog widgets … … 77 84 */ 78 85 #define DIALOG_REUSABLE 0x01 79 #define DIALOG_OK_CANCEL 0x0280 #define DIALOG_YES_NO 0x0481 86 #define DIALOG_YES_NO_CANCEL 0x04 82 87 #define DIALOG_CLEAR_NOSHOW 0x08 … … 170 175 #define intf_UserLoginPassword( a, b, c, d, e... ) __intf_UserLoginPassword( VLC_OBJECT(a),b,c,d,e) 171 176 VLC_EXPORT( int, __intf_UserLoginPassword,( vlc_object_t*, const char*, const char*, char **, char **) ); 172 #define intf_UserYesNo( a, b, c ) __intf_UserYesNo( VLC_OBJECT(a),b,c ) 173 VLC_EXPORT( int, __intf_UserYesNo,( vlc_object_t*, const char*, const char*) ); 174 #define intf_UserOkayCancel( a, b, c ) __intf_UserOkayCancel( VLC_OBJECT(a),b,c ) 175 VLC_EXPORT( int, __intf_UserOkayCancel,( vlc_object_t*, const char*, const char*) ); 177 #define intf_UserYesNo( a, b, c, d, e, f ) __intf_UserYesNo( VLC_OBJECT(a),b,c, d, e, f ) 178 VLC_EXPORT( int, __intf_UserYesNo,( vlc_object_t*, const char*, const char*, const char*, const char*, const char*) ); 176 179 177 #define intf_UserProgress( a, b, c, d ) __intf_UserProgress( VLC_OBJECT(a),b,c, d ) 178 VLC_EXPORT( int, __intf_UserProgress,( vlc_object_t*, const char*, const char*, float) ); 179 #define intf_UserProgressUpdate( a, b, c, d ) __intf_UserProgressUpdate( VLC_OBJECT(a),b,c, d ) 180 VLC_EXPORT( void, __intf_UserProgressUpdate,( vlc_object_t*, int, const char*, float) ); 180 #define intf_UserProgress( a, b, c, d, e ) __intf_UserProgress( VLC_OBJECT(a),b,c,d,e ) 181 VLC_EXPORT( int, __intf_UserProgress,( vlc_object_t*, const char*, const char*, float, int) ); 182 #define intf_UserProgressUpdate( a, b, c, d, e ) __intf_UserProgressUpdate( VLC_OBJECT(a),b,c,d,e ) 183 VLC_EXPORT( void, __intf_UserProgressUpdate,( vlc_object_t*, int, const char*, float, int) ); 184 #define intf_UserProgressIsCancelled( a, b ) __intf_UserProgressIsCancelled( VLC_OBJECT(a),b ) 185 VLC_EXPORT( vlc_bool_t, __intf_UserProgressIsCancelled,( vlc_object_t*, int ) ); 181 186 182 187 #define intf_UserStringInput( a, b, c, d ) __intf_UserStringInput( VLC_OBJECT(a),b,c,d ) … … 185 190 #define intf_IntfProgress( a, b, c ) __intf_IntfProgress( VLC_OBJECT(a),b,c ) 186 191 VLC_EXPORT( int, __intf_IntfProgress,( vlc_object_t*, const char*, float) ); 187 #define intf_IntfProgressUpdate( a, b, c, d ) __intf_IntfProgressUpdate( VLC_OBJECT(a),b,c, d )192 #define intf_IntfProgressUpdate( a, b, c, d ) __intf_IntfProgressUpdate( VLC_OBJECT(a),b,c,d ) 188 193 VLC_EXPORT( void, __intf_IntfProgressUpdate,( vlc_object_t*, int, const char*, float) ); 189 194 modules/demux/avi/avi.c
r19f724f r6cb1101 559 559 _( "This AVI file is broken. Seeking will not " 560 560 "work correctly.\nDo you want to " 561 "try to repair it (this might take a long time) ?" ) ); 561 "try to repair it (this might take a long time) ?" ), 562 _( "Repair" ), _( "Don't repair" ), NULL ); 562 563 if( i_create == DIALOG_OK_YES ) 563 564 { modules/gui/macosx/interaction.h
r2adf9ed r6cb1101 32 32 @interface VLCInteraction : NSObject 33 33 { 34 /* progress widget*/34 /* progress dialogue */ 35 35 IBOutlet id o_prog_bar; 36 36 IBOutlet id o_prog_cancel_btn; … … 38 38 IBOutlet id o_prog_title; 39 39 IBOutlet id o_prog_win; 40 IBOutlet id o_prog_timeToGo; 40 41 41 42 /* authentication dialogue */ … … 66 67 - (IBAction)cancelAndClose:(id)sender; 67 68 - (IBAction)okayAndClose:(id)sender; 69 - (IBAction)cancelDialog:(id)sender; 68 70 69 71 -(id)initDialog: (interaction_dialog_t *)_p_dialog; modules/gui/macosx/interaction.m
r6d1c28b r6cb1101 131 131 NSString *o_title = [NSString stringWithUTF8String:p_dialog->psz_title ? p_dialog->psz_title : "title"]; 132 132 NSString *o_description = [NSString stringWithUTF8String:p_dialog->psz_description ? p_dialog->psz_description : ""]; 133 133 NSString *o_defaultButton = [NSString stringWithUTF8String:p_dialog->psz_defaultButton]; 134 NSString *o_alternateButton = [NSString stringWithUTF8String:p_dialog->psz_alternateButton]; 135 NSString *o_otherButton = p_dialog->psz_otherButton ? [NSString stringWithUTF8String:p_dialog->psz_otherButton] : nil; 136 134 137 vout_thread_t *p_vout = vlc_object_find( VLCIntf, VLC_OBJECT_VOUT, FIND_ANYWHERE ); 135 138 if( p_vout != NULL ) … … 170 173 else 171 174 { 172 if( p_dialog->i_flags & DIALOG_OK_CANCEL ) 173 { 174 msg_Dbg( p_intf, "OK-Cancel-dialog requested" ); 175 NSBeginInformationalAlertSheet( o_title, _NS("OK") , _NS("Cancel"), 176 nil, o_window, self, 177 @selector(sheetDidEnd: returnCode: contextInfo:), NULL, nil, 178 o_description ); 179 } 180 else if( p_dialog->i_flags & DIALOG_YES_NO_CANCEL ) 175 if( p_dialog->i_flags & DIALOG_YES_NO_CANCEL ) 181 176 { 182 177 msg_Dbg( p_intf, "yes-no-cancel-dialog requested" ); 183 NSBeginInformationalAlertSheet( o_title, _NS("Yes"), _NS("No"),184 _NS("Cancel"), o_window, self,178 NSBeginInformationalAlertSheet( o_title, o_defaultButton, 179 o_alternateButton, o_otherButton, o_window, self, 185 180 @selector(sheetDidEnd: returnCode: contextInfo:), NULL, nil, 186 181 o_description ); … … 203 198 [o_prog_description setStringValue: o_description]; 204 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 205 [NSApp beginSheet: o_prog_win modalForWindow: o_window 206 206 modalDelegate: self didEndSelector: nil contextInfo: nil]; … … 240 240 p_dialog->i_return = DIALOG_OK_YES; 241 241 } 242 else if( i_return == NSAlertAlternateReturn && ( p_dialog->i_flags & DIALOG_OK_CANCEL ) )243 {244 p_dialog->i_return = DIALOG_CANCELLED;245 }246 242 else if( i_return == NSAlertAlternateReturn ) 247 243 { … … 269 265 [self hideDialog]; 270 266 } 267 268 if( p_dialog->i_timeToGo < 1 ) 269 [o_prog_timeToGo setStringValue: @""]; 270 else 271 [o_prog_timeToGo setStringValue: [NSString stringWithFormat: 272 _NS("Remaining time: %i seconds"), p_dialog->i_timeToGo]]; 273 271 274 return; 272 275 } … … 322 325 - (IBAction)cancelAndClose:(id)sender 323 326 { 324 /* tell the core that the dialog was cancelled */327 /* tell the core that the dialog was cancelled in a yes/no-style dialogue */ 325 328 vlc_mutex_lock( &p_dialog->p_interaction->object_lock ); 326 329 p_dialog->i_return = DIALOG_CANCELLED; … … 328 331 vlc_mutex_unlock( &p_dialog->p_interaction->object_lock ); 329 332 msg_Dbg( p_intf, "dialog cancelled" ); 333 } 334 335 - (IBAction)cancelDialog:(id)sender 336 { 337 /* tell core that the user wishes to cancel the dialogue 338 * Use this function if cancelling is optionally like in the progress-dialogue */ 339 vlc_mutex_lock( &p_dialog->p_interaction->object_lock ); 340 p_dialog->b_cancelled = VLC_TRUE; 341 vlc_mutex_unlock( &p_dialog->p_interaction->object_lock ); 342 msg_Dbg( p_intf, "cancelling dialog, will close it later on" ); 330 343 } 331 344 modules/services_discovery/shout.c
ra7e16ca r6cb1101 197 197 int i_dialog_id; 198 198 199 i_dialog_id = intf_UserProgress( p_sd, "Shoutcast" , "Connecting...", 0.0 );199 i_dialog_id = intf_UserProgress( p_sd, "Shoutcast" , "Connecting...", 0.0, 0 ); 200 200 201 201 p_sys->b_dialog = VLC_TRUE; … … 216 216 260 /* gruiiik FIXME */; 217 217 intf_UserProgressUpdate( p_sd, i_dialog_id, "Downloading", 218 f_pos );218 f_pos, 0 ); 219 219 } 220 220 vlc_object_release( p_input ); src/interface/interaction.c
rfa1bf19 r6cb1101 144 144 // Give default answer 145 145 p_dialog->i_return = DIALOG_DEFAULT; 146 if( p_dialog->i_flags & DIALOG_OK_CANCEL )147 p_dialog->i_return = DIALOG_CANCELLED;148 146 149 147 // Pretend we have hidden and destroyed it … … 276 274 } 277 275 278 /** Helper function to ask a yes-no question276 /** Helper function to ask a yes-no-cancel question 279 277 * \param p_this Parent vlc_object 280 278 * \param psz_title Title for the dialog 281 279 * \param psz_description A description 280 * \param psz_default caption for the default button 281 * \param psz_alternate caption for the alternate button 282 * \param psz_other caption for the optional 3rd button (== cancel) 282 283 * \return Clicked button code 283 284 */ 284 285 int __intf_UserYesNo( vlc_object_t *p_this, 285 286 const char *psz_title, 286 const char *psz_description ) 287 const char *psz_description, 288 const char *psz_default, 289 const char *psz_alternate, 290 const char *psz_other ) 287 291 { 288 292 int i_ret; … … 295 299 p_new->psz_description = strdup( psz_description ); 296 300 p_new->i_flags = DIALOG_YES_NO_CANCEL; 297 298 i_ret = intf_Interact( p_this, p_new ); 299 300 return i_ret; 301 } 302 303 /** Helper function to trigger a okay-cancel dialogue 304 * \param p_this Parent vlc_object 305 * \param psz_title Title for the dialog 306 * \param psz_description A description 307 * \return Clicked button code 308 */ 309 int __intf_UserOkayCancel( vlc_object_t *p_this, 310 const char *psz_title, 311 const char *psz_description ) 312 { 313 int i_ret; 314 interaction_dialog_t *p_new = NULL; 315 316 INTERACT_INIT( p_new ); 317 318 p_new->i_type = INTERACT_DIALOG_TWOWAY; 319 p_new->psz_title = strdup( psz_title ); 320 p_new->psz_description = strdup( psz_description ); 321 p_new->i_flags = DIALOG_OK_CANCEL; 301 p_new->psz_defaultButton = strdup( psz_default ); 302 p_new->psz_alternateButton = strdup( psz_alternate ); 303 if( psz_other ) 304 p_new->psz_otherButton = strdup( psz_other ); 305 else 306 p_new->psz_otherButton = NULL; 322 307 323 308 i_ret = intf_Interact( p_this, p_new ); … … 331 316 * \param psz_status Current status 332 317 * \param f_position Current position (0.0->100.0) 318 * \param i_timeToGo Time (in sec) to go until process is finished 333 319 * \return Dialog id, to give to UserProgressUpdate 334 320 */ … … 336 322 const char *psz_title, 337 323 const char *psz_status, 338 float f_pos ) 324 float f_pos, 325 int i_time ) 339 326 { 340 327 int i_ret; … … 347 334 p_new->psz_description = strdup( psz_status ); 348 335 p_new->val.f_float = f_pos; 336 p_new->i_timeToGo = i_time; 349 337 350 338 p_new->i_flags = DIALOG_USER_PROGRESS; … … 360 348 * \param psz_status New status 361 349 * \param f_position New position (0.0->100.0) 350 * \param i_timeToGo Time (in sec) to go until process is finished 362 351 * \return nothing 363 352 */ 364 353 void __intf_UserProgressUpdate( vlc_object_t *p_this, int i_id, 365 const char *psz_status, float f_pos ) 354 const char *psz_status, float f_pos, 355 int i_time ) 366 356 { 367 357 interaction_t *p_interaction = intf_InteractionGet( p_this ); … … 384 374 385 375 p_dialog->val.f_float = f_pos; 376 p_dialog->i_timeToGo = i_time; 386 377 387 378 p_dialog->i_status = UPDATED_DIALOG; 388 379 vlc_mutex_unlock( &p_interaction->object_lock) ; 380 } 381 382 /** Helper function to communicate dialogue cancellations between the intf-module and caller 383 * \param p_this Parent vlc_object 384 * \param i_id Identifier of the dialogue 385 * \return Either true or false 386 */ 387 vlc_bool_t __intf_UserProgressIsCancelled( vlc_object_t *p_this, int i_id ) 388 { 389 interaction_t *p_interaction = intf_InteractionGet( p_this ); 390 interaction_dialog_t *p_dialog; 391 392 if( !p_interaction ) return VLC_TRUE; 393 394 vlc_mutex_lock( &p_interaction->object_lock ); 395 p_dialog = intf_InteractionGetById( p_this, i_id ); 396 397 if( !p_dialog ) 398 { 399 vlc_mutex_unlock( &p_interaction->object_lock ) ; 400 return VLC_TRUE; 401 } 402 403 vlc_mutex_unlock( &p_interaction->object_lock) ; 404 return p_dialog->b_cancelled; 389 405 } 390 406 src/misc/update.c
r1c35288 r6cb1101 1265 1265 p_this->psz_status, 0.0 ); 1266 1266 i_progress = intf_UserProgress( p_vlc, "Downloading...", 1267 psz_status, 0.0 );1267 psz_status, 0.0, 0 ); 1268 1268 1269 1269 p_stream = stream_UrlNew( p_vlc, psz_src ); … … 1310 1310 1311 1311 intf_UserProgressUpdate( p_vlc, i_progress, 1312 psz_status, f_progress );1312 psz_status, f_progress, 0 ); 1313 1313 } 1314 1314 … … 1322 1322 p_this->psz_status, psz_s2 ); 1323 1323 free( psz_s2 ); 1324 intf_UserProgressUpdate( p_vlc, i_progress, psz_status, 100.0 );1324 intf_UserProgressUpdate( p_vlc, i_progress, psz_status, 100.0, 0 ); 1325 1325 free( psz_status ); 1326 1326 }
