i18n: Fix
[vlc.git] / modules / gui / qt4 / dialogs_provider.cpp
1 /*****************************************************************************
2  * dialogs_provider.cpp : Dialog Provider
3  *****************************************************************************
4  * Copyright (C) 2006-2008 the VideoLAN team
5  * $Id$
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
8  *          Jean-Baptiste Kempf <jb@videolan.org>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 #ifdef HAVE_CONFIG_H
26 # include "config.h"
27 #endif
28
29 #include <vlc_intf_strings.h>
30
31 #include "qt4.hpp"
32 #include "dialogs_provider.hpp"
33 #include "input_manager.hpp" /* Load Subtitles */
34 #include "menus.hpp"
35 #include "recents.hpp"
36 #include "util/qt_dirs.hpp"
37
38 /* The dialogs */
39 #include "dialogs/playlist.hpp"
40 #include "dialogs/bookmarks.hpp"
41 #include "dialogs/preferences.hpp"
42 #include "dialogs/mediainfo.hpp"
43 #include "dialogs/messages.hpp"
44 #include "dialogs/extended.hpp"
45 #include "dialogs/vlm.hpp"
46 #include "dialogs/sout.hpp"
47 #include "dialogs/open.hpp"
48 #include "dialogs/openurl.hpp"
49 #include "dialogs/help.hpp"
50 #include "dialogs/gototime.hpp"
51 #include "dialogs/podcast_configuration.hpp"
52 #include "dialogs/toolbar.hpp"
53 #include "dialogs/plugins.hpp"
54 #include "dialogs/interaction.hpp"
55
56 #include <QEvent>
57 #include <QApplication>
58 #include <QSignalMapper>
59 #include <QFileDialog>
60
61
62 DialogsProvider* DialogsProvider::instance = NULL;
63
64 DialogsProvider::DialogsProvider( intf_thread_t *_p_intf ) :
65                                   QObject( NULL ), p_intf( _p_intf )
66 {
67     b_isDying = false;
68
69     /* Various signal mappers for the menus */
70     menusMapper = new QSignalMapper();
71     CONNECT( menusMapper, mapped(QObject *), this, menuAction( QObject *) );
72
73     menusUpdateMapper = new QSignalMapper();
74     CONNECT( menusUpdateMapper, mapped(QObject *),
75              this, menuUpdateAction( QObject *) );
76
77     SDMapper = new QSignalMapper();
78     CONNECT( SDMapper, mapped (QString), this, SDMenuAction( QString ) );
79 }
80
81 DialogsProvider::~DialogsProvider()
82 {
83     msg_Dbg( p_intf, "Destroying the Dialog Provider" );
84     PlaylistDialog::killInstance();
85     MediaInfoDialog::killInstance();
86     MessagesDialog::killInstance();
87     ExtendedDialog::killInstance();
88     BookmarksDialog::killInstance();
89     HelpDialog::killInstance();
90 #ifdef UPDATE_CHECK
91     UpdateDialog::killInstance();
92 #endif
93
94     delete menusMapper;
95     delete menusUpdateMapper;
96     delete SDMapper;
97 }
98
99 void DialogsProvider::quit()
100 {
101     b_isDying = true;
102     libvlc_Quit( p_intf->p_libvlc );
103 }
104
105 void DialogsProvider::customEvent( QEvent *event )
106 {
107     if( event->type() == (int)DialogEvent_Type )
108     {
109         DialogEvent *de = static_cast<DialogEvent*>(event);
110         switch( de->i_dialog )
111         {
112         case INTF_DIALOG_FILE_SIMPLE:
113         case INTF_DIALOG_FILE:
114             openDialog(); break;
115         case INTF_DIALOG_FILE_GENERIC:
116             openFileGenericDialog( de->p_arg ); break;
117         case INTF_DIALOG_DISC:
118             openDiscDialog(); break;
119         case INTF_DIALOG_NET:
120             openNetDialog(); break;
121         case INTF_DIALOG_SAT:
122         case INTF_DIALOG_CAPTURE:
123             openCaptureDialog(); break;
124         case INTF_DIALOG_DIRECTORY:
125             PLAppendDir(); break;
126         case INTF_DIALOG_PLAYLIST:
127             playlistDialog(); break;
128         case INTF_DIALOG_MESSAGES:
129             messagesDialog(); break;
130         case INTF_DIALOG_FILEINFO:
131            mediaInfoDialog(); break;
132         case INTF_DIALOG_PREFS:
133            prefsDialog(); break;
134         case INTF_DIALOG_BOOKMARKS:
135            bookmarksDialog(); break;
136         case INTF_DIALOG_EXTENDED:
137            extendedDialog(); break;
138 #ifdef ENABLE_VLM
139         case INTF_DIALOG_VLM:
140            vlmDialog(); break;
141 #endif
142         case INTF_DIALOG_INTERACTION:
143            doInteraction( de->p_arg ); break;
144         case INTF_DIALOG_POPUPMENU:
145            QVLCMenu::PopupMenu( p_intf, (de->i_arg != 0) ); break;
146         case INTF_DIALOG_AUDIOPOPUPMENU:
147            QVLCMenu::AudioPopupMenu( p_intf ); break;
148         case INTF_DIALOG_VIDEOPOPUPMENU:
149            QVLCMenu::VideoPopupMenu( p_intf ); break;
150         case INTF_DIALOG_MISCPOPUPMENU:
151            QVLCMenu::MiscPopupMenu( p_intf ); break;
152         case INTF_DIALOG_WIZARD:
153         case INTF_DIALOG_STREAMWIZARD:
154             openAndStreamingDialogs(); break;
155 #ifdef UPDATE_CHECK
156         case INTF_DIALOG_UPDATEVLC:
157             updateDialog(); break;
158 #endif
159         case INTF_DIALOG_EXIT:
160             quit(); break;
161         default:
162            msg_Warn( p_intf, "unimplemented dialog" );
163         }
164     }
165 }
166
167 /****************************************************************************
168  * Individual simple dialogs
169  ****************************************************************************/
170 void DialogsProvider::playlistDialog()
171 {
172     PlaylistDialog::getInstance( p_intf )->toggleVisible();
173 }
174
175 void DialogsProvider::prefsDialog()
176 {
177     PrefsDialog::getInstance( p_intf )->toggleVisible();
178 }
179
180 void DialogsProvider::extendedDialog()
181 {
182     ExtendedDialog::getInstance( p_intf )->toggleVisible();
183 }
184
185 void DialogsProvider::messagesDialog()
186 {
187     MessagesDialog::getInstance( p_intf )->toggleVisible();
188 }
189
190 void DialogsProvider::gotoTimeDialog()
191 {
192     GotoTimeDialog::getInstance( p_intf )->toggleVisible();
193 }
194
195 #ifdef ENABLE_VLM
196 void DialogsProvider::vlmDialog()
197 {
198     VLMDialog::getInstance( p_intf )->toggleVisible();
199 }
200 #endif
201
202 void DialogsProvider::helpDialog()
203 {
204     HelpDialog::getInstance( p_intf )->toggleVisible();
205 }
206
207 #ifdef UPDATE_CHECK
208 void DialogsProvider::updateDialog()
209 {
210     UpdateDialog::getInstance( p_intf )->toggleVisible();
211 }
212 #endif
213
214 void DialogsProvider::aboutDialog()
215 {
216     AboutDialog::getInstance( p_intf )->toggleVisible();
217 }
218
219 void DialogsProvider::mediaInfoDialog()
220 {
221     MediaInfoDialog::getInstance( p_intf )->toggleVisible();
222 }
223
224 void DialogsProvider::mediaCodecDialog()
225 {
226     MediaInfoDialog::getInstance( p_intf )->showTab( 2 );
227 }
228
229 void DialogsProvider::bookmarksDialog()
230 {
231     BookmarksDialog::getInstance( p_intf )->toggleVisible();
232 }
233
234 void DialogsProvider::podcastConfigureDialog()
235 {
236     PodcastConfigDialog::getInstance( p_intf )->toggleVisible();
237 }
238
239 void DialogsProvider::toolbarDialog()
240 {
241     ToolbarEditDialog::getInstance( p_intf )->toggleVisible();
242 }
243
244 void DialogsProvider::pluginDialog()
245 {
246     PluginDialog *diag = new PluginDialog( p_intf );
247     diag->show();
248 }
249
250 /* Generic open file */
251 void DialogsProvider::openFileGenericDialog( intf_dialog_args_t *p_arg )
252 {
253     if( p_arg == NULL )
254     {
255         msg_Warn( p_intf, "openFileGenericDialog() called with NULL arg" );
256         return;
257     }
258
259     /* Replace the extensions to a Qt format */
260     int i = 0;
261     QString extensions = qfu( p_arg->psz_extensions );
262     while ( ( i = extensions.indexOf( "|", i ) ) != -1 )
263     {
264         if( ( extensions.count( "|" ) % 2 ) == 0 )
265             extensions.replace( i, 1, ");;" );
266         else
267             extensions.replace( i, 1, "(" );
268     }
269     extensions.replace(QString(";*"), QString(" *"));
270     extensions.append( ")" );
271
272     /* Save */
273     if( p_arg->b_save )
274     {
275         QString file = QFileDialog::getSaveFileName( NULL, p_arg->psz_title,
276                             qfu( p_intf->p_sys->psz_filepath ), extensions );
277         if( !file.isEmpty() )
278         {
279             p_arg->i_results = 1;
280             p_arg->psz_results = (char **)malloc( p_arg->i_results * sizeof( char * ) );
281             p_arg->psz_results[0] = strdup( qtu( toNativeSepNoSlash( file ) ) );
282         }
283         else
284             p_arg->i_results = 0;
285     }
286     else /* non-save mode */
287     {
288         QStringList files = QFileDialog::getOpenFileNames( NULL,
289                 p_arg->psz_title, qfu( p_intf->p_sys->psz_filepath ),
290                 extensions );
291         p_arg->i_results = files.count();
292         p_arg->psz_results = (char **)malloc( p_arg->i_results * sizeof( char * ) );
293         i = 0;
294         foreach( const QString &file, files )
295             p_arg->psz_results[i++] = strdup( qtu( toNativeSepNoSlash( file ) ) );
296     }
297
298     /* Callback */
299     if( p_arg->pf_callback )
300         p_arg->pf_callback( p_arg );
301
302     /* Clean afterwards */
303     if( p_arg->psz_results )
304     {
305         for( i = 0; i < p_arg->i_results; i++ )
306             free( p_arg->psz_results[i] );
307         free( p_arg->psz_results );
308     }
309     free( p_arg->psz_title );
310     free( p_arg->psz_extensions );
311     free( p_arg );
312 }
313 /****************************************************************************
314  * All the open/add stuff
315  * Open Dialog first - Simple Open then
316  ****************************************************************************/
317
318 void DialogsProvider::openDialog( int i_tab )
319 {
320     OpenDialog::getInstance( p_intf->p_sys->p_mi , p_intf )->showTab( i_tab );
321 }
322 void DialogsProvider::openDialog()
323 {
324     openDialog( OPEN_FILE_TAB );
325 }
326 void DialogsProvider::openFileDialog()
327 {
328     openDialog( OPEN_FILE_TAB );
329 }
330 void DialogsProvider::openDiscDialog()
331 {
332     openDialog( OPEN_DISC_TAB );
333 }
334 void DialogsProvider::openNetDialog()
335 {
336     openDialog( OPEN_NETWORK_TAB );
337 }
338 void DialogsProvider::openCaptureDialog()
339 {
340     openDialog( OPEN_CAPTURE_TAB );
341 }
342
343 /* Same as the open one, but force the enqueue */
344 void DialogsProvider::PLAppendDialog()
345 {
346     OpenDialog::getInstance( p_intf->p_sys->p_mi, p_intf, false,
347                              OPEN_AND_ENQUEUE )->showTab( OPEN_FILE_TAB );
348 }
349
350 void DialogsProvider::MLAppendDialog()
351 {
352     OpenDialog::getInstance( p_intf->p_sys->p_mi, p_intf, false,
353                             OPEN_AND_ENQUEUE, false, false )
354                                     ->showTab( OPEN_FILE_TAB );
355 }
356
357 /**
358  * Simple open
359  ***/
360 QStringList DialogsProvider::showSimpleOpen( QString help,
361                                              int filters,
362                                              QString path )
363 {
364     QString fileTypes = "";
365     if( filters & EXT_FILTER_MEDIA ) {
366         ADD_FILTER_MEDIA( fileTypes );
367     }
368     if( filters & EXT_FILTER_VIDEO ) {
369         ADD_FILTER_VIDEO( fileTypes );
370     }
371     if( filters & EXT_FILTER_AUDIO ) {
372         ADD_FILTER_AUDIO( fileTypes );
373     }
374     if( filters & EXT_FILTER_PLAYLIST ) {
375         ADD_FILTER_PLAYLIST( fileTypes );
376     }
377     if( filters & EXT_FILTER_SUBTITLE ) {
378         ADD_FILTER_SUBTITLE( fileTypes );
379     }
380     ADD_FILTER_ALL( fileTypes );
381     fileTypes.replace(QString(";*"), QString(" *"));
382
383     return QFileDialog::getOpenFileNames( NULL,
384         help.isEmpty() ? qtr(I_OP_SEL_FILES ) : help,
385         path.isEmpty() ? qfu( p_intf->p_sys->psz_filepath ) : path,
386         fileTypes );
387 }
388
389 /**
390  * Open a file,
391  * pl helps you to choose from playlist or media library,
392  * go to start or enqueue
393  **/
394 void DialogsProvider::addFromSimple( bool pl, bool go)
395 {
396     QStringList files = DialogsProvider::showSimpleOpen();
397     int i = 0;
398     foreach( const QString &file, files )
399     {
400         playlist_Add( THEPL, qtu( toNativeSeparators( file ) ), NULL,
401                       go ? ( PLAYLIST_APPEND | ( i ? 0 : PLAYLIST_GO ) |
402                                                ( i ? PLAYLIST_PREPARSE : 0 ) )
403                          : ( PLAYLIST_APPEND | PLAYLIST_PREPARSE ),
404                       PLAYLIST_END,
405                       pl ? true : false, false );
406         RecentsMRL::getInstance( p_intf )->addRecent(
407                 toNativeSeparators( file ) );
408         i++;
409     }
410 }
411
412 void DialogsProvider::simpleOpenDialog()
413 {
414     addFromSimple( true, true ); /* Playlist and Go */
415 }
416
417 void DialogsProvider::simplePLAppendDialog()
418 {
419     addFromSimple( true, false );
420 }
421
422 void DialogsProvider::simpleMLAppendDialog()
423 {
424     addFromSimple( false, false );
425 }
426
427 /* Url & Clipboard */
428 /**
429  * Open a MRL.
430  * If the clipboard contains URLs, the first is automatically 'preselected'.
431  **/
432 void DialogsProvider::openUrlDialog()
433 {
434     OpenUrlDialog *oud = OpenUrlDialog::getInstance( p_intf->p_sys->p_mi,
435                                                      p_intf );
436     if( oud->exec() == QDialog::Accepted )
437     {
438         QString url = oud->url();
439         if( !url.isEmpty() )
440         {
441             playlist_Add( THEPL, qtu( url ),
442                           NULL, !oud->shouldEnqueue() ?
443                                   ( PLAYLIST_APPEND | PLAYLIST_GO )
444                                 : ( PLAYLIST_APPEND | PLAYLIST_PREPARSE ),
445                           PLAYLIST_END, true, false );
446             RecentsMRL::getInstance( p_intf )->addRecent( url );
447         }
448     }
449 }
450
451 /* Directory */
452 /**
453  * Open a directory,
454  * pl helps you to choose from playlist or media library,
455  * go to start or enqueue
456  **/
457 static void openDirectory( intf_thread_t *p_intf, bool pl, bool go )
458 {
459     QString dir = QFileDialog::getExistingDirectory( NULL, qtr("Open Directory") );
460
461     if (!dir.isEmpty() )
462     {
463         QString mrl = dir.endsWith( "VIDEO_TS", Qt::CaseInsensitive ) ?
464             "dvd://" : "directory://" + toNativeSeparators( dir );
465         input_item_t *p_input = input_item_New( THEPL, qtu( mrl ), NULL );
466
467         /* FIXME: playlist_AddInput() can fail */
468         playlist_AddInput( THEPL, p_input,
469                        go ? ( PLAYLIST_APPEND | PLAYLIST_GO ) : PLAYLIST_APPEND,
470                        PLAYLIST_END, pl, pl_Unlocked );
471         RecentsMRL::getInstance( p_intf )->addRecent( mrl );
472         if( !go )
473             input_Read( THEPL, p_input, true );
474         vlc_gc_decref( p_input );
475     }
476 }
477
478 void DialogsProvider::PLOpenDir()
479 {
480     openDirectory( p_intf, true, true );
481 }
482
483 void DialogsProvider::PLAppendDir()
484 {
485     openDirectory( p_intf, true, false );
486 }
487
488 void DialogsProvider::MLAppendDir()
489 {
490     openDirectory( p_intf, false , false );
491 }
492
493 /****************
494  * Playlist     *
495  ****************/
496 void DialogsProvider::openAPlaylist()
497 {
498     QStringList files = showSimpleOpen( qtr( "Open playlist..." ),
499                                         EXT_FILTER_PLAYLIST );
500     foreach( const QString &file, files )
501     {
502         playlist_Import( THEPL, qtu( toNativeSeparators( file ) ) );
503     }
504 }
505
506 void DialogsProvider::saveAPlaylist()
507 {
508     QFileDialog *qfd = new QFileDialog( NULL,
509                                    qtr( "Save playlist as..." ),
510                                    qfu( p_intf->p_sys->psz_filepath ),
511                                    qtr( "XSPF playlist (*.xspf);; " ) +
512                                    qtr( "M3U playlist (*.m3u);; " ) +
513                                    qtr( "HTML playlist (*.html)" ) );
514     qfd->setFileMode( QFileDialog::AnyFile );
515     qfd->setAcceptMode( QFileDialog::AcceptSave );
516     qfd->setConfirmOverwrite( true );
517
518     if( qfd->exec() == QDialog::Accepted )
519     {
520         if( qfd->selectedFiles().count() > 0 )
521         {
522             static const char psz_xspf[] = "export-xspf",
523                               psz_m3u[] = "export-m3u",
524                               psz_html[] = "export-html";
525             const char *psz_module;
526
527             QString file = qfd->selectedFiles().first();
528             QString filter = qfd->selectedFilter();
529
530             if( file.contains( ".xsp" ) || filter.contains( "XSPF" ) )
531             {
532                 psz_module = psz_xspf;
533                 if( !file.contains( ".xsp" ) )
534                     file.append( ".xspf" );
535             }
536             else if( file.contains( ".m3u" )  || filter.contains( "M3U" ) )
537             {
538                 psz_module = psz_m3u;
539                 if( !file.contains( ".m3u" ) )
540                     file.append( ".m3u" );
541             }
542             else if( file.contains(".html" ) || filter.contains( "HTML" ) )
543             {
544                 psz_module = psz_html;
545                 if( !file.contains( "html" ) )
546                     file.append( ".html" );
547             }
548             else
549             {
550                 msg_Err( p_intf, "Impossible to recognise the file type" );
551                 delete qfd;
552                 return;
553             }
554
555             playlist_Export( THEPL, qtu( toNativeSeparators( file ) ),
556                         THEPL->p_local_category, psz_module);
557         }
558     }
559     delete qfd;
560 }
561
562 /****************************************************************************
563  * Sout emulation
564  ****************************************************************************/
565
566 void DialogsProvider::streamingDialog( QWidget *parent, QString mrl,
567                                        bool b_transcode_only )
568 {
569     SoutDialog *s = SoutDialog::getInstance( parent, p_intf, b_transcode_only );
570
571     if( s->exec() == QDialog::Accepted )
572     {
573         const char *psz_option = qtu( s->getMrl() );
574
575         msg_Dbg( p_intf, "Sout mrl %s", psz_option );
576         playlist_AddExt( THEPL, qtu( mrl ), _("Streaming"),
577                          PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END,
578                         -1, 1, &psz_option, VLC_INPUT_OPTION_TRUSTED, true, pl_Unlocked );
579         RecentsMRL::getInstance( p_intf )->addRecent( mrl );
580     }
581 }
582
583 void DialogsProvider::openAndStreamingDialogs()
584 {
585     OpenDialog::getInstance( p_intf->p_sys->p_mi, p_intf, false, OPEN_AND_STREAM )
586                                 ->showTab( OPEN_FILE_TAB );
587 }
588
589 void DialogsProvider::openAndTranscodingDialogs()
590 {
591     OpenDialog::getInstance( p_intf->p_sys->p_mi , p_intf, false, OPEN_AND_SAVE )
592                                 ->showTab( OPEN_FILE_TAB );
593 }
594
595 void DialogsProvider::loadSubtitlesFile()
596 {
597     input_thread_t *p_input = THEMIM->getInput();
598     if( !p_input ) return;
599
600     input_item_t *p_item = input_GetItem( p_input );
601     if( !p_item ) return;
602
603     char *path = input_item_GetURI( p_item );
604     if( !path ) path = strdup( "" );
605
606     char *sep = strrchr( path, DIR_SEP_CHAR );
607     if( sep ) *sep = '\0';
608
609     QStringList qsl = showSimpleOpen( qtr( "Open subtitles..." ),
610                                       EXT_FILTER_SUBTITLE,
611                                       path );
612     free( path );
613     foreach( const QString &qsFile, qsl )
614     {
615         if( input_AddSubtitle( p_input, qtu( toNativeSeparators( qsFile ) ),
616                     true ) )
617             msg_Warn( p_intf, "unable to load subtitles from '%s'",
618                       qtu( qsFile ) );
619     }
620 }
621
622
623 /****************************************************************************
624  * Menus
625  ****************************************************************************/
626
627 void DialogsProvider::menuAction( QObject *data )
628 {
629     QVLCMenu::DoAction( data );
630 }
631
632 void DialogsProvider::menuUpdateAction( QObject *data )
633 {
634     MenuFunc *func = qobject_cast<MenuFunc *>(data);
635     assert( func );
636     func->doFunc( p_intf );
637 }
638
639 void DialogsProvider::SDMenuAction( QString data )
640 {
641     char *psz_sd = strdup( qtu( data ) );
642     if( !playlist_IsServicesDiscoveryLoaded( THEPL, psz_sd ) )
643         playlist_ServicesDiscoveryAdd( THEPL, psz_sd );
644     else
645         playlist_ServicesDiscoveryRemove( THEPL, psz_sd );
646     free( psz_sd );
647 }
648
649 /**
650  * Play the MRL contained in the Recently played menu.
651  **/
652 void DialogsProvider::playMRL( const QString &mrl )
653 {
654     playlist_Add( THEPL, qtu( mrl ) , NULL,
655            PLAYLIST_APPEND | PLAYLIST_GO , PLAYLIST_END, true, false );
656
657     RecentsMRL::getInstance( p_intf )->addRecent( mrl );
658 }
659
660 /*************************************
661  * Interactions
662  *************************************/
663 void DialogsProvider::doInteraction( intf_dialog_args_t *p_arg )
664 {
665     InteractionDialog *qdialog;
666     interaction_dialog_t *p_dialog = p_arg->p_dialog;
667     switch( p_dialog->i_action )
668     {
669     case INTERACT_NEW:
670         qdialog = new InteractionDialog( p_intf, p_dialog );
671         p_dialog->p_private = (void*)qdialog;
672         if( !(p_dialog->i_status == ANSWERED_DIALOG) )
673             qdialog->show();
674         break;
675     case INTERACT_UPDATE:
676         qdialog = (InteractionDialog*)(p_dialog->p_private);
677         if( qdialog )
678             qdialog->update();
679         else
680         {
681             /* The INTERACT_NEW message was forgotten
682                so we must create the dialog and update it*/
683             qdialog = new InteractionDialog( p_intf, p_dialog );
684             p_dialog->p_private = (void*)qdialog;
685             if( !(p_dialog->i_status == ANSWERED_DIALOG) )
686                 qdialog->show();
687             if( qdialog )
688                 qdialog->update();
689         }
690         break;
691     case INTERACT_HIDE:
692         msg_Dbg( p_intf, "Hide the Interaction Dialog" );
693         qdialog = (InteractionDialog*)(p_dialog->p_private);
694         if( qdialog )
695             qdialog->hide();
696         p_dialog->i_status = HIDDEN_DIALOG;
697         break;
698     case INTERACT_DESTROY:
699         msg_Dbg( p_intf, "Destroy the Interaction Dialog" );
700         qdialog = (InteractionDialog*)(p_dialog->p_private);
701         if( !p_dialog->i_flags & DIALOG_NONBLOCKING_ERROR )
702             delete qdialog;
703         p_dialog->i_status = DESTROYED_DIALOG;
704         break;
705     }
706 }
707