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

dialog_ProgressSet: add an optional string parameter

parent e58d7094
...@@ -103,7 +103,7 @@ typedef struct dialog_progress_bar_t ...@@ -103,7 +103,7 @@ typedef struct dialog_progress_bar_t
const char *cancel; const char *cancel;
/* Permanent parameters */ /* Permanent parameters */
vlc_mutex_t lock; vlc_mutex_t lock;
void (*pf_update) (void *, float); void (*pf_update) (void *, const char *, float);
bool (*pf_check) (void *); bool (*pf_check) (void *);
void (*pf_destroy) (void *); void (*pf_destroy) (void *);
void *p_sys; void *p_sys;
...@@ -113,7 +113,7 @@ VLC_EXPORT( dialog_progress_bar_t *, dialog_ProgressCreate, (vlc_object_t *, con ...@@ -113,7 +113,7 @@ VLC_EXPORT( dialog_progress_bar_t *, dialog_ProgressCreate, (vlc_object_t *, con
#define dialog_ProgressCreate(o, t, m, c) \ #define dialog_ProgressCreate(o, t, m, c) \
dialog_ProgressCreate(VLC_OBJECT(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_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( bool, dialog_ProgressCancelled, (dialog_progress_bar_t *) );
VLC_EXPORT( int, dialog_Register, (vlc_object_t *) ); VLC_EXPORT( int, dialog_Register, (vlc_object_t *) );
......
...@@ -320,8 +320,7 @@ int scan_Next( scan_t *p_scan, scan_configuration_t *p_cfg ) ...@@ -320,8 +320,7 @@ int scan_Next( scan_t *p_scan, scan_configuration_t *p_cfg )
if( p_scan->p_dialog == NULL ) if( p_scan->p_dialog == NULL )
p_scan->p_dialog = dialog_ProgressCreate( p_scan->p_obj, _("Scanning DVB-T"), psz_text, _("Cancel") ); p_scan->p_dialog = dialog_ProgressCreate( p_scan->p_obj, _("Scanning DVB-T"), psz_text, _("Cancel") );
if( p_scan->p_dialog != NULL ) 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 ); free( psz_text );
} }
......
...@@ -2417,7 +2417,7 @@ static void AVI_IndexCreate( demux_t *p_demux ) ...@@ -2417,7 +2417,7 @@ static void AVI_IndexCreate( demux_t *p_demux )
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 );
dialog_ProgressSet( p_dialog, f_pos ); dialog_ProgressSet( p_dialog, NULL, f_pos );
i_dialog_update = mdate(); i_dialog_update = mdate();
} }
......
...@@ -191,6 +191,8 @@ QVLCProgressDialog::QVLCProgressDialog (DialogHandler *parent, ...@@ -191,6 +191,8 @@ QVLCProgressDialog::QVLCProgressDialog (DialogHandler *parent,
setMinimumDuration (0); setMinimumDuration (0);
connect (this, SIGNAL(progressed(int)), SLOT(setValue(int))); 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))); connect (this, SIGNAL(canceled(void)), SLOT(saveCancel(void)));
data->pf_update = update; data->pf_update = update;
...@@ -203,9 +205,12 @@ QVLCProgressDialog::~QVLCProgressDialog (void) ...@@ -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<QVLCProgressDialog *>(priv); QVLCProgressDialog *self = static_cast<QVLCProgressDialog *>(priv);
if (text != NULL)
emit self->described (qfu(text));
emit self->progressed ((int)(value * 1000.)); emit self->progressed ((int)(value * 1000.));
} }
......
...@@ -86,7 +86,7 @@ private: ...@@ -86,7 +86,7 @@ private:
DialogHandler *handler; DialogHandler *handler;
bool cancelled; bool cancelled;
static void update (void *, float); static void update (void *, const char *, float);
static bool check (void *); static bool check (void *);
static void destroy (void *); static void destroy (void *);
private slots: private slots:
...@@ -94,6 +94,7 @@ private slots: ...@@ -94,6 +94,7 @@ private slots:
signals: signals:
void progressed (int); void progressed (int);
void described (const QString&);
void destroyed (void); void destroyed (void);
}; };
......
...@@ -243,11 +243,12 @@ void dialog_ProgressDestroy (dialog_progress_bar_t *dialog) ...@@ -243,11 +243,12 @@ void dialog_ProgressDestroy (dialog_progress_bar_t *dialog)
free (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); 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) bool dialog_ProgressCancelled (dialog_progress_bar_t *dialog)
......
...@@ -1612,7 +1612,7 @@ static void* update_DownloadReal( vlc_object_t *p_this ) ...@@ -1612,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 )
{ {
dialog_ProgressSet( p_progress, /*FIXME psz_status,*/ f_progress ); dialog_ProgressSet( p_progress, psz_status, f_progress );
free( psz_status ); free( psz_status );
} }
free( psz_downloaded ); free( psz_downloaded );
......
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