]> git.sesse.net Git - vlc/commitdiff
* implemented a non-blocking progress-bar in the main interface; needs testing (close...
authorFelix Paul Kühne <fkuehne@videolan.org>
Mon, 3 Jul 2006 10:38:09 +0000 (10:38 +0000)
committerFelix Paul Kühne <fkuehne@videolan.org>
Mon, 3 Jul 2006 10:38:09 +0000 (10:38 +0000)
extras/MacOSX/Resources/English.lproj/MainMenu.nib/classes.nib
extras/MacOSX/Resources/English.lproj/MainMenu.nib/info.nib
extras/MacOSX/Resources/English.lproj/MainMenu.nib/keyedobjects.nib
include/vlc_interaction.h
modules/gui/macosx/interaction.m
modules/gui/macosx/intf.h
modules/gui/macosx/intf.m
src/interface/interaction.c

index cd3dedb63f7854b565de1e6cfbe1b44c32b0f18c..866c8430ecc8a7425d63f94f073aa1834395c7f8 100644 (file)
                 "o_err_msg" = id; 
                 "o_error" = id; 
                 "o_info" = id; 
+                "o_main_pgbar" = id; 
                 "o_messages" = id; 
                 "o_mi_about" = id; 
                 "o_mi_add_intf" = id; 
index bdb24bbde460bfbea2498b81bcc57e400d394169..380fb947dc33d1f1a5d5424c7696512ea0b5630e 100644 (file)
@@ -18,7 +18,7 @@
                <string>777 479 187 249 0 0 1440 878 </string>
        </dict>
        <key>IBFramework Version</key>
-       <string>439.0</string>
+       <string>446.1</string>
        <key>IBLockedObjects</key>
        <array/>
        <key>IBOpenObjects</key>
@@ -26,6 +26,6 @@
                <integer>21</integer>
        </array>
        <key>IBSystem Version</key>
-       <string>8I127</string>
+       <string>8J135</string>
 </dict>
 </plist>
index 01ab78dd2b6855bb47211cc3f14670715df6611d..d9dea177e71be71796279c5405c269f33801b975 100644 (file)
Binary files a/extras/MacOSX/Resources/English.lproj/MainMenu.nib/keyedobjects.nib and b/extras/MacOSX/Resources/English.lproj/MainMenu.nib/keyedobjects.nib differ
index 1873d9afa543efca49d9dea49e634f62e88973c6..b0723ff17b62ab72b8ae0e10eb3bf0e5800e20a4 100644 (file)
@@ -84,6 +84,7 @@ struct interaction_dialog_t
 #define DIALOG_LOGIN_PW_OK_CANCEL   0x20
 #define DIALOG_USER_PROGRESS        0x40
 #define DIALOG_PSZ_INPUT_OK_CANCEL      0x80
+#define DIALOG_INTF_PROGRESS        0x100
 
 /**
  * Possible return codes
@@ -175,13 +176,17 @@ VLC_EXPORT( int, __intf_UserOkayCancel,( vlc_object_t*, const char*, const char*
 
 #define intf_UserProgress( a, b, c, d ) __intf_UserProgress( VLC_OBJECT(a),b,c, d )
 VLC_EXPORT( int, __intf_UserProgress,( vlc_object_t*, const char*, const char*, float) );
-
 #define intf_UserProgressUpdate( a, b, c, d ) __intf_UserProgressUpdate( VLC_OBJECT(a),b,c, d )
 VLC_EXPORT( void, __intf_UserProgressUpdate,( vlc_object_t*, int, const char*, float) );
 
 #define intf_UserStringInput( a, b, c, d ) __intf_UserStringInput( VLC_OBJECT(a),b,c,d )
 VLC_EXPORT( int, __intf_UserStringInput,(vlc_object_t*, const char*, const char*, char **) );
 
+#define intf_IntfProgress( a, b, c, d ) __intf_IntfProgress( VLC_OBJECT(a),b,c, d )
+VLC_EXPORT( int, __intf_IntfProgress,( vlc_object_t*, const char*, float) );
+#define intf_IntfProgressUpdate( a, b, c, d ) __intf_IntfProgressUpdate( VLC_OBJECT(a),b,c, d )
+VLC_EXPORT( void, __intf_IntfProgressUpdate,( vlc_object_t*, int, const char*, float) );
+
 #define intf_UserHide( a, b ) __intf_UserHide( VLC_OBJECT(a), b )
 VLC_EXPORT( void, __intf_UserHide,( vlc_object_t *, int ));
 
index d1d5c206f7def9487b81eb3b1eb0d609f78e1213..aac169c021733a1daec1e416bc6f297adaeb8738 100644 (file)
     {
         if( p_dialog->i_flags & DIALOG_OK_CANCEL )
         {
-            msg_Dbg( p_intf, "requested flag: DIALOG_OK_CANCEL" );
+            msg_Dbg( p_intf, "OK-Cancel-dialog requested" );
             NSBeginInformationalAlertSheet( o_title, _NS("OK") , _NS("Cancel"),
                 nil, o_window, self,
                 @selector(sheetDidEnd: returnCode: contextInfo:), NULL, nil, 
         }
         else if( p_dialog->i_flags & DIALOG_YES_NO_CANCEL )
         {
-            msg_Dbg( p_intf, "requested flag: DIALOG_YES_NO_CANCEL" );
+            msg_Dbg( p_intf, "yes-no-cancel-dialog requested" );
             NSBeginInformationalAlertSheet( o_title, _NS("Yes"), _NS("No"),
                 _NS("Cancel"), o_window, self,
                 @selector(sheetDidEnd: returnCode: contextInfo:), NULL, nil, 
         }
         else if( p_dialog->i_flags & DIALOG_LOGIN_PW_OK_CANCEL )
         {
-            msg_Dbg( p_intf, "requested flag: 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: @""];
         }
         else if( p_dialog->i_flags & DIALOG_USER_PROGRESS )
         {
-            msg_Dbg( p_intf, "requested flag: 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: 0];
+            [o_prog_bar setFloatValue: p_dialog->val.f_float];
             [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, "requested flag: DIALOG_PSZ_INPUT_OK_CANCEL" );
+            msg_Dbg( p_intf, "text input requested" );
             [o_input_title setStringValue: o_title];
             [o_input_description setStringValue: o_description];
             [o_input_fld setStringValue: @""];
                 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] getMainScrollField] 
+                setStringValue: o_description];
+            [[[VLCMain sharedInstance] getMainIntfPgbar] 
+                setFloatValue: p_dialog->val.f_float];
+            [[[VLCMain sharedInstance] getMainIntfPgbar] setHidden: NO];
+            [[[VLCMain sharedInstance] getControllerWindow] makeKeyWindow];
+        }
         else
             msg_Warn( p_intf, "requested dialog type unknown" );
     }
     {
         [o_prog_description setStringValue: \
             [NSString stringWithUTF8String: p_dialog->psz_description]];
-        [o_prog_bar setDoubleValue: \
-            (double)(p_dialog->val.f_float)];
+        [o_prog_bar setFloatValue: p_dialog->val.f_float];
 
         if( [o_prog_bar doubleValue] == 100.0 )
         {
             return;
         }
     }
+    if( p_dialog->i_flags & DIALOG_INTF_PROGRESS )
+    {
+        [[[VLCMain sharedInstance] getMainScrollField] setStringValue: \
+            [NSString stringWithUTF8String: p_dialog->psz_description]];
+        [[[VLCMain sharedInstance] getMainIntfPgbar] setFloatValue: \
+            p_dialog->val.f_float];
+
+        if( [[[VLCMain sharedInstance] getMainIntfPgbar] doubleValue] == 100.0 )
+        {
+            /* we are done, let's hide */
+            [self hideDialog];
+            return;
+        }
+    }
 }
 
 -(void)hideDialog
         [NSApp endSheet: o_input_win];
         [o_input_win close];
     }
+    if( p_dialog->i_flags & DIALOG_INTF_PROGRESS )
+    {
+        [[[VLCMain sharedInstance] getMainIntfPgbar] setIndeterminate: YES];
+        [[[VLCMain sharedInstance] getMainScrollField] setStringValue: @""];
+        [[[VLCMain sharedInstance] getMainIntfPgbar] setHidden: YES];
+    }
 }
 
 -(void)destroyDialog
index 21d3131f8abd8452a517f6e76a754293c0baf686..df19aeda934cac7c57b77f9ff7d70b98e957bc90 100644 (file)
@@ -119,6 +119,7 @@ struct intf_sys_t
     float f_slider_old;         /* old slider val */
     IBOutlet id o_volumeslider; /* volume slider  */
 
+    IBOutlet id o_main_pgbar;   /* main interface progress bar */
     IBOutlet id o_btn_prev;     /* btn previous   */
     IBOutlet id o_btn_rewind;   /* btn rewind     */
     IBOutlet id o_btn_play;     /* btn play       */
@@ -292,6 +293,9 @@ struct intf_sys_t
 - (id)getBookmarks;
 - (id)getEmbeddedList;
 - (id)getInteractionList;
+- (id)getMainIntfPgbar;
+- (id)getMainScrollField;
+- (id)getControllerWindow;
 - (void)terminate;
 - (NSString *)localizedString:(char *)psz;
 - (char *)delocalizeString:(NSString *)psz;
index 40de372a381ea895770d2ce98f7d3faa9b024275..269442e6764060f881ded709423bd3ca65959692 100644 (file)
@@ -913,6 +913,31 @@ static VLCMain *_o_sharedMainInstance = nil;
     return nil;
 }
 
+- (id)getMainIntfPgbar
+{
+    if( o_main_pgbar )
+        return o_main_pgbar;
+
+    msg_Err( p_intf, "main interface progress bar item wasn't found" );
+    return nil;
+}
+
+- (id)getMainScrollField
+{
+    if( o_scrollfield )
+        return o_scrollfield;
+    
+    msg_Err( p_intf, "main scroll field item wasn't found" );
+    return nil;
+}
+
+- (id)getControllerWindow
+{
+    if( o_window )
+        return o_window;
+    return nil;
+}
+
 - (void)manage
 {
     playlist_t * p_playlist;
index 111360a876042c602b376ae989117d4fd90e1bfe..071a54c08ab5a77d398a52c2c60319c570f4ca42 100644 (file)
@@ -457,6 +457,67 @@ int __intf_UserStringInput( vlc_object_t *p_this,
     return i_ret;
 }
 
+/** Helper function to create a progress-bar in the main interface with a
+ *  single-line description
+ *  \param p_this           Parent vlc_object
+ *  \param psz_status       Current status
+ *  \param f_position       Current position (0.0->100.0)
+ *  \return                 Dialog id, to give to IntfProgressUpdate
+ */
+int __intf_IntfProgress( vlc_object_t *p_this,
+                         const char *psz_status,
+                         float f_pos )
+{
+    int i_ret;
+    interaction_dialog_t *p_new = NULL;
+
+    INTERACT_INIT( p_new );
+
+    p_new->i_type = INTERACT_DIALOG_ONEWAY;
+    p_new->psz_description = strdup( psz_status );
+    p_new->val.f_float = f_pos;
+
+    p_new->i_flags = DIALOG_INTF_PROGRESS;
+
+    i_ret = intf_Interact( p_this, p_new );
+
+    return p_new->i_id;
+}
+
+/** Update the progress bar in the main interface
+ *  \param p_this           Parent vlc_object
+ *  \param i_id             Identifier of the dialog
+ *  \param psz_status       New status
+ *  \param f_position       New position (0.0->100.0)
+ *  \return                 nothing
+ */
+void __intf_IntfProgressUpdate( vlc_object_t *p_this, int i_id,
+                                const char *psz_status, float f_pos )
+{
+    interaction_t *p_interaction = intf_InteractionGet( p_this );
+    interaction_dialog_t *p_dialog;
+
+    if( !p_interaction ) return;
+
+    vlc_mutex_lock( &p_interaction->object_lock );
+    p_dialog  =  intf_InteractionGetById( p_this, i_id );
+
+    if( !p_dialog )
+    {
+        vlc_mutex_unlock( &p_interaction->object_lock ) ;
+        return;
+    }
+
+    if( p_dialog->psz_description )
+        free( p_dialog->psz_description );
+    p_dialog->psz_description = strdup( psz_status );
+
+    p_dialog->val.f_float = f_pos;
+
+    p_dialog->i_status = UPDATED_DIALOG;
+    vlc_mutex_unlock( &p_interaction->object_lock) ;
+}
+
 /** Hide an interaction dialog
  * \param p_this the parent vlc object
  * \param i_id the id of the item to hide