From 0715fa586d27382189b45e73820502ce861eaf72 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Mon, 9 Mar 2009 21:15:23 +0200 Subject: [PATCH] dialog_ProgressSet: add an optional string parameter --- include/vlc_dialog.h | 4 ++-- modules/access/dvb/scan.c | 3 +-- modules/demux/avi/avi.c | 2 +- modules/gui/qt4/dialogs/external.cpp | 7 ++++++- modules/gui/qt4/dialogs/external.hpp | 3 ++- src/interface/dialog.c | 5 +++-- src/misc/update.c | 2 +- 7 files changed, 16 insertions(+), 10 deletions(-) diff --git a/include/vlc_dialog.h b/include/vlc_dialog.h index 6914ef552f..0270cb8baa 100644 --- a/include/vlc_dialog.h +++ b/include/vlc_dialog.h @@ -103,7 +103,7 @@ typedef struct dialog_progress_bar_t const char *cancel; /* Permanent parameters */ vlc_mutex_t lock; - void (*pf_update) (void *, float); + void (*pf_update) (void *, const char *, float); bool (*pf_check) (void *); void (*pf_destroy) (void *); void *p_sys; @@ -113,7 +113,7 @@ VLC_EXPORT( dialog_progress_bar_t *, dialog_ProgressCreate, (vlc_object_t *, con #define dialog_ProgressCreate(o, t, m, c) \ dialog_ProgressCreate(VLC_OBJECT(o), t, m, c) VLC_EXPORT( void, dialog_ProgressDestroy, (dialog_progress_bar_t *) ); -VLC_EXPORT( void, dialog_ProgressSet, (dialog_progress_bar_t *, float) ); +VLC_EXPORT( void, dialog_ProgressSet, (dialog_progress_bar_t *, const char *, float) ); VLC_EXPORT( bool, dialog_ProgressCancelled, (dialog_progress_bar_t *) ); VLC_EXPORT( int, dialog_Register, (vlc_object_t *) ); diff --git a/modules/access/dvb/scan.c b/modules/access/dvb/scan.c index d256d03154..ef230564ff 100644 --- a/modules/access/dvb/scan.c +++ b/modules/access/dvb/scan.c @@ -320,8 +320,7 @@ int scan_Next( scan_t *p_scan, scan_configuration_t *p_cfg ) if( p_scan->p_dialog == NULL ) 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 ); + dialog_ProgressSet( p_scan->p_dialog, psz_text, 100 * f_position ); free( psz_text ); } diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c index 504dbe436e..1eabbf7eef 100644 --- a/modules/demux/avi/avi.c +++ b/modules/demux/avi/avi.c @@ -2417,7 +2417,7 @@ static void AVI_IndexCreate( demux_t *p_demux ) double f_pos = 100.0 * stream_Tell( p_demux->s ) / stream_Size( p_demux->s ); - dialog_ProgressSet( p_dialog, f_pos ); + dialog_ProgressSet( p_dialog, NULL, f_pos ); i_dialog_update = mdate(); } diff --git a/modules/gui/qt4/dialogs/external.cpp b/modules/gui/qt4/dialogs/external.cpp index dba8cfd3e9..e0096feb4c 100644 --- a/modules/gui/qt4/dialogs/external.cpp +++ b/modules/gui/qt4/dialogs/external.cpp @@ -191,6 +191,8 @@ QVLCProgressDialog::QVLCProgressDialog (DialogHandler *parent, setMinimumDuration (0); connect (this, SIGNAL(progressed(int)), SLOT(setValue(int))); + connect (this, SIGNAL(described(const QString&)), + SLOT(setLabelText(const QString&))); connect (this, SIGNAL(canceled(void)), SLOT(saveCancel(void))); data->pf_update = update; @@ -203,9 +205,12 @@ QVLCProgressDialog::~QVLCProgressDialog (void) { } -void QVLCProgressDialog::update (void *priv, float value) +void QVLCProgressDialog::update (void *priv, const char *text, float value) { QVLCProgressDialog *self = static_cast(priv); + + if (text != NULL) + emit self->described (qfu(text)); emit self->progressed ((int)(value * 1000.)); } diff --git a/modules/gui/qt4/dialogs/external.hpp b/modules/gui/qt4/dialogs/external.hpp index f50c54ecb0..513ead7f7f 100644 --- a/modules/gui/qt4/dialogs/external.hpp +++ b/modules/gui/qt4/dialogs/external.hpp @@ -86,7 +86,7 @@ private: DialogHandler *handler; bool cancelled; - static void update (void *, float); + static void update (void *, const char *, float); static bool check (void *); static void destroy (void *); private slots: @@ -94,6 +94,7 @@ private slots: signals: void progressed (int); + void described (const QString&); void destroyed (void); }; diff --git a/src/interface/dialog.c b/src/interface/dialog.c index 6aa87c7f90..22ac7859e7 100644 --- a/src/interface/dialog.c +++ b/src/interface/dialog.c @@ -243,11 +243,12 @@ void dialog_ProgressDestroy (dialog_progress_bar_t *dialog) free (dialog); } -void dialog_ProgressSet (dialog_progress_bar_t *dialog, float value) +void dialog_ProgressSet (dialog_progress_bar_t *dialog, const char *text, + float value) { assert (dialog); - dialog->pf_update (dialog->p_sys, value); + dialog->pf_update (dialog->p_sys, text, value); } bool dialog_ProgressCancelled (dialog_progress_bar_t *dialog) diff --git a/src/misc/update.c b/src/misc/update.c index 248eb2bc4a..56038ef849 100644 --- a/src/misc/update.c +++ b/src/misc/update.c @@ -1612,7 +1612,7 @@ static void* update_DownloadReal( vlc_object_t *p_this ) p_update->release.psz_url, psz_downloaded, psz_size, f_progress ) != -1 ) { - dialog_ProgressSet( p_progress, /*FIXME psz_status,*/ f_progress ); + dialog_ProgressSet( p_progress, psz_status, f_progress ); free( psz_status ); } free( psz_downloaded ); -- 2.39.2