dialog: use new API
authorThomas Guillem <thomas@gllm.fr>
Thu, 4 Feb 2016 12:25:59 +0000 (13:25 +0100)
committerThomas Guillem <thomas@gllm.fr>
Thu, 4 Feb 2016 14:03:58 +0000 (15:03 +0100)
39 files changed:
modules/access/avcapture.m
modules/access/bluray.c
modules/access/dshow/dshow.cpp
modules/access/dtv/access.c
modules/access/dvb/scan.c
modules/access/dvdnav.c
modules/access/dvdread.c
modules/access/file.c
modules/access/ftp.c
modules/access/live555.cpp
modules/access/mtp.c
modules/access/nfs.c
modules/access/qtsound.m
modules/access/rtp/rtp.c
modules/access/rtsp/access.c
modules/access/vdr.c
modules/access_output/file.c
modules/audio_output/alsa.c
modules/audio_output/auhal.c
modules/codec/avcodec/encoder.c
modules/codec/fluidsynth.c
modules/codec/libass.c
modules/demux/asf/asf.c
modules/demux/avi/avi.c
modules/lua/extension.c
modules/lua/extension.h
modules/lua/extension_thread.c
modules/misc/audioscrobbler.c
modules/misc/gnutls.c
modules/misc/securetransport.c
modules/services_discovery/xcb_apps.c
modules/stream_out/es.c
modules/text_renderer/freetype/fonts/fontconfig.c
src/audio_output/filters.c
src/input/decoder.c
src/input/input.c
src/misc/keystore.c
src/misc/update.c
test/modules/misc/tls.c

index b8e8c11..c067603 100644 (file)
@@ -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;
         }
index 282aae2..35c7dfd 100644 (file)
@@ -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:
index 9d05746..785dfba 100644 (file)
@@ -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();
index 8546f3c..a370536 100644 (file)
@@ -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;
         }
     }
index f12d015..a2d32cf 100644 (file)
@@ -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 )
index 07093b1..fc3c60b 100644 (file)
@@ -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;
         }
index cafee9b..5f1f070 100644 (file)
@@ -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;
index 4848279..7dafeb2 100644 (file)
@@ -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;
     }
 
index 39ccf86..5a94733 100644 (file)
@@ -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" );
index b2ee18f..86f0187 100644 (file)
@@ -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;
index a80299a..7134cb6 100644 (file)
@@ -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
index 6a9524d..2c85953 100644 (file)
@@ -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);
index cc552c0..eaf882c 100644 (file)
@@ -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;
index 455c0e8..6772d67 100644 (file)
@@ -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);
index 2050b37..8814fda 100644 (file)
@@ -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;
         }
 
index d2d840e..1845da7 100644 (file)
@@ -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 )
     {
index 2e61e32..34a0329 100644 (file)
@@ -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;
index a2c3436..a3e0944 100644 (file)
@@ -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;
     }
index 8b60ac0..de64f42 100644 (file)
@@ -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);
index 92f5554..9f1e6c2 100644 (file)
@@ -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;
         }
index 3730c10..bdc8d24 100644 (file)
@@ -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 "
index 77240e7..920148a 100644 (file)
@@ -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 );
index fa524d6..d059d71 100644 (file)
@@ -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;
     }
 
index 425748a..70ba6fa 100644 (file)
@@ -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( p_demux, p_dialog_id );
 
     for( i_stream = 0; i_stream < p_sys->i_track; i_stream++ )
     {
index 9546e4c..30f1040 100644 (file)
@@ -964,10 +964,10 @@ int lua_ExecuteFunctionVa( extensions_manager_t *p_mgr, extension_t *p_ext,
 
     // Reset watch timer and timestamp
     vlc_mutex_lock( &p_ext->p_sys->command_lock );
-    if( p_ext->p_sys->progress )
+    if( p_ext->p_sys->p_progress_id != NULL )
     {
-        dialog_ProgressDestroy( p_ext->p_sys->progress );
-        p_ext->p_sys->progress = NULL;
+        vlc_dialog_release( p_mgr, p_ext->p_sys->p_progress_id );
+        p_ext->p_sys->p_progress_id = NULL;
     }
     vlc_timer_schedule( p_ext->p_sys->timer, false, 0, 0 );
     vlc_mutex_unlock( &p_ext->p_sys->command_lock );
@@ -1021,10 +1021,10 @@ int lua_ExtensionTriggerMenu( extensions_manager_t *p_mgr,
 
     // Reset watch timer and timestamp
     vlc_mutex_lock( &p_ext->p_sys->command_lock );
-    if( p_ext->p_sys->progress )
+    if( p_ext->p_sys->p_progress_id != NULL )
     {
-        dialog_ProgressDestroy( p_ext->p_sys->progress );
-        p_ext->p_sys->progress = NULL;
+        vlc_dialog_release( p_mgr, p_ext->p_sys->p_progress_id );
+        p_ext->p_sys->p_progress_id = NULL;
     }
     vlc_timer_schedule( p_ext->p_sys->timer, false, 0, 0 );
     vlc_mutex_unlock( &p_ext->p_sys->command_lock );
@@ -1106,10 +1106,10 @@ int vlclua_extension_keep_alive( lua_State *L )
     extension_t *p_ext = vlclua_extension_get( L );
 
     vlc_mutex_lock( &p_ext->p_sys->command_lock );
-    if( p_ext->p_sys->progress )
+    if( p_ext->p_sys->p_progress_id != NULL )
     {
-        dialog_ProgressDestroy( p_ext->p_sys->progress );
-        p_ext->p_sys->progress = NULL;
+        vlc_dialog_release( p_ext->p_sys->p_mgr, p_ext->p_sys->p_progress_id );
+        p_ext->p_sys->p_progress_id = NULL;
     }
     vlc_timer_schedule( p_ext->p_sys->timer, false, WATCH_TIMER_PERIOD, 0 );
     vlc_mutex_unlock( &p_ext->p_sys->command_lock );
@@ -1211,14 +1211,6 @@ static void WatchTimerCallback( void *data )
     extension_t *p_ext = data;
     extensions_manager_t *p_mgr = p_ext->p_sys->p_mgr;
 
-    char *message;
-    if( asprintf( &message, _( "Extension '%s' does not respond.\n"
-                               "Do you want to kill it now? " ),
-                  p_ext->psz_title ) == -1 )
-    {
-        return;
-    }
-
     vlc_mutex_lock( &p_ext->p_sys->command_lock );
 
     for( struct command_t *cmd = p_ext->p_sys->command;
@@ -1226,30 +1218,39 @@ static void WatchTimerCallback( void *data )
          cmd = cmd->next )
         if( cmd->i_command == CMD_DEACTIVATE )
         {   /* We have a pending Deactivate command... */
-            if( p_ext->p_sys->progress )
+            if( p_ext->p_sys->p_progress_id != NULL )
             {
-                dialog_ProgressDestroy( p_ext->p_sys->progress );
-                p_ext->p_sys->progress = NULL;
+                vlc_dialog_release( p_mgr, p_ext->p_sys->p_progress_id );
+                p_ext->p_sys->p_progress_id = NULL;
             }
             vlc_mutex_unlock( &p_ext->p_sys->command_lock );
             KillExtension( p_mgr, p_ext );
             return;
         }
 
-    if( !p_ext->p_sys->progress )
+    if( p_ext->p_sys->p_progress_id == NULL )
     {
-        p_ext->p_sys->progress =
-                dialog_ProgressCreate( p_mgr, _( "Extension not responding!" ),
-                                       message,
-                                       _( "Yes" ) );
+        p_ext->p_sys->p_progress_id =
+            vlc_dialog_display_progress( p_mgr, true, 0.0,
+                                         _( "Yes" ),
+                                         _( "Extension not responding!" ),
+                                         _( "Extension '%s' does not respond.\n"
+                                         "Do you want to kill it now? " ),
+                                         p_ext->psz_title );
+        if( p_ext->p_sys->p_progress_id == NULL )
+        {
+            vlc_mutex_unlock( &p_ext->p_sys->command_lock );
+            KillExtension( p_mgr, p_ext );
+            return;
+        }
         vlc_timer_schedule( p_ext->p_sys->timer, false, 100000, 0 );
     }
     else
     {
-        if( dialog_ProgressCancelled( p_ext->p_sys->progress ) )
+        if( vlc_dialog_is_cancelled( p_mgr, p_ext->p_sys->p_progress_id ) )
         {
-            dialog_ProgressDestroy( p_ext->p_sys->progress );
-            p_ext->p_sys->progress = NULL;
+            vlc_dialog_release( p_mgr, p_ext->p_sys->p_progress_id );
+            p_ext->p_sys->p_progress_id = NULL;
             vlc_mutex_unlock( &p_ext->p_sys->command_lock );
             KillExtension( p_mgr, p_ext );
             return;
index 69f1705..1626334 100644 (file)
@@ -91,7 +91,7 @@ struct extension_sys_t
     } *command;
 
     // The two following booleans are protected by command_lock
-    dialog_progress_bar_t *progress;
+    vlc_dialog_id *p_progress_id;
     vlc_timer_t timer; ///< This timer makes sure Lua never gets stuck >5s
 
     bool b_exiting;
index 17d4276..c8b2224 100644 (file)
@@ -140,7 +140,6 @@ static void FreeCommands( struct command_t *command )
 /** Deactivate this extension: pushes immediate command and drops queued */
 int Deactivate( extensions_manager_t *p_mgr, extension_t *p_ext )
 {
-    (void) p_mgr;
     vlc_mutex_lock( &p_ext->p_sys->command_lock );
 
     if( p_ext->p_sys->b_exiting )
@@ -149,11 +148,11 @@ int Deactivate( extensions_manager_t *p_mgr, extension_t *p_ext )
         return VLC_EGENERIC;
     }
 
-    if( p_ext->p_sys->progress )
+    if( p_ext->p_sys->p_progress_id != NULL )
     {
         // Extension is stuck, kill it now
-        dialog_ProgressDestroy( p_ext->p_sys->progress );
-        p_ext->p_sys->progress = NULL;
+        vlc_dialog_release( p_mgr, p_ext->p_sys->p_progress_id );
+        p_ext->p_sys->p_progress_id = NULL;
         vlc_mutex_unlock( &p_ext->p_sys->command_lock );
         KillExtension( p_mgr, p_ext );
         return VLC_SUCCESS;
index 2d092a7..ba61b6a 100644 (file)
@@ -562,7 +562,7 @@ static int Handshake(intf_thread_t *p_this)
     if (strstr((char*) p_buffer, "BADAUTH"))
     {
         /* authentication failed, bad username/password combination */
-        dialog_Fatal(p_this,
+        vlc_dialog_display_error(p_this,
             _("last.fm: Authentication failed"),
             "%s", _("last.fm username or password is incorrect. "
               "Please verify your settings and relaunch VLC."));
@@ -710,7 +710,7 @@ static void *Run(void *data)
 
                 case VLC_ENOVAR:
                     /* username not set */
-                    dialog_Fatal(p_intf,
+                    vlc_dialog_display_error(p_intf,
                         _("Last.fm username not set"),
                         "%s", _("Please set a username or disable the "
                         "audioscrobbler plugin, and restart VLC.\n"
index 43ef396..692f901 100644 (file)
@@ -490,13 +490,13 @@ error:
             goto error;
     }
 
-    if (dialog_Question(creds, _("Insecure site"),
-        _("You attempted to reach %s. %s\n"
-          "This problem may be stem from an attempt to breach your security, "
-          "compromise your privacy, or a configuration error.\n\n"
-          "If in doubt, abort now.\n"),
-                        _("Abort"), _("View certificate"), NULL,
-                        vlc_gettext(msg), host) != 2)
+    if (vlc_dialog_wait_question(creds, VLC_DIALOG_QUESTION_NORMAL,
+            _("Abort"), _("View certificate"), NULL,
+            _("Insecure site"), 
+            _("You attempted to reach %s. %s\n"
+            "This problem may be stem from an attempt to breach your security, "
+            "compromise your privacy, or a configuration error.\n\n"
+            "If in doubt, abort now.\n"), host, vlc_gettext(msg)) != 1)
         goto error;
 
     gnutls_x509_crt_t cert;
@@ -511,20 +511,20 @@ error:
     }
     gnutls_x509_crt_deinit (cert);
 
-    val = dialog_Question(creds, _("Insecure site"),
-         _("This is the certificate presented by %s:\n%s\n\n"
-           "If in doubt, abort now.\n"),
-                          _("Abort"), _("Accept 24 hours"),
-                          _("Accept permanently"), host, desc.data);
+    val = vlc_dialog_wait_question(creds, VLC_DIALOG_QUESTION_NORMAL,
+            _("Abort"), _("Accept 24 hours"), _("Accept permanently"),
+            _("Insecure site"),
+            _("This is the certificate presented by %s:\n%s\n\n"
+            "If in doubt, abort now.\n"), host, desc.data);
     gnutls_free (desc.data);
 
     time_t expiry = 0;
     switch (val)
     {
-        case 2:
+        case 1:
             time (&expiry);
             expiry += 24 * 60 * 60;
-        case 3:
+        case 2:
             val = gnutls_store_pubkey (NULL, NULL, host, service,
                                        GNUTLS_CRT_X509, datum, expiry, 0);
             if (val)
index 1929471..9cd3553 100644 (file)
@@ -330,10 +330,12 @@ static int st_validateServerCertificate (vlc_tls_t *session, const char *hostnam
              "This problem may be caused by a configuration error "
              "or an attempt to breach your security or your privacy.\n\n"
              "If in doubt, abort now.\n");
-    int answer = dialog_Question(session->obj, _("Insecure site"), vlc_gettext (msg),
-                                  _("Abort"), _("Accept certificate temporarily"), NULL, hostname);
-
-    if (answer == 2) {
+    int answer = vlc_dialog_wait_question(session->obj,
+                                          VLC_DIALOG_QUESTION_NORMAL, _("Abort"),
+                                          _("Accept certificate temporarily"),
+                                          NULL, _("Insecure site"),
+                                          vlc_gettext (msg), hostname);
+    if (answer == 1) {
         msg_Warn(session->obj, "Proceeding despite of failed certificate validation");
 
         /* save leaf certificate in whitelist */
index 1db34f5..8990ef0 100644 (file)
@@ -148,7 +148,7 @@ static int Open (vlc_object_t *obj)
     r = xcb_intern_atom_reply (conn, ncl, NULL);
     if (r == NULL || r->atom == 0)
     {
-        dialog_Fatal (sd, _("Screen capture"),
+        vlc_dialog_display_error (sd, _("Screen capture"),
             _("Your window manager does not provide a list of applications."));
         msg_Err (sd, "client list not supported (_NET_CLIENT_LIST absent)");
     }
index 0eb7990..6372dc5 100644 (file)
@@ -358,11 +358,9 @@ static sout_stream_id_sys_t *Add( sout_stream_t *p_stream, const es_format_t *p_
     {
         msg_Err( p_stream, "no suitable sout access module for `%s/%s://%s'",
                  psz_access, psz_mux, psz_dst );
-        dialog_Fatal( p_stream,
-                    _("Streaming / Transcoding failed"),
-                    _("There is no suitable stream-output access module for \"%s/%s://%s\"."),
-                          psz_access,
-                          psz_mux, psz_dst );
+        vlc_dialog_display_error( p_stream, _("Streaming / Transcoding failed"),
+            _("There is no suitable stream-output access module for \"%s/%s://%s\"."),
+            psz_access, psz_mux, psz_dst );
         free( psz_dst );
         return( NULL );
     }
@@ -373,11 +371,9 @@ static sout_stream_id_sys_t *Add( sout_stream_t *p_stream, const es_format_t *p_
     {
         msg_Err( p_stream, "no suitable sout mux module for `%s/%s://%s'",
                  psz_access, psz_mux, psz_dst );
-        dialog_Fatal( p_stream,
-                        _("Streaming / Transcoding failed"),
-                        _("There is no suitable stream-output access module "\
-                          "for \"%s/%s://%s\"."),
-                          psz_access, psz_mux, psz_dst );
+        vlc_dialog_display_error( p_stream, _("Streaming / Transcoding failed"),
+            _("There is no suitable stream-output access module "\
+            "for \"%s/%s://%s\"."), psz_access, psz_mux, psz_dst );
         sout_AccessOutDelete( p_access );
         free( psz_dst );
         return( NULL );
index 2c1e5f0..1165b34 100644 (file)
@@ -54,26 +54,24 @@ int FontConfig_Prepare( filter_t *p_filter )
 #endif
 
 #if defined( _WIN32 )
+    int i_ret;
+    unsigned int i_dialog_id = 0;
     dialog_progress_bar_t *p_dialog = NULL;
     FcConfig *fcConfig = FcInitLoadConfig();
 
-    p_dialog = dialog_ProgressCreate( p_filter,
-            _("Building font cache"),
-            _("Please wait while your font cache is rebuilt.\n"
-                "This should take less than a few minutes."), NULL );
+    i_ret =
+        vlc_dialog_display_progress( p_filter, true, 0.0, NULL,
+                                     _("Building font cache"),
+                                     _("Please wait while your font cache is rebuilt.\n"
+                                     "This should take less than a few minutes.") );
 
-/*    if( p_dialog )
-        dialog_ProgressSet( p_dialog, NULL, 0.5 ); */
+    i_dialog_id = i_ret > 0 ? i_ret : 0;
 
     if( FcConfigBuildFonts( fcConfig ) == FcFalse )
         return VLC_ENOMEM;
 
-    if( p_dialog )
-    {
-//        dialog_ProgressSet( p_dialog, NULL, 1.0 );
-        dialog_ProgressDestroy( p_dialog );
-        p_dialog = NULL;
-    }
+    if( i_dialog_id != 0 )
+        vlc_dialog_cancel( p_filter, i_dialog_id );
 #endif
     t2 = mdate();
     msg_Dbg( p_filter, "Took %ld microseconds", (long)((t2 - t1)) );
index e525739..d0c2997 100644 (file)
@@ -244,8 +244,8 @@ static int aout_FiltersPipelineCreate(vlc_object_t *obj, filter_t **filters,
 
 overflow:
     msg_Err (obj, "maximum of %u conversion filters reached", max);
-    dialog_Fatal (obj, _("Audio filtering failed"),
-                  _("The maximum number of filters (%u) was reached."), max);
+    vlc_dialog_display_error (obj, _("Audio filtering failed"),
+        _("The maximum number of filters (%u) was reached."), max);
 error:
     aout_FiltersPipelineDestroy (filters, n);
     return -1;
index 77b3fb1..a1d7414 100644 (file)
@@ -1758,12 +1758,12 @@ static void DecoderUnsupportedCodec( decoder_t *p_dec, const es_format_t *fmt )
         if (!desc || !*desc)
             desc = N_("No description for this codec");
         msg_Err( p_dec, "Codec `%4.4s' (%s) is not supported.", (char*)&fmt->i_codec, desc );
-        dialog_Fatal( p_dec, _("Codec not supported"),
-                _("VLC could not decode the format \"%4.4s\" (%s)"),
-                (char*)&fmt->i_codec, desc );
+        vlc_dialog_display_error( p_dec, _("Codec not supported"),
+            _("VLC could not decode the format \"%4.4s\" (%s)"),
+            (char*)&fmt->i_codec, desc );
     } else {
         msg_Err( p_dec, "could not identify codec" );
-        dialog_Fatal( p_dec, _("Unidentified codec"),
+        vlc_dialog_display_error( p_dec, _("Unidentified codec"),
             _("VLC could not identify the audio or video codec" ) );
     }
 }
@@ -1783,9 +1783,8 @@ static decoder_t *decoder_New( vlc_object_t *p_parent, input_thread_t *p_input,
     if( p_dec == NULL )
     {
         msg_Err( p_parent, "could not create %s", psz_type );
-        dialog_Fatal( p_parent, _("Streaming / Transcoding failed"),
-                      _("VLC could not open the %s module."),
-                      vlc_gettext( psz_type ) );
+        vlc_dialog_display_error( p_parent, _("Streaming / Transcoding failed"),
+            _("VLC could not open the %s module."), vlc_gettext( psz_type ) );
         return NULL;
     }
 
@@ -2042,8 +2041,9 @@ int input_DecoderSetCcState( decoder_t *p_dec, bool b_decode, int i_channel )
         if( !p_cc )
         {
             msg_Err( p_dec, "could not create decoder" );
-            dialog_Fatal( p_dec, _("Streaming / Transcoding failed"), "%s",
-                          _("VLC could not open the decoder module.") );
+            vlc_dialog_display_error( p_dec,
+                _("Streaming / Transcoding failed"), "%s",
+                _("VLC could not open the decoder module.") );
             return VLC_EGENERIC;
         }
         else if( !p_cc->p_module )
index a5d408c..72f1b3c 100644 (file)
@@ -2182,9 +2182,9 @@ static input_source_t *InputSourceNew( input_thread_t *p_input,
     if( in->p_demux == NULL )
     {
         if( !b_in_can_fail && !input_Stopped( p_input ) )
-            dialog_Fatal( p_input, _("Your input can't be opened"),
-                          _("VLC is unable to open the MRL '%s'."
-                            " Check the log for details."), psz_mrl );
+            vlc_dialog_display_error( p_input, _("Your input can't be opened"),
+                                      _("VLC is unable to open the MRL '%s'."
+                                      " Check the log for details."), psz_mrl );
         vlc_object_release( in );
         return NULL;
     }
index 62c7603..638fab5 100644 (file)
@@ -395,37 +395,38 @@ vlc_credential_get(vlc_credential *p_credential, vlc_object_t *p_parent,
                 return false;
             char *psz_dialog_username = NULL;
             char *psz_dialog_password = NULL;
-
             va_list ap;
             va_start(ap, psz_dialog_fmt);
-            dialog_vaLogin(p_parent, p_credential->psz_username,
-                           &psz_dialog_username, &psz_dialog_password,
-                           p_credential->p_keystore ? &p_credential->b_store : NULL,
-                           psz_dialog_title, psz_dialog_fmt, ap);
+            bool *p_store = p_credential->p_keystore != NULL ?
+                            &p_credential->b_store : NULL;
+            int i_ret =
+                vlc_dialog_wait_login_va(p_parent,
+                                         &psz_dialog_username,
+                                         &psz_dialog_password, p_store,
+                                         p_credential->psz_username,
+                                         psz_dialog_title, psz_dialog_fmt, ap);
             va_end(ap);
 
-            /* Free previous dialog strings after dialog_vaLogin call since
-             * p_credential->psz_username (default username) can be a pointer
-             * to p_credential->psz_dialog_username */
+            /* Free previous dialog strings after vlc_dialog_wait_login_va call
+             * since p_credential->psz_username (default username) can be a
+             * pointer to p_credential->psz_dialog_username */
             free(p_credential->psz_dialog_username);
             free(p_credential->psz_dialog_password);
             p_credential->psz_dialog_username = psz_dialog_username;
             p_credential->psz_dialog_password = psz_dialog_password;
 
-            if (p_credential->psz_dialog_username
-             && p_credential->psz_dialog_password)
-            {
-                p_credential->psz_username = p_credential->psz_dialog_username;
-                p_credential->psz_password = p_credential->psz_dialog_password;
-
-                if (protocol_is_smb(p_url))
-                    smb_split_domain(p_credential);
-            }
-            else
+            if (i_ret != 1)
             {
                 p_credential->psz_username = p_credential->psz_password = NULL;
                 return false;
             }
+
+            p_credential->psz_username = p_credential->psz_dialog_username;
+            p_credential->psz_password = p_credential->psz_dialog_password;
+
+            if (protocol_is_smb(p_url))
+                smb_split_domain(p_credential);
+
             break;
         }
     }
index 1d7f765..a5f14e1 100644 (file)
 # define UPDATE_VLC_STATUS_URL "http://update.videolan.org/vlc/status" UPDATE_OS_SUFFIX
 #endif
 
+#define dialog_FatalWait( p_obj, psz_title, psz_fmt, ... ) \
+    vlc_dialog_wait_question( p_obj, VLC_DIALOG_QUESTION_CRITICAL, "OK", NULL, \
+                              NULL, psz_title, psz_fmt, ##__VA_ARGS__ );
+
 /*****************************************************************************
  * Update_t functions
  *****************************************************************************/
@@ -525,11 +529,11 @@ void update_Download( update_t *p_update, const char *psz_destdir )
 static void* update_DownloadReal( void *obj )
 {
     update_download_thread_t *p_udt = (update_download_thread_t *)obj;
-    dialog_progress_bar_t *p_progress = NULL;
+    int i_ret;
+    unsigned int i_dialog_id = 0;
     uint64_t l_size;
     uint64_t l_downloaded = 0;
     float f_progress;
-    char *psz_status;
     char *psz_downloaded = NULL;
     char *psz_size = NULL;
     char *psz_destfile = NULL;
@@ -589,20 +593,21 @@ static void* update_DownloadReal( void *obj )
     msg_Dbg( p_udt, "Downloading Stream '%s'", p_update->release.psz_url );
 
     psz_size = size_str( l_size );
-    if( asprintf( &psz_status, _("%s\nDownloading... %s/%s %.1f%% done"),
-        p_update->release.psz_url, "0.0", psz_size, 0.0 ) == -1 )
-        goto end;
 
-    p_progress = dialog_ProgressCreate( p_udt, _( "Downloading..."),
-                                        psz_status, _("Cancel") );
+    i_ret =
+        vlc_dialog_display_progress( p_udt, false, 0.0, _("Cancel"),
+                                     ( "Downloading..."),
+                                     _("%s\nDownloading... %s/%s %.1f%% done"),
+                                     p_update->release.psz_url, "0.0", psz_size,
+                                     0.0 );
 
-    free( psz_status );
-    if( p_progress == NULL )
+    if( i_ret <= 0 )
         goto end;
+    i_dialog_id = i_ret;
 
     while( !atomic_load( &p_udt->aborted ) &&
            ( i_read = stream_Read( p_stream, p_buffer, 1 << 10 ) ) &&
-           !dialog_ProgressCancelled( p_progress ) )
+           !vlc_dialog_cancelled( p_udt, i_dialog_id ) )
     {
         if( fwrite( p_buffer, i_read, 1, p_file ) < 1 )
         {
@@ -614,13 +619,11 @@ static void* update_DownloadReal( void *obj )
         psz_downloaded = size_str( l_downloaded );
         f_progress = (float)l_downloaded/(float)l_size;
 
-        if( asprintf( &psz_status, _( "%s\nDownloading... %s/%s - %.1f%% done" ),
-                      p_update->release.psz_url, psz_downloaded, psz_size,
-                      f_progress*100 ) != -1 )
-        {
-            dialog_ProgressSet( p_progress, psz_status, f_progress );
-            free( psz_status );
-        }
+        vlc_dialog_update_progress_text( p_udt, i_dialog_id, f_pos,
+                                         "%s\nDownloading... %s/%s - %.1f%% done",
+                                         p_update->release.psz_url,
+                                         psz_downloaded, psz_size,
+                                         f_progress*100 );
         free( psz_downloaded );
     }
 
@@ -629,10 +632,10 @@ static void* update_DownloadReal( void *obj )
     p_file = NULL;
 
     if( !atomic_load( &p_udt->aborted ) &&
-        !dialog_ProgressCancelled( p_progress ) )
+        !vlc_dialog_cancelled( p_udt, i_dialog_id ) )
     {
-        dialog_ProgressDestroy( p_progress );
-        p_progress = NULL;
+        vlc_dialog_cancel( p_udt, i_dialog_id );
+        i_dialog_id = 0;
     }
     else
     {
@@ -719,10 +722,13 @@ static void* update_DownloadReal( void *obj )
     free( p_hash );
 
 #ifdef _WIN32
-    int answer = dialog_Question( p_udt, _("Update VLC media player"),
-    _("The new version was successfully downloaded. Do you want to close VLC and install it now?"),
-    _("Install"), _("Cancel"), NULL);
-
+    static const char *psz_msg =
+        _("The new version was successfully downloaded."
+        "Do you want to close VLC and install it now?");
+    int answer = vlc_dialog_wait_question( p_udt, VLC_DIALOG_QUESTION_NORMAL,
+                                           _("Cancel"), _("Install"), NULL,
+                                           _("Update VLC media player"),
+                                           psz_msg );
     if(answer == 1)
     {
         wchar_t psz_wdestfile[MAX_PATH];
@@ -733,8 +739,8 @@ static void* update_DownloadReal( void *obj )
     }
 #endif
 end:
-    if( p_progress )
-        dialog_ProgressDestroy( p_progress );
+    if( i_dialog_id != 0 )
+        vlc_dialog_cancel( p_udt, i_dialog_id );
     if( p_stream )
         stream_Delete( p_stream );
     if( p_file )
index d7f4a2c..886d1e3 100644 (file)
@@ -47,18 +47,26 @@ static int tlspair(int fds[2])
     return vlc_socketpair(PF_LOCAL, SOCK_STREAM, 0, fds, true);
 }
 
-static int question_callback(vlc_object_t *obj, const char *varname,
-                             vlc_value_t old, vlc_value_t cur, void *data)
+static void
+dialog_display_question_cb(vlc_dialog_id *p_id, const char *psz_title,
+                           const char *psz_text, vlc_dialog_question_type i_type,
+                           const char *psz_cancel, const char *psz_action1,
+                           const char *psz_action2, void *p_data)
 {
-    dialog_question_t *q = cur.p_address;
-    int *value = data;
-
-    q->answer = *value;
+    (void) psz_title;
+    (void) psz_text;
+    (void) i_type;
+    (void) psz_cancel;
+    (void) psz_action1;
+    (void) psz_action2;
+    int *value = p_data;
+    vlc_dialog_id_post_action(p_id, *value);
+}
 
-    assert(obj == VLC_OBJECT(obj->p_libvlc));
-    assert(!strcmp(varname, "dialog-question"));
-    (void) old;
-    return VLC_SUCCESS;
+static void dialog_cancel_cb(vlc_dialog_id *id, void *data)
+{
+    (void)data;
+    vlc_dialog_id_dismiss(id);
 }
 
 static libvlc_instance_t *vlc;
@@ -172,9 +180,11 @@ int main(void)
     client_creds = vlc_tls_ClientCreate(obj);
     assert(client_creds != NULL);
 
-    var_Create(obj, "dialog-question", VLC_VAR_ADDRESS);
-    var_AddCallback(obj, "dialog-question", question_callback, &answer);
-    dialog_Register(obj);
+    vlc_dialog_cbs cbs = {
+        .pf_display_question = dialog_display_question_cb,
+        .pf_cancel = dialog_cancel_cb,
+    };
+    vlc_dialog_provider_set_callbacks(obj, &cbs, &answer);
 
     vlc_thread_t th;
     vlc_tls_t *tls;
@@ -188,7 +198,7 @@ int main(void)
     assert(val == -1);
 
     /* Accept unknown certificate */
-    answer = 2;
+    answer = 1;
     val = securepair(&th, &tls, alpnv, &alp);
     assert(val == 0);
     assert(alp != NULL);
@@ -269,8 +279,7 @@ int main(void)
     vlc_tls_Close(tls);
     vlc_join(th, NULL);
 
-    dialog_Unregister(obj);
-    var_DelCallback(obj, "dialog-question", question_callback, &answer);
+    vlc_dialog_provider_set_callbacks(obj, NULL, NULL);
     vlc_tls_Delete(client_creds);
     vlc_tls_Delete(server_creds);
     libvlc_release(vlc);