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