Commit 183d5cda authored by Thomas Guillem's avatar Thomas Guillem

dialog: use new API

parent 9d230b93
......@@ -282,9 +282,9 @@ static int Open(vlc_object_t *p_this)
arrayByAddingObjectsFromArray:[AVCaptureDevice devicesWithMediaType:AVMediaTypeMuxed]] retain];
if ( [myVideoDevices count] == 0 )
{
dialog_Fatal(p_demux, _("No video devices found"),
_("Your Mac does not seem to be equipped with a suitable video input device. "
"Please check your connectors and drivers."));
vlc_dialog_display_error(p_demux, _("No video devices found"),
_("Your Mac does not seem to be equipped with a suitable video input device. "
"Please check your connectors and drivers."));
msg_Err(p_demux, "Can't find any suitable video device");
goto error;
}
......@@ -311,9 +311,9 @@ static int Open(vlc_object_t *p_this)
}
if ( !p_sys->device )
{
dialog_Fatal(p_demux, _("No video devices found"),
_("Your Mac does not seem to be equipped with a suitable input device. "
"Please check your connectors and drivers."));
vlc_dialog_display_error(p_demux, _("No video devices found"),
_("Your Mac does not seem to be equipped with a suitable input device. "
"Please check your connectors and drivers."));
msg_Err(p_demux, "Can't find any suitable video device");
goto error;
}
......
......@@ -784,9 +784,9 @@ static int blurayOpen(vlc_object_t *object)
msg_Err(p_demux, "BD-J menus not supported. Playing without menus. "
"BD-J support: %d, JVM found: %d, JVM usable: %d",
disc_info->bdj_supported, disc_info->libjvm_detected, disc_info->bdj_handled);
dialog_Fatal(p_demux, _("Java required"),
_("This Blu-ray disc needs Java for menus.%s\nDisc is played without menus."),
!disc_info->libjvm_detected ? _(" Java was not found from your system.") : "");
vlc_dialog_display_error(p_demux, _("Java required"),
_("This Blu-ray disc needs Java for menus.%s\nDisc is played without menus."),
!disc_info->libjvm_detected ? _(" Java was not found from your system.") : "");
p_sys->b_menu = false;
}
......@@ -841,7 +841,7 @@ static int blurayOpen(vlc_object_t *object)
error:
if (error_msg)
dialog_Fatal(p_demux, _("Blu-ray error"), "%s", error_msg);
vlc_dialog_display_error(p_demux, _("Blu-ray error"), "%s", error_msg);
blurayClose(object);
if (p_demux->s != NULL) {
......@@ -2204,11 +2204,13 @@ static void blurayHandleEvent(demux_t *p_demux, const BD_EVENT *e)
*/
case BD_EVENT_ERROR:
/* fatal error (with menus) */
dialog_Fatal(p_demux, _("Blu-ray error"), "Playback with BluRay menus failed");
vlc_dialog_display_error(p_demux, _("Blu-ray error"),
"Playback with BluRay menus failed");
p_sys->b_fatal_error = true;
break;
case BD_EVENT_ENCRYPTED:
dialog_Fatal(p_demux, _("Blu-ray error"), "This disc seems to be encrypted");
vlc_dialog_display_error(p_demux, _("Blu-ray error"),
"This disc seems to be encrypted");
p_sys->b_fatal_error = true;
break;
case BD_EVENT_READ_ERROR:
......
......@@ -42,7 +42,7 @@
#include <vlc_access.h>
#include <vlc_demux.h>
#include <vlc_dialog.h> /* dialog_Fatal */
#include <vlc_dialog.h> /* vlc_dialog_display_error */
#include <vlc_charset.h> /* FromWide */
#include <initguid.h>
......@@ -520,7 +520,7 @@ static int CommonOpen( vlc_object_t *p_this, access_sys_t *p_sys,
if( !b_use_video && !b_use_audio )
{
dialog_Fatal( p_this, _("Capture failed"),
vlc_dialog_display_error( p_this, _("Capture failed"),
_("No video or audio device selected.") );
return VLC_EGENERIC ;
}
......@@ -594,7 +594,7 @@ static int CommonOpen( vlc_object_t *p_this, access_sys_t *p_sys,
( b_use_video && !b_use_audio && b_err_video ) )
{
msg_Err( p_this, "FATAL: could not open ANY device" ) ;
dialog_Fatal( p_this, _("Capture failed"),
vlc_dialog_display_error( p_this, _("Capture failed"),
_("VLC cannot open ANY capture device. "
"Check the error log for details.") );
return VLC_EGENERIC ;
......@@ -1018,7 +1018,7 @@ static int OpenDevice( vlc_object_t *p_this, access_sys_t *p_sys,
{
msg_Err( p_this, "can't use device: %s, unsupported device type",
devicename.c_str() );
dialog_Fatal( p_this, _("Capture failed"),
vlc_dialog_display_error( p_this, _("Capture failed"),
_("The device you selected cannot be used, because its "
"type is not supported.") );
return VLC_EGENERIC;
......@@ -1071,7 +1071,7 @@ static int OpenDevice( vlc_object_t *p_this, access_sys_t *p_sys,
else {
/* capture device */
msg_Err( p_this, "capture device '%s' does not support required parameters !", devicename.c_str() );
dialog_Fatal( p_this, _("Capture failed"),
vlc_dialog_display_error( p_this, _("Capture failed"),
_("The capture device \"%s\" does not support the "
"required parameters."), devicename.c_str() );
p_device_filter->Release();
......
......@@ -473,10 +473,10 @@ static int Open (vlc_object_t *obj)
if (delsys == NULL || Tune (obj, dev, delsys, freq))
{
msg_Err (obj, "tuning to %"PRIu64" Hz failed", freq);
dialog_Fatal (obj, N_("Digital broadcasting"),
N_("The selected digital tuner does not support "
"the specified parameters.\n"
"Please check the preferences."));
vlc_dialog_display_error (obj, N_("Digital broadcasting"),
N_("The selected digital tuner does not support "
"the specified parameters.\n"
"Please check the preferences."));
goto error;
}
}
......
......@@ -87,7 +87,7 @@ typedef struct
struct scan_t
{
vlc_object_t *p_obj;
struct dialog_progress_bar_t *p_dialog;
vlc_dialog_id *p_dialog_id;
uint64_t i_index;
scan_parameter_t parameter;
int64_t i_time_start;
......@@ -212,7 +212,7 @@ scan_t *scan_New( vlc_object_t *p_obj, const scan_parameter_t *p_parameter )
p_scan->p_obj = VLC_OBJECT(p_obj);
p_scan->i_index = 0;
p_scan->p_dialog = NULL;
p_scan->p_dialog_id = NULL;
TAB_INIT( p_scan->i_service, p_scan->pp_service );
p_scan->parameter = *p_parameter;
p_scan->i_time_start = mdate();
......@@ -222,8 +222,8 @@ scan_t *scan_New( vlc_object_t *p_obj, const scan_parameter_t *p_parameter )
void scan_Destroy( scan_t *p_scan )
{
if( p_scan->p_dialog != NULL )
dialog_ProgressDestroy( p_scan->p_dialog );
if( p_scan->p_dialog_id != NULL )
vlc_dialog_release( p_scan->p_obj, p_scan->p_dialog_id );
for( int i = 0; i < p_scan->i_service; i++ )
scan_service_Delete( p_scan->pp_service[i] );
......@@ -647,7 +647,6 @@ int scan_Next( scan_t *p_scan, scan_configuration_t *p_cfg )
if( i_ret )
return i_ret;
char *psz_text;
int i_service = 0;
for( int i = 0; i < p_scan->i_service; i++ )
......@@ -658,18 +657,28 @@ int scan_Next( scan_t *p_scan, scan_configuration_t *p_cfg )
const mtime_t i_eta = f_position > 0.005 ? (mdate() - p_scan->i_time_start) * ( 1.0 / f_position - 1.0 ) : -1;
char psz_eta[MSTRTIME_MAX_SIZE];
const char *psz_fmt = _("%.1f MHz (%d services)\n~%s remaining");
if( asprintf( &psz_text, _("%.1f MHz (%d services)\n~%s remaining"),
(double)p_cfg->i_frequency / 1000000, i_service, secstotimestr( psz_eta, i_eta/1000000 ) ) >= 0 )
if( i_eta >= 0 )
msg_Info( p_scan->p_obj, "Scan ETA %s | %f", secstotimestr( psz_eta, i_eta/1000000 ), f_position * 100 );
if( p_scan->p_dialog_id == NULL )
{
if( i_eta >= 0 )
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 = dialog_ProgressCreate( p_scan->p_obj, _("Scanning DVB"), psz_text, _("Cancel") );
if( p_scan->p_dialog != NULL )
dialog_ProgressSet( p_scan->p_dialog, psz_text, f_position );
free( psz_text );
p_scan->p_dialog_id =
vlc_dialog_display_progress( p_scan->p_obj, false,
f_position, _("Cancel"),
_("Scanning DVB"), psz_fmt,
(double)p_cfg->i_frequency / 1000000,
i_service,
secstotimestr( psz_eta, i_eta/1000000 ) );
}
else
{
vlc_dialog_update_progress_text( p_scan->p_obj, p_scan->p_dialog_id,
f_position, psz_fmt,
(double)p_cfg->i_frequency / 1000000,
i_service,
secstotimestr( psz_eta, i_eta/1000000 ) );
}
p_scan->i_index++;
......@@ -678,7 +687,9 @@ int scan_Next( scan_t *p_scan, scan_configuration_t *p_cfg )
bool scan_IsCancelled( scan_t *p_scan )
{
return p_scan->p_dialog && dialog_ProgressCancelled( p_scan->p_dialog );
if( p_scan->p_dialog_id == NULL )
return false;
return vlc_dialog_is_cancelled( p_scan->p_obj, p_scan->p_dialog_id );
}
static scan_service_t *ScanFindService( scan_t *p_scan, int i_service_start, int i_program )
......
......@@ -291,9 +291,9 @@ static int CommonOpen( vlc_object_t *p_this,
if( dvdnav_title_play( p_sys->dvdnav, 1 ) != DVDNAV_STATUS_OK )
{
msg_Err( p_demux, "cannot set title (can't decrypt DVD?)" );
dialog_Fatal( p_demux, _("Playback failure"), "%s",
_("VLC cannot set the DVD's title. It possibly "
"cannot decrypt the entire disc.") );
vlc_dialog_display_error( p_demux, _("Playback failure"), "%s",
_("VLC cannot set the DVD's title. It possibly "
"cannot decrypt the entire disc.") );
free( p_sys );
return VLC_EGENERIC;
}
......
......@@ -198,7 +198,7 @@ static int Open( vlc_object_t *p_this )
if( p_dvdread == NULL )
{
msg_Err( p_demux, "DVDRead cannot open source: %s", psz_file );
dialog_Fatal( p_demux, _("Playback failure"),
vlc_dialog_display_error( p_demux, _("Playback failure"),
_("DVDRead could not open the disc \"%s\"."), psz_file );
free( psz_file );
return VLC_EGENERIC;
......@@ -460,7 +460,7 @@ static int Demux( demux_t *p_demux )
1, p_buffer ) != 1 )
{
msg_Err( p_demux, "read failed for block %d", p_sys->i_next_vobu );
dialog_Fatal( p_demux, _("Playback failure"),
vlc_dialog_display_error( p_demux, _("Playback failure"),
_("DVDRead could not read block %d."),
p_sys->i_next_vobu );
return -1;
......@@ -528,7 +528,7 @@ static int Demux( demux_t *p_demux )
{
msg_Err( p_demux, "read failed for %d/%d blocks at 0x%02x",
i_read, i_blocks_once, p_sys->i_cur_block );
dialog_Fatal( p_demux, _("Playback failure"),
vlc_dialog_display_error( p_demux, _("Playback failure"),
_("DVDRead could not read %d/%d blocks at 0x%02x."),
i_read, i_blocks_once, p_sys->i_cur_block );
return -1;
......
......@@ -174,11 +174,11 @@ int FileOpen( vlc_object_t *p_this )
p_access->psz_filepath ? p_access->psz_filepath
: p_access->psz_location,
vlc_strerror_c(errno));
dialog_Fatal (p_access, _("File reading failed"),
_("VLC could not open the file \"%s\" (%s)."),
p_access->psz_filepath ? p_access->psz_filepath
: p_access->psz_location,
vlc_strerror(errno));
vlc_dialog_display_error (p_access, _("File reading failed"),
_("VLC could not open the file \"%s\" (%s)."),
p_access->psz_filepath ? p_access->psz_filepath
: p_access->psz_location,
vlc_strerror(errno));
return VLC_EGENERIC;
}
......@@ -289,9 +289,9 @@ static ssize_t Read (access_t *p_access, uint8_t *p_buffer, size_t i_len)
}
msg_Err (p_access, "read error: %s", vlc_strerror_c(errno));
dialog_Fatal (p_access, _("File reading failed"),
_("VLC could not read the file (%s)."),
vlc_strerror(errno));
vlc_dialog_display_error (p_access, _("File reading failed"),
_("VLC could not read the file (%s)."),
vlc_strerror(errno));
val = 0;
}
......
......@@ -338,8 +338,8 @@ static int Login( vlc_object_t *p_access, access_sys_t *p_sys )
if( fd == -1 )
{
msg_Err( p_access, "connection failed" );
dialog_Fatal( p_access, _("Network interaction failed"), "%s",
_("VLC could not connect with the given server.") );
vlc_dialog_display_error( p_access, _("Network interaction failed"), "%s",
_("VLC could not connect with the given server.") );
return -1;
}
......@@ -354,8 +354,8 @@ static int Login( vlc_object_t *p_access, access_sys_t *p_sys )
if( i_answer / 100 != 2 )
{
msg_Err( p_access, "connection rejected" );
dialog_Fatal( p_access, _("Network interaction failed"), "%s",
_("VLC's connection to the given server was rejected.") );
vlc_dialog_display_error( p_access, _("Network interaction failed"), "%s",
_("VLC's connection to the given server was rejected.") );
return -1;
}
......@@ -488,9 +488,9 @@ static int LoginUserPwd( vlc_object_t *p_access, access_sys_t *p_sys,
if( i_answer / 100 != 2 )
{
msg_Err( p_access, "account rejected" );
dialog_Fatal( p_access,
_("Network interaction failed"),
"%s", _("Your account was rejected.") );
vlc_dialog_display_error( p_access,
_("Network interaction failed"),
"%s", _("Your account was rejected.") );
return -1;
}
msg_Dbg( p_access, "account accepted" );
......
......@@ -670,8 +670,8 @@ describe:
{
msg_Dbg( p_demux, "connection error %d", i_code );
if( i_code == 403 )
dialog_Fatal( p_demux, _("RTSP connection failed"),
_("Access to the stream is denied by the server configuration.") );
vlc_dialog_display_error( p_demux, _("RTSP connection failed"),
_("Access to the stream is denied by the server configuration.") );
}
if( p_sys->rtsp ) RTSPClient::close( p_sys->rtsp );
p_sys->rtsp = NULL;
......
......@@ -192,9 +192,9 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
default:
msg_Err( p_access, "read failed: %s", vlc_strerror_c(errno) );
dialog_Fatal( p_access, _( "File reading failed" ),
_( "VLC could not read the file: %s" ),
vlc_strerror(errno) );
vlc_dialog_display_error( p_access, _( "File reading failed" ),
_( "VLC could not read the file: %s" ),
vlc_strerror(errno) );
p_access->info.b_eof = true;
return 0;
}
......@@ -281,9 +281,9 @@ static int open_file( access_t *p_access, const char *path )
{
msg_Err( p_access, "cannot open file %s: %s", path,
vlc_strerror_c(errno) );
dialog_Fatal( p_access, _( "File reading failed" ),
_( "VLC could not open the file \"%s\": %s" ), path,
vlc_strerror(errno) );
vlc_dialog_display_error( p_access, _( "File reading failed" ),
_( "VLC could not open the file \"%s\": %s" ), path,
vlc_strerror(errno) );
return -1;
}
#ifdef F_RDAHEAD
......
......@@ -108,8 +108,9 @@ nfs_check_status(access_t *p_access, int i_status, const char *psz_error,
msg_Err(p_access, "%s failed: %d, '%s'", psz_func, i_status,
psz_error);
if (!p_access->p_sys->b_error)
dialog_Fatal(p_access, _("NFS operation failed"), "%s",
psz_error);
vlc_dialog_display_error(p_access,
_("NFS operation failed"), "%s",
psz_error);
}
else
msg_Warn(p_access, "%s interrupted", psz_func);
......
......@@ -259,9 +259,9 @@ static int Open(vlc_object_t *p_this)
myAudioDevices = [[[QTCaptureDevice inputDevicesWithMediaType:QTMediaTypeSound]
arrayByAddingObjectsFromArray:[QTCaptureDevice inputDevicesWithMediaType:QTMediaTypeMuxed]] retain];
if([myAudioDevices count] == 0) {
dialog_Fatal(p_demux, _("No Audio Input device found"),
_("Your Mac does not seem to be equipped with a suitable audio input device."
"Please check your connectors and drivers."));
vlc_dialog_display_error(p_demux, _("No Audio Input device found"),
_("Your Mac does not seem to be equipped with a suitable audio input device."
"Please check your connectors and drivers."));
msg_Err(p_demux, "Can't find any Audio device");
goto error;
......@@ -290,9 +290,9 @@ static int Open(vlc_object_t *p_this)
p_sys->audiodevice = [QTCaptureDevice defaultInputDeviceWithMediaType: QTMediaTypeSound];
}
if(!p_sys->audiodevice) {
dialog_Fatal(p_demux, _("No audio input device found"),
_("Your Mac does not seem to be equipped with a suitable audio input device."
"Please check your connectors and drivers."));
vlc_dialog_display_error(p_demux, _("No audio input device found"),
_("Your Mac does not seem to be equipped with a suitable audio input device."
"Please check your connectors and drivers."));
msg_Err(p_demux, "Can't find any Audio device");
goto error;
......
......@@ -753,7 +753,7 @@ void rtp_autodetect (demux_t *demux, rtp_session_t *session,
msg_Err (demux, "unspecified payload format (type %"PRIu8")", ptype);
msg_Info (demux, "A valid SDP is needed to parse this RTP stream.");
dialog_Fatal (demux, N_("SDP required"),
vlc_dialog_display_error (demux, N_("SDP required"),
N_("A description in SDP format is required to receive the RTP "
"stream. Note that rtp:// URIs cannot work with dynamic "
"RTP payload format (%"PRIu8")."), ptype);
......
......@@ -84,8 +84,8 @@ static int RtspConnect( void *p_userdata, char *psz_server, int i_port )
if( p_sys->fd < 0 )
{
msg_Err( p_access, "cannot connect to %s:%d", psz_server, i_port );
dialog_Fatal( p_access, _("Connection failed"),
_("VLC could not connect to \"%s:%d\"."), psz_server, i_port );
vlc_dialog_display_error( p_access, _("Connection failed"),
_("VLC could not connect to \"%s:%d\"."), psz_server, i_port );
return VLC_EGENERIC;
}
......@@ -228,8 +228,8 @@ static int Open( vlc_object_t *p_this )
msg_Err( p_access, "rtsp session can not be established" );
dialog_Fatal( p_access, _("Session failed"), "%s",
_("The requested RTSP session could not be established.") );
vlc_dialog_display_error( p_access, _("Session failed"), "%s",
_("The requested RTSP session could not be established.") );
goto error;
}
......
......@@ -376,9 +376,9 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
{
/* abort on read error */
msg_Err( p_access, "failed to read (%s)", vlc_strerror_c(errno) );
dialog_Fatal( p_access, _("File reading failed"),
_("VLC could not read the file (%s)."),
vlc_strerror(errno) );
vlc_dialog_display_error( p_access, _("File reading failed"),
_("VLC could not read the file (%s)."),
vlc_strerror(errno) );
SwitchFile( p_access, -1 );
return 0;
}
......@@ -541,7 +541,7 @@ static bool SwitchFile( access_t *p_access, unsigned i_file )
return true;
error:
dialog_Fatal (p_access, _("File reading failed"), _("VLC could not"
vlc_dialog_display_error (p_access, _("File reading failed"), _("VLC could not"
" open the file \"%s\" (%s)."), psz_path, vlc_strerror(errno) );
if( p_sys->fd != -1 )
{
......
......@@ -318,12 +318,12 @@ static int Open( vlc_object_t *p_this )
break;
flags &= ~O_EXCL;
}
while (dialog_Question (p_access, path,
_("The output file already exists. "
"If recording continues, the file will be "
"overridden and its content will be lost."),
_("Keep existing file"),
_("Overwrite"), NULL) == 2);
while (vlc_dialog_wait_question (p_access, VLC_DIALOG_QUESTION_NORMAL,
_("Keep existing file"),
_("Overwrite"), NULL, path,
_("The output file already exists. "
"If recording continues, the file will be "
"overridden and its content will be lost.")) == 1);
free (buf);
if (fd == -1)
return VLC_EGENERIC;
......
......@@ -387,9 +387,9 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
{
msg_Err (aout, "cannot open ALSA device \"%s\": %s", device,
snd_strerror (val));
dialog_Fatal (aout, _("Audio output failed"),
_("The audio device \"%s\" could not be used:\n%s."),
sys->device, snd_strerror (val));
vlc_dialog_display_error (aout, _("Audio output failed"),
_("The audio device \"%s\" could not be used:\n%s."),
sys->device, snd_strerror (val));
free (devbuf);
return VLC_EGENERIC;
}
......
......@@ -31,7 +31,7 @@
#import <vlc_common.h>
#import <vlc_plugin.h>
#import <vlc_dialog.h> // dialog_Fatal
#import <vlc_dialog.h> // vlc_dialog_display_error
#import <vlc_aout.h> // aout_*
#import <AudioUnit/AudioUnit.h> // AudioUnit
......@@ -422,9 +422,9 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
if (p_sys->i_hog_pid != -1 && p_sys->i_hog_pid != getpid()) {
msg_Err(p_aout, "Selected audio device is exclusively in use by another program.");
dialog_Fatal(p_aout, _("Audio output failed"), "%s",
_("The selected audio output device is exclusively in "
"use by another program."));
vlc_dialog_display_error(p_aout, _("Audio output failed"), "%s",
_("The selected audio output device is exclusively in "
"use by another program."));
goto error;
}
......@@ -630,10 +630,11 @@ static int StartAnalog(audio_output_t *p_aout, audio_sample_format_t *fmt)
if (fmt->i_physical_channels == 0) {
fmt->i_physical_channels = AOUT_CHANS_STEREO;
msg_Err(p_aout, "You should configure your speaker layout with Audio Midi Setup in /Applications/Utilities. VLC will output Stereo only.");
dialog_Fatal(p_aout, _("Audio device is not configured"), "%s",
_("You should configure your speaker layout with "
"\"Audio Midi Setup\" in /Applications/"
"Utilities. VLC will output Stereo only."));
vlc_dialog_display_error(p_aout,
_("Audio device is not configured"), "%s",
_("You should configure your speaker layout with "
"\"Audio Midi Setup\" in /Applications/"
"Utilities. VLC will output Stereo only."));
}
}
free(layout);
......
......@@ -317,16 +317,16 @@ int OpenEncoder( vlc_object_t *p_this )
if( p_enc->fmt_out.i_cat == VIDEO_ES && i_cat != VIDEO_ES )
{
msg_Err( p_enc, "\"%s\" is not a video encoder", psz_namecodec );
dialog_Fatal( p_enc, _("Streaming / Transcoding failed"),
_("\"%s\" is no video encoder."), psz_namecodec );
vlc_dialog_display_error( p_enc, _("Streaming / Transcoding failed"),
_("\"%s\" is no video encoder."), psz_namecodec );
return VLC_EGENERIC;
}
if( p_enc->fmt_out.i_cat == AUDIO_ES && i_cat != AUDIO_ES )
{
msg_Err( p_enc, "\"%s\" is not an audio encoder", psz_namecodec );
dialog_Fatal( p_enc, _("Streaming / Transcoding failed"),
_("\"%s\" is no audio encoder."), psz_namecodec );
vlc_dialog_display_error( p_enc, _("Streaming / Transcoding failed"),
_("\"%s\" is no audio encoder."), psz_namecodec );
return VLC_EGENERIC;
}
......@@ -359,7 +359,7 @@ int OpenEncoder( vlc_object_t *p_this )
"*** Please check with your Libav/FFmpeg packager. ***\n"
"*** This is NOT a VLC media player issue. ***", psz_namecodec );
dialog_Fatal( p_enc, _("Streaming / Transcoding failed"), _(
vlc_dialog_display_error( p_enc, _("Streaming / Transcoding failed"), _(
/* I have had enough of all these MPEG-3 transcoding bug reports.
* Downstream packager, you had better not patch this out, or I will be really
* annoyed. Think about it - you don't want to fork the VLC translation files,
......@@ -876,9 +876,9 @@ errmsg:
if (likely((unsigned)p_enc->fmt_in.i_cat < sizeof (types) / sizeof (types[0])))
type = types[p_enc->fmt_in.i_cat];
msg_Err( p_enc, "cannot open %4.4s %s encoder", fcc.txt, type );
dialog_Fatal( p_enc, _("Streaming / Transcoding failed"),
_("VLC could not open the %4.4s %s encoder."),
fcc.txt, vlc_gettext(type) );
vlc_dialog_display_error( p_enc, _("Streaming / Transcoding failed"),
_("VLC could not open the %4.4s %s encoder."),
fcc.txt, vlc_gettext(type) );
av_dict_free(&options);
goto error;
}
......
......@@ -143,7 +143,7 @@ static int Open (vlc_object_t *p_this)
if (p_sys->soundfont == -1)
{
msg_Err (p_this, "sound font file required for synthesis");
dialog_Fatal (p_this, _("MIDI synthesis not set up"),
vlc_dialog_display_error (p_this, _("MIDI synthesis not set up"),
_("A sound font file (.SF2) is required for MIDI synthesis.\n"
"Please install a sound font and configure it "
"from the VLC preferences "
......
......@@ -225,19 +225,17 @@ static int Create( vlc_object_t *p_this )
#ifdef HAVE_FONTCONFIG
#if defined(_WIN32)
dialog_progress_bar_t *p_dialog =
dialog_ProgressCreate( p_dec,
_("Building font cache"),
_( "Please wait while your font cache is rebuilt.\n"
"This should take less than a minute." ), NULL );
int i_ret =
vlc_dialog_display_progress( p_dec, true, 0.0, NULL,
_("Building font cache"),
_( "Please wait while your font cache is rebuilt.\n"
"This should take less than a minute." ) );
unsigned int i_dialog_id = i_ret > 0 ? i_ret : 0;
#endif
ass_set_fonts( p_renderer, psz_font, psz_family, 1, NULL, 1 ); // setup default font/family
#if defined(_WIN32)
if( p_dialog )
{
dialog_ProgressSet( p_dialog, NULL, 1.0 );
dialog_ProgressDestroy( p_dialog );
}
if( i_dialog_id != 0 )
vlc_dialog_cancel( p_dec, i_dialog_id );
#endif
#else
ass_set_fonts( p_renderer, psz_font, psz_family, 1, NULL, 1 );
......
......@@ -258,8 +258,9 @@ static int Demux( demux_t *p_demux )
if( DemuxInit( p_demux ) )
{
msg_Err( p_demux, "failed to load the new header" );
dialog_Fatal( p_demux, _("Could not demux ASF stream"), "%s",
_("VLC failed to load the ASF header.") );
vlc_dialog_display_error( p_demux,
_("Could not demux ASF stream"), "%s",
_("VLC failed to load the ASF header.") );
return 0;
}
es_out_Control( p_demux->out, ES_OUT_RESET_PCR );
......@@ -789,8 +790,8 @@ static int DemuxInit( demux_t *p_demux )
|| ASF_FindObject( p_sys->p_root->p_hdr,
&asf_object_advanced_content_encryption_guid, 0 ) != NULL )
{
dialog_Fatal( p_demux, _("Could not demux ASF stream"), "%s",
_("DRM protected streams are not supported.") );
vlc_dialog_display_error( p_demux, _("Could not demux ASF stream"), "%s",
("DRM protected streams are not supported.") );
goto error;
}
......
......@@ -753,22 +753,28 @@ aviindex:
}
if( i_do_index == 0 )
{
switch( dialog_Question( p_demux, _("Broken or missing AVI Index") ,
_( "Because this AVI file index is broken or missing, "
"seeking will not work correctly.\n"
"VLC won't repair your file but can temporary fix this "
"problem by building an index in memory.\n"
"This step might take a long time on a large file.\n"
"What do you want to do?" ),
_( "Build index then play" ), _( "Play as is" ), _( "Do not play") ) )
const char *psz_msg = _(
"Because this AVI file index is broken or missing, "
"seeking will not work correctly.\n"
"VLC won't repair your file but can temporary fix this "
"problem by building an index in memory.\n"
"This step might take a long time on a large file.\n"
"What do you want to do?");
switch( vlc_dialog_wait_question( p_demux,
VLC_DIALOG_QUESTION_NORMAL,
_("Do not play"),
_("Build index then play"),
_("Play as is"),
_("Broken or missing AVI Index"),
"%s", psz_msg ) )
{
case 0:
b_aborted = true;
goto error;
case 1:
b_index = true;
msg_Dbg( p_demux, "Fixing AVI index" );
goto aviindex;
case 3:
b_aborted = true;
goto error;
}
}
else
......@@ -2609,7 +2615,7 @@ static void AVI_IndexCreate( demux_t *p_demux )
off_t i_movi_end;
mtime_t i_dialog_update;
dialog_progress_bar_t *p_dialog = NULL;
vlc_dialog_id *p_dialog_id = NULL;
p_riff = AVI_ChunkFind( &p_sys->ck_root, AVIFOURCC_RIFF, 0);
p_movi = AVI_ChunkFind( p_riff, AVIFOURCC_movi, 0);
......@@ -2633,23 +2639,27 @@ 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 = dialog_ProgressCreate( p_demux, _("Fixing AVI Index..."),
NULL, _("Cancel") );
{
p_dialog_id =
vlc_dialog_display_progress( p_demux, false, 0.0, _("Cancel"),
_("Broken or missing AVI Index"),
_("Fixing AVI Index...") );
}
for( ;; )
{
avi_packet_t pk;
/* Don't update/check dialog too often */
if( p_dialog && mdate() - i_dialog_update > 100000 )
if( p_dialog_id != NULL && mdate() - i_dialog_update > 100000 )
{
if( dialog_ProgressCancelled( p_dialog ) )
if( vlc_dialog_is_cancelled( p_demux, p_dialog_id ) )
break;
double f_current = stream_Tell( p_demux->s );
double f_size = stream_Size( p_demux->s );
double f_pos = f_current / f_size;
dialog_ProgressSet( p_dialog, NULL, f_pos );
vlc_dialog_update_progress( p_demux, p_dialog_id, f_pos );
i_dialog_update = mdate();
}
......@@ -2714,8 +2724,8 @@ static void AVI_IndexCreate( demux_t *p_demux )
}
print_stat:
if( p_dialog != NULL )
dialog_ProgressDestroy( p_dialog );
if( p_dialog_id != NULL )
vlc_dialog_release(