]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs_provider.cpp
Qt: add a new "Open URL" dialog
[vlc] / 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     vlc_object_kill( 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( 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( 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( toNativeSeparators( 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(
447                                      toNativeSeparators( url ) );
448         }
449     }
450 }
451
452 /* Directory */
453 /**
454  * Open a directory,
455  * pl helps you to choose from playlist or media library,
456  * go to start or enqueue
457  **/
458 static void openDirectory( intf_thread_t *p_intf, bool pl, bool go )
459 {
460     QString dir = QFileDialog::getExistingDirectory( NULL, qtr("Open Directory") );
461
462     if (!dir.isEmpty() )
463     {
464         QString mrl = dir.endsWith( "VIDEO_TS", Qt::CaseInsensitive ) ?
465             "dvd://" : "directory://" + toNativeSeparators( dir );
466         input_item_t *p_input = input_item_New( THEPL, qtu( mrl ), NULL );
467
468         /* FIXME: playlist_AddInput() can fail */
469         playlist_AddInput( THEPL, p_input,
470                        go ? ( PLAYLIST_APPEND | PLAYLIST_GO ) : PLAYLIST_APPEND,
471                        PLAYLIST_END, pl, pl_Unlocked );
472         RecentsMRL::getInstance( p_intf )->addRecent( mrl );
473         if( !go )
474             input_Read( THEPL, p_input, true );
475         vlc_gc_decref( p_input );
476     }
477 }
478
479 void DialogsProvider::PLOpenDir()
480 {
481     openDirectory( p_intf, true, true );
482 }
483
484 void DialogsProvider::PLAppendDir()
485 {
486     openDirectory( p_intf, true, false );
487 }
488
489 void DialogsProvider::MLAppendDir()
490 {
491     openDirectory( p_intf, false , false );
492 }
493
494 /****************
495  * Playlist     *
496  ****************/
497 void DialogsProvider::openAPlaylist()
498 {
499     QStringList files = showSimpleOpen( qtr( "Open playlist..." ),
500                                         EXT_FILTER_PLAYLIST );
501     foreach( QString file, files )
502     {
503         playlist_Import( THEPL, qtu( toNativeSeparators( file ) ) );
504     }
505 }
506
507 void DialogsProvider::saveAPlaylist()
508 {
509     QFileDialog *qfd = new QFileDialog( NULL,
510                                    qtr( "Save playlist as..." ),
511                                    qfu( p_intf->p_sys->psz_filepath ),
512                                    qtr( "XSPF playlist (*.xspf);; " ) +
513                                    qtr( "M3U playlist (*.m3u);; " ) +
514                                    qtr( "HTML playlist (*.html);;" ) +
515                                    qtr( "Any (*.*) " ) );
516     qfd->setFileMode( QFileDialog::AnyFile );
517     qfd->setAcceptMode( QFileDialog::AcceptSave );
518     qfd->setConfirmOverwrite( true );
519
520     if( qfd->exec() == QDialog::Accepted )
521     {
522         if( qfd->selectedFiles().count() > 0 )
523         {
524             static const char psz_xspf[] = "export-xspf",
525                               psz_m3u[] = "export-m3u",
526                               psz_html[] = "export-html";
527             const char *psz_module;
528
529             QString file = qfd->selectedFiles().first();
530             QString filter = qfd->selectedFilter();
531
532             if( file.contains( ".xsp" ) || filter.contains( "XSPF" ) )
533             {
534                 psz_module = psz_xspf;
535                 if( !file.contains( ".xsp" ) )
536                     file.append( ".xspf" );
537             }
538             else if( file.contains( ".m3u" )  || filter.contains( "M3U" ) )
539             {
540                 psz_module = psz_m3u;
541                 if( !file.contains( ".m3u" ) )
542                     file.append( ".m3u" );
543             }
544             else if( file.contains(".html" ) || filter.contains( "HTML" ) )
545             {
546                 psz_module = psz_html;
547                 if( !file.contains( "html" ) )
548                     file.append( ".html" );
549             }
550             else
551             {
552                 msg_Err( p_intf, "Impossible to recognise the file type" );
553                 delete qfd;
554                 return;
555             }
556
557             playlist_Export( THEPL, qtu( toNativeSeparators( file ) ),
558                         THEPL->p_local_category, psz_module);
559         }
560     }
561     delete qfd;
562 }
563
564 /****************************************************************************
565  * Sout emulation
566  ****************************************************************************/
567
568 void DialogsProvider::streamingDialog( QWidget *parent, QString mrl,
569                                        bool b_transcode_only )
570 {
571     SoutDialog *s = SoutDialog::getInstance( parent, p_intf, b_transcode_only );
572
573     if( s->exec() == QDialog::Accepted )
574     {
575         const char *psz_option = qtu( s->getMrl() );
576
577         msg_Dbg( p_intf, "Sout mrl %s", psz_option );
578         playlist_AddExt( THEPL, qtu( mrl ), "Streaming",
579                          PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END,
580                         -1, 1, &psz_option, VLC_INPUT_OPTION_TRUSTED, true, pl_Unlocked );
581         RecentsMRL::getInstance( p_intf )->addRecent( mrl );
582     }
583 }
584
585 void DialogsProvider::openAndStreamingDialogs()
586 {
587     OpenDialog::getInstance( p_intf->p_sys->p_mi, p_intf, false, OPEN_AND_STREAM )
588                                 ->showTab( OPEN_FILE_TAB );
589 }
590
591 void DialogsProvider::openAndTranscodingDialogs()
592 {
593     OpenDialog::getInstance( p_intf->p_sys->p_mi , p_intf, false, OPEN_AND_SAVE )
594                                 ->showTab( OPEN_FILE_TAB );
595 }
596
597 void DialogsProvider::loadSubtitlesFile()
598 {
599     input_thread_t *p_input = THEMIM->getInput();
600     if( !p_input ) return;
601
602     input_item_t *p_item = input_GetItem( p_input );
603     if( !p_item ) return;
604
605     char *path = input_item_GetURI( p_item );
606     if( !path ) path = strdup( "" );
607
608     char *sep = strrchr( path, DIR_SEP_CHAR );
609     if( sep ) *sep = '\0';
610
611     QStringList qsl = showSimpleOpen( qtr( "Open subtitles..." ),
612                                       EXT_FILTER_SUBTITLE,
613                                       path );
614     free( path );
615     QString qsFile;
616     foreach( qsFile, qsl )
617     {
618         if( input_AddSubtitle( p_input, qtu( toNativeSeparators( qsFile ) ),
619                     true ) )
620             msg_Warn( p_intf, "unable to load subtitles from '%s'",
621                       qtu( qsFile ) );
622     }
623 }
624
625
626 /****************************************************************************
627  * Menus
628  ****************************************************************************/
629
630 void DialogsProvider::menuAction( QObject *data )
631 {
632     QVLCMenu::DoAction( data );
633 }
634
635 void DialogsProvider::menuUpdateAction( QObject *data )
636 {
637     MenuFunc *func = qobject_cast<MenuFunc *>(data);
638     assert( func );
639     func->doFunc( p_intf );
640 }
641
642 void DialogsProvider::SDMenuAction( QString data )
643 {
644     const char *psz_sd = qtu( data );
645     if( !playlist_IsServicesDiscoveryLoaded( THEPL, psz_sd ) )
646         playlist_ServicesDiscoveryAdd( THEPL, psz_sd );
647     else
648         playlist_ServicesDiscoveryRemove( THEPL, psz_sd );
649 }
650
651 /**
652  * Play the MRL contained in the Recently played menu.
653  **/
654 void DialogsProvider::playMRL( const QString &mrl )
655 {
656     playlist_Add( THEPL, qtu( mrl ) , NULL,
657            PLAYLIST_APPEND | PLAYLIST_GO , PLAYLIST_END, true, false );
658
659     RecentsMRL::getInstance( p_intf )->addRecent( mrl );
660 }
661
662 /*************************************
663  * Interactions
664  *************************************/
665 void DialogsProvider::doInteraction( intf_dialog_args_t *p_arg )
666 {
667     InteractionDialog *qdialog;
668     interaction_dialog_t *p_dialog = p_arg->p_dialog;
669     switch( p_dialog->i_action )
670     {
671     case INTERACT_NEW:
672         qdialog = new InteractionDialog( p_intf, p_dialog );
673         p_dialog->p_private = (void*)qdialog;
674         if( !(p_dialog->i_status == ANSWERED_DIALOG) )
675             qdialog->show();
676         break;
677     case INTERACT_UPDATE:
678         qdialog = (InteractionDialog*)(p_dialog->p_private);
679         if( qdialog )
680             qdialog->update();
681         else
682         {
683             /* The INTERACT_NEW message was forgotten
684                so we must create the dialog and update it*/
685             qdialog = new InteractionDialog( p_intf, p_dialog );
686             p_dialog->p_private = (void*)qdialog;
687             if( !(p_dialog->i_status == ANSWERED_DIALOG) )
688                 qdialog->show();
689             if( qdialog )
690                 qdialog->update();
691         }
692         break;
693     case INTERACT_HIDE:
694         msg_Dbg( p_intf, "Hide the Interaction Dialog" );
695         qdialog = (InteractionDialog*)(p_dialog->p_private);
696         if( qdialog )
697             qdialog->hide();
698         p_dialog->i_status = HIDDEN_DIALOG;
699         break;
700     case INTERACT_DESTROY:
701         msg_Dbg( p_intf, "Destroy the Interaction Dialog" );
702         qdialog = (InteractionDialog*)(p_dialog->p_private);
703         if( !p_dialog->i_flags & DIALOG_NONBLOCKING_ERROR )
704             delete qdialog;
705         p_dialog->i_status = DESTROYED_DIALOG;
706         break;
707     }
708 }
709