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
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 *) );
......
......@@ -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 );
}
......
......@@ -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();
}
......
......@@ -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<QVLCProgressDialog *>(priv);
if (text != NULL)
emit self->described (qfu(text));
emit self->progressed ((int)(value * 1000.));
}
......
......@@ -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);
};
......
......@@ -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)
......
......@@ -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 );
......
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