Commit aa3da61d authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Use dialog_Progress

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