]> git.sesse.net Git - vlc/commitdiff
Use dialog_Progress
authorRémi Denis-Courmont <remi@remlab.net>
Sun, 8 Mar 2009 20:24:42 +0000 (22:24 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 8 Mar 2009 20:55:09 +0000 (22:55 +0200)
modules/access/dvb/scan.c
modules/access/dvb/scan.h
modules/demux/avi/avi.c
src/misc/update.c

index b9842f7bf9e093301bb81dce122e29e564a54e7d..d256d031544d721075976f6157ba94fbabccac75 100644 (file)
@@ -30,7 +30,7 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_access.h>
-#include <vlc_interface.h>
+#include <vlc_dialog.h>
 
 #ifdef HAVE_UNISTD_H
 #   include <unistd.h>
@@ -136,7 +136,7 @@ int scan_Init( vlc_object_t *p_obj, scan_t *p_scan, const scan_parameter_t *p_pa
 void scan_Clean( scan_t *p_scan )
 {
     if( p_scan->p_dialog != NULL )
-        intf_UserHide( p_scan->p_dialog );
+        dialog_ProgressDestroy( p_scan->p_dialog );
 
     for( int i = 0; i < p_scan->i_service; i++ )
         scan_service_Delete( p_scan->pp_service[i] );
@@ -318,9 +318,10 @@ int scan_Next( scan_t *p_scan, scan_configuration_t *p_cfg )
             msg_Info( p_scan->p_obj, "Scan ETA %s | %f", secstotimestr( psz_eta, i_eta/1000000 ), f_position * 100 );
 
         if( p_scan->p_dialog == NULL )
-            p_scan->p_dialog = intf_UserProgress( p_scan->p_obj, _("Scanning DVB-T"), psz_text, 100.0 * f_position, -1 );
-        else
-            intf_ProgressUpdate( p_scan->p_dialog, psz_text, 100 * f_position, -1 );
+            p_scan->p_dialog = dialog_ProgressCreate( p_scan->p_obj, _("Scanning DVB-T"), psz_text, _("Cancel") );
+        if( p_scan->p_dialog != NULL )
+            /* FIXME: update text, not just percentage */
+            dialog_ProgressSet( p_scan->p_dialog, /*psz_text, */100 * f_position );
         free( psz_text );
     }
 
@@ -330,7 +331,7 @@ int scan_Next( scan_t *p_scan, scan_configuration_t *p_cfg )
 
 bool scan_IsCancelled( scan_t *p_scan )
 {
-    return p_scan->p_dialog && intf_ProgressIsCancelled( p_scan->p_dialog );
+    return p_scan->p_dialog && dialog_ProgressCancelled( p_scan->p_dialog );
 }
 
 static scan_service_t *ScanFindService( scan_t *p_scan, int i_service_start, int i_program )
index 8afc404ee0a62999113808854b3d7ffe8b3b6dd4..d8e8c2a10adfb60060004ef33aa3f4e603054a3f 100644 (file)
@@ -127,7 +127,7 @@ typedef struct
 typedef struct
 {
     vlc_object_t *p_obj;
-    interaction_dialog_t *p_dialog;
+    struct dialog_progress_bar_t *p_dialog;
     int64_t i_index;
     scan_parameter_t parameter;
     int64_t i_time_start;
index 9f38f02d199a8e82e2260c24dd54cd1a009d8c62..504dbe436ecc762365cf3d198628abe0697a94f1 100644 (file)
@@ -32,7 +32,6 @@
 #include <vlc_plugin.h>
 #include <vlc_demux.h>
 
-#include <vlc_interface.h>
 #include <vlc_dialog.h>
 
 #include <vlc_meta.h>
@@ -2373,7 +2372,7 @@ static void AVI_IndexCreate( demux_t *p_demux )
     off_t i_movi_end;
 
     mtime_t i_dialog_update;
-    interaction_dialog_t *p_dialog = NULL;
+    dialog_progress_bar_t *p_dialog = NULL;
 
     p_riff = AVI_ChunkFind( &p_sys->ck_root, AVIFOURCC_RIFF, 0);
     p_movi = AVI_ChunkFind( p_riff, AVIFOURCC_movi, 0);
@@ -2400,7 +2399,8 @@ static void AVI_IndexCreate( demux_t *p_demux )
     /* Only show dialog if AVI is > 10MB */
     i_dialog_update = mdate();
     if( stream_Size( p_demux->s ) > 10000000 )
-        p_dialog = intf_IntfProgress( p_demux, _("Fixing AVI Index..."), 0.0 );
+        p_dialog = dialog_ProgressCreate( p_demux, NULL,
+                                       _("Fixing AVI Index..."), _("Cancel") );
 
     for( ;; )
     {
@@ -2412,13 +2412,12 @@ static void AVI_IndexCreate( demux_t *p_demux )
         /* Don't update/check dialog too often */
         if( p_dialog && mdate() - i_dialog_update > 100000 )
         {
-            if( intf_ProgressIsCancelled( p_dialog ) )
+            if( dialog_ProgressCancelled( p_dialog ) )
                 break;
 
             double f_pos = 100.0 * stream_Tell( p_demux->s ) /
                            stream_Size( p_demux->s );
-            intf_ProgressUpdate( p_dialog,
-                                 _( "Fixing AVI Index..." ), f_pos, -1 );
+            dialog_ProgressSet( p_dialog, f_pos );
 
             i_dialog_update = mdate();
         }
@@ -2482,7 +2481,7 @@ static void AVI_IndexCreate( demux_t *p_demux )
 
 print_stat:
     if( p_dialog != NULL )
-        intf_UserHide( p_dialog );
+        dialog_ProgressDestroy( p_dialog );
 
     for( i_stream = 0; i_stream < p_sys->i_track; i_stream++ )
     {
index 846a857ac6201e475cf599128ea6f065e77fd905..248eb2bc4a342a98b9f8b779b02be5e75ba03dc3 100644 (file)
@@ -50,7 +50,6 @@
 #include <vlc_stream.h>
 #include <vlc_strings.h>
 #include <vlc_charset.h>
-#include <vlc_interface.h>
 #include <vlc_dialog.h>
 
 #include <gcrypt.h>
@@ -1512,7 +1511,7 @@ void update_Download( update_t *p_update, const char *destination )
 static void* update_DownloadReal( vlc_object_t *p_this )
 {
     update_download_thread_t *p_udt = (update_download_thread_t *)p_this;
-    interaction_dialog_t *p_progress = 0;
+    dialog_progress_bar_t *p_progress = NULL;
     long int l_size;
     long int l_downloaded = 0;
     float f_progress;
@@ -1590,14 +1589,14 @@ static void* update_DownloadReal( vlc_object_t *p_this )
     if( asprintf( &psz_status, _("%s\nDownloading... %s/%s %.1f%% done"),
         p_update->release.psz_url, "0.0", psz_size, 0.0 ) != -1 )
     {
-        p_progress = intf_UserProgress( p_udt, _( "Downloading ..."),
-                                        psz_status, 0.0, 0 );
+        p_progress = dialog_ProgressCreate( p_udt, _( "Downloading ..."),
+                                            psz_status, _("Cancel") );
         free( psz_status );
     }
 
     while( vlc_object_alive( p_udt ) &&
            ( i_read = stream_Read( p_stream, p_buffer, 1 << 10 ) ) &&
-           !intf_ProgressIsCancelled( p_progress ) )
+           !dialog_ProgressCancelled( p_progress ) )
     {
         if( fwrite( p_buffer, i_read, 1, p_file ) < 1 )
         {
@@ -1613,7 +1612,7 @@ static void* update_DownloadReal( vlc_object_t *p_this )
                       p_update->release.psz_url, psz_downloaded, psz_size,
                       f_progress ) != -1 )
         {
-            intf_ProgressUpdate( p_progress, psz_status, f_progress, 0 );
+            dialog_ProgressSet( p_progress, /*FIXME psz_status,*/ f_progress );
             free( psz_status );
         }
         free( psz_downloaded );
@@ -1624,12 +1623,12 @@ static void* update_DownloadReal( vlc_object_t *p_this )
     p_file = NULL;
 
     if( vlc_object_alive( p_udt ) &&
-        !intf_ProgressIsCancelled( p_progress ) )
+        !dialog_ProgressCancelled( p_progress ) )
     {
         if( asprintf( &psz_status, _("%s\nDone %s (100.0%%)"),
             p_update->release.psz_url, psz_size ) != -1 )
         {
-            intf_ProgressUpdate( p_progress, psz_status, 100.0, 0 );
+            dialog_ProgressDestroy( p_progress );
             p_progress = NULL;
             free( psz_status );
         }
@@ -1720,9 +1719,7 @@ static void* update_DownloadReal( vlc_object_t *p_this )
 
 end:
     if( p_progress )
-    {
-        intf_ProgressUpdate( p_progress, _("Cancelled"), 100.0, 0 );
-    }
+        dialog_ProgressDestroy( p_progress );
     if( p_stream )
         stream_Delete( p_stream );
     if( p_file )