[vlc-devel] commit: Use dialog_Progress ( Rémi Denis-Courmont )

git version control git at videolan.org
Sun Mar 8 21:55:13 CET 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Mar  8 22:24:42 2009 +0200| [aa3da61d2cd926939d579c5b2eee0a2d107fdb64] | committer: Rémi Denis-Courmont 

Use dialog_Progress

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=aa3da61d2cd926939d579c5b2eee0a2d107fdb64
---

 modules/access/dvb/scan.c |   13 +++++++------
 modules/access/dvb/scan.h |    2 +-
 modules/demux/avi/avi.c   |   13 ++++++-------
 src/misc/update.c         |   19 ++++++++-----------
 4 files changed, 22 insertions(+), 25 deletions(-)

diff --git a/modules/access/dvb/scan.c b/modules/access/dvb/scan.c
index b9842f7..d256d03 100644
--- a/modules/access/dvb/scan.c
+++ b/modules/access/dvb/scan.c
@@ -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 )
diff --git a/modules/access/dvb/scan.h b/modules/access/dvb/scan.h
index 8afc404..d8e8c2a 100644
--- a/modules/access/dvb/scan.h
+++ b/modules/access/dvb/scan.h
@@ -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;
diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index 9f38f02..504dbe4 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -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++ )
     {
diff --git a/src/misc/update.c b/src/misc/update.c
index 846a857..248eb2b 100644
--- a/src/misc/update.c
+++ b/src/misc/update.c
@@ -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 )




More information about the vlc-devel mailing list