]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs_provider.cpp
Qt: remove dead code in sout to simplify.
[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::messagesDialog()
187 {
188     MessagesDialog::getInstance( p_intf )->toggleVisible();
189 }
190
191 void DialogsProvider::gotoTimeDialog()
192 {
193     GotoTimeDialog::getInstance( p_intf )->toggleVisible();
194 }
195
196 #ifdef ENABLE_VLM
197 void DialogsProvider::vlmDialog()
198 {
199     VLMDialog::getInstance( p_intf )->toggleVisible();
200 }
201 #endif
202
203 void DialogsProvider::helpDialog()
204 {
205     HelpDialog::getInstance( p_intf )->toggleVisible();
206 }
207
208 #ifdef UPDATE_CHECK
209 void DialogsProvider::updateDialog()
210 {
211     UpdateDialog::getInstance( p_intf )->toggleVisible();
212 }
213 #endif
214
215 void DialogsProvider::aboutDialog()
216 {
217     AboutDialog::getInstance( p_intf )->toggleVisible();
218 }
219
220 void DialogsProvider::mediaInfoDialog()
221 {
222     MediaInfoDialog::getInstance( p_intf )->toggleVisible();
223 }
224
225 void DialogsProvider::mediaCodecDialog()
226 {
227     MediaInfoDialog::getInstance( p_intf )->showTab( 2 );
228 }
229
230 void DialogsProvider::bookmarksDialog()
231 {
232     BookmarksDialog::getInstance( p_intf )->toggleVisible();
233 }
234
235 void DialogsProvider::podcastConfigureDialog()
236 {
237     PodcastConfigDialog::getInstance( p_intf )->toggleVisible();
238 }
239
240 void DialogsProvider::toolbarDialog()
241 {
242     ToolbarEditDialog::getInstance( p_intf )->toggleVisible();
243 }
244
245 void DialogsProvider::pluginDialog()
246 {
247     PluginDialog *diag = new PluginDialog( p_intf );
248     diag->show();
249 }
250
251 /* Generic open file */
252 void DialogsProvider::openFileGenericDialog( intf_dialog_args_t *p_arg )
253 {
254     if( p_arg == NULL )
255     {
256         msg_Warn( p_intf, "openFileGenericDialog() called with NULL arg" );
257         return;
258     }
259
260     /* Replace the extensions to a Qt format */
261     int i = 0;
262     QString extensions = qfu( p_arg->psz_extensions );
263     while ( ( i = extensions.indexOf( "|", i ) ) != -1 )
264     {
265         if( ( extensions.count( "|" ) % 2 ) == 0 )
266             extensions.replace( i, 1, ");;" );
267         else
268             extensions.replace( i, 1, "(" );
269     }
270     extensions.replace(QString(";*"), QString(" *"));
271     extensions.append( ")" );
272
273     /* Save */
274     if( p_arg->b_save )
275     {
276         QString file = QFileDialog::getSaveFileName( NULL, p_arg->psz_title,
277                             qfu( p_intf->p_sys->psz_filepath ), extensions );
278         if( !file.isEmpty() )
279         {
280             p_arg->i_results = 1;
281             p_arg->psz_results = (char **)malloc( p_arg->i_results * sizeof( char * ) );
282             p_arg->psz_results[0] = strdup( qtu( toNativeSepNoSlash( file ) ) );
283         }
284         else
285             p_arg->i_results = 0;
286     }
287     else /* non-save mode */
288     {
289         QStringList files = QFileDialog::getOpenFileNames( NULL,
290                 p_arg->psz_title, qfu( p_intf->p_sys->psz_filepath ),
291                 extensions );
292         p_arg->i_results = files.count();
293         p_arg->psz_results = (char **)malloc( p_arg->i_results * sizeof( char * ) );
294         i = 0;
295         foreach( const QString &file, files )
296             p_arg->psz_results[i++] = strdup( qtu( toNativeSepNoSlash( file ) ) );
297     }
298
299     /* Callback */
300     if( p_arg->pf_callback )
301         p_arg->pf_callback( p_arg );
302
303     /* Clean afterwards */
304     if( p_arg->psz_results )
305     {
306         for( i = 0; i < p_arg->i_results; i++ )
307             free( p_arg->psz_results[i] );
308         free( p_arg->psz_results );
309     }
310     free( p_arg->psz_title );
311     free( p_arg->psz_extensions );
312     free( p_arg );
313 }
314 /****************************************************************************
315  * All the open/add stuff
316  * Open Dialog first - Simple Open then
317  ****************************************************************************/
318
319 void DialogsProvider::openDialog( int i_tab )
320 {
321     OpenDialog::getInstance( p_intf->p_sys->p_mi , p_intf )->showTab( i_tab );
322 }
323 void DialogsProvider::openDialog()
324 {
325     openDialog( OPEN_FILE_TAB );
326 }
327 void DialogsProvider::openFileDialog()
328 {
329     openDialog( OPEN_FILE_TAB );
330 }
331 void DialogsProvider::openDiscDialog()
332 {
333     openDialog( OPEN_DISC_TAB );
334 }
335 void DialogsProvider::openNetDialog()
336 {
337     openDialog( OPEN_NETWORK_TAB );
338 }
339 void DialogsProvider::openCaptureDialog()
340 {
341     openDialog( OPEN_CAPTURE_TAB );
342 }
343
344 /* Same as the open one, but force the enqueue */
345 void DialogsProvider::PLAppendDialog()
346 {
347     OpenDialog::getInstance( p_intf->p_sys->p_mi, p_intf, false,
348                              OPEN_AND_ENQUEUE )->showTab( OPEN_FILE_TAB );
349 }
350
351 void DialogsProvider::MLAppendDialog()
352 {
353     OpenDialog::getInstance( p_intf->p_sys->p_mi, p_intf, false,
354                             OPEN_AND_ENQUEUE, false, false )
355                                     ->showTab( OPEN_FILE_TAB );
356 }
357
358 /**
359  * Simple open
360  ***/
361 QStringList DialogsProvider::showSimpleOpen( QString help,
362                                              int filters,
363                                              QString path )
364 {
365     QString fileTypes = "";
366     if( filters & EXT_FILTER_MEDIA ) {
367         ADD_FILTER_MEDIA( fileTypes );
368     }
369     if( filters & EXT_FILTER_VIDEO ) {
370         ADD_FILTER_VIDEO( fileTypes );
371     }
372     if( filters & EXT_FILTER_AUDIO ) {
373         ADD_FILTER_AUDIO( fileTypes );
374     }
375     if( filters & EXT_FILTER_PLAYLIST ) {
376         ADD_FILTER_PLAYLIST( fileTypes );
377     }
378     if( filters & EXT_FILTER_SUBTITLE ) {
379         ADD_FILTER_SUBTITLE( fileTypes );
380     }
381     ADD_FILTER_ALL( fileTypes );
382     fileTypes.replace(QString(";*"), QString(" *"));
383
384     return QFileDialog::getOpenFileNames( NULL,
385         help.isEmpty() ? qtr(I_OP_SEL_FILES ) : help,
386         path.isEmpty() ? qfu( p_intf->p_sys->psz_filepath ) : path,
387         fileTypes );
388 }
389
390 /**
391  * Open a file,
392  * pl helps you to choose from playlist or media library,
393  * go to start or enqueue
394  **/
395 void DialogsProvider::addFromSimple( bool pl, bool go)
396 {
397     QStringList files = DialogsProvider::showSimpleOpen();
398     int i = 0;
399     foreach( const QString &file, files )
400     {
401         playlist_Add( THEPL, qtu( toNativeSeparators( file ) ), NULL,
402                       go ? ( PLAYLIST_APPEND | ( i ? 0 : PLAYLIST_GO ) |
403                                                ( i ? PLAYLIST_PREPARSE : 0 ) )
404                          : ( PLAYLIST_APPEND | PLAYLIST_PREPARSE ),
405                       PLAYLIST_END,
406                       pl ? true : false, false );
407         RecentsMRL::getInstance( p_intf )->addRecent(
408                 toNativeSeparators( file ) );
409         i++;
410     }
411 }
412
413 void DialogsProvider::simpleOpenDialog()
414 {
415     addFromSimple( true, true ); /* Playlist and Go */
416 }
417
418 void DialogsProvider::simplePLAppendDialog()
419 {
420     addFromSimple( true, false );
421 }
422
423 void DialogsProvider::simpleMLAppendDialog()
424 {
425     addFromSimple( false, false );
426 }
427
428 /* Url & Clipboard */
429 /**
430  * Open a MRL.
431  * If the clipboard contains URLs, the first is automatically 'preselected'.
432  **/
433 void DialogsProvider::openUrlDialog()
434 {
435     OpenUrlDialog *oud = OpenUrlDialog::getInstance( p_intf->p_sys->p_mi,
436                                                      p_intf );
437     if( oud->exec() == QDialog::Accepted )
438     {
439         QString url = oud->url();
440         if( !url.isEmpty() )
441         {
442             playlist_Add( THEPL, qtu( url ),
443                           NULL, !oud->shouldEnqueue() ?
444                                   ( PLAYLIST_APPEND | PLAYLIST_GO )
445                                 : ( PLAYLIST_APPEND | PLAYLIST_PREPARSE ),
446                           PLAYLIST_END, true, false );
447             RecentsMRL::getInstance( p_intf )->addRecent( 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( const 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     qfd->setFileMode( QFileDialog::AnyFile );
516     qfd->setAcceptMode( QFileDialog::AcceptSave );
517     qfd->setConfirmOverwrite( true );
518
519     if( qfd->exec() == QDialog::Accepted )
520     {
521         if( qfd->selectedFiles().count() > 0 )
522         {
523             static const char psz_xspf[] = "export-xspf",
524                               psz_m3u[] = "export-m3u",
525                               psz_html[] = "export-html";
526             const char *psz_module;
527
528             QString file = qfd->selectedFiles().first();
529             QString filter = qfd->selectedFilter();
530
531             if( file.contains( ".xsp" ) || filter.contains( "XSPF" ) )
532             {
533                 psz_module = psz_xspf;
534                 if( !file.contains( ".xsp" ) )
535                     file.append( ".xspf" );
536             }
537             else if( file.contains( ".m3u" )  || filter.contains( "M3U" ) )
538             {
539                 psz_module = psz_m3u;
540                 if( !file.contains( ".m3u" ) )
541                     file.append( ".m3u" );
542             }
543             else if( file.contains(".html" ) || filter.contains( "HTML" ) )
544             {
545                 psz_module = psz_html;
546                 if( !file.contains( "html" ) )
547                     file.append( ".html" );
548             }
549             else
550             {
551                 msg_Err( p_intf, "Impossible to recognise the file type" );
552                 delete qfd;
553                 return;
554             }
555
556             playlist_Export( THEPL, qtu( toNativeSeparators( file ) ),
557                         THEPL->p_local_category, psz_module);
558         }
559     }
560     delete qfd;
561 }
562
563 /****************************************************************************
564  * Sout emulation
565  ****************************************************************************/
566
567 void DialogsProvider::streamingDialog( QWidget *parent, QString mrl,
568                                        bool b_transcode_only )
569 {
570     const char *psz_option;
571     if( !b_transcode_only )
572     {
573         SoutDialog *s = SoutDialog::getInstance( parent, p_intf );
574         if( s->exec() == QDialog::Accepted )
575             psz_option = qtu( s->getMrl() );
576     }else {
577         ConvertDialog *s = new ConvertDialog( parent, p_intf );
578         if( s->exec() == QDialog::Accepted )
579             psz_option = qtu( s->getMrl() );
580     }
581
582
583     if( !EMPTY_STR( psz_option ) )
584     {
585
586         msg_Dbg( p_intf, "Sout mrl %s", psz_option );
587         playlist_AddExt( THEPL, qtu( mrl ), _("Streaming"),
588                          PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END,
589                         -1, 1, &psz_option, VLC_INPUT_OPTION_TRUSTED, true, pl_Unlocked );
590         RecentsMRL::getInstance( p_intf )->addRecent( mrl );
591     }
592 }
593
594 void DialogsProvider::openAndStreamingDialogs()
595 {
596     OpenDialog::getInstance( p_intf->p_sys->p_mi, p_intf, false, OPEN_AND_STREAM )
597                                 ->showTab( OPEN_FILE_TAB );
598 }
599
600 void DialogsProvider::openAndTranscodingDialogs()
601 {
602     OpenDialog::getInstance( p_intf->p_sys->p_mi , p_intf, false, OPEN_AND_SAVE )
603                                 ->showTab( OPEN_FILE_TAB );
604 }
605
606 void DialogsProvider::loadSubtitlesFile()
607 {
608     input_thread_t *p_input = THEMIM->getInput();
609     if( !p_input ) return;
610
611     input_item_t *p_item = input_GetItem( p_input );
612     if( !p_item ) return;
613
614     char *path = input_item_GetURI( p_item );
615     if( !path ) path = strdup( "" );
616
617     char *sep = strrchr( path, DIR_SEP_CHAR );
618     if( sep ) *sep = '\0';
619
620     QStringList qsl = showSimpleOpen( qtr( "Open subtitles..." ),
621                                       EXT_FILTER_SUBTITLE,
622                                       path );
623     free( path );
624     foreach( const QString &qsFile, qsl )
625     {
626         if( input_AddSubtitle( p_input, qtu( toNativeSeparators( qsFile ) ),
627                     true ) )
628             msg_Warn( p_intf, "unable to load subtitles from '%s'",
629                       qtu( qsFile ) );
630     }
631 }
632
633
634 /****************************************************************************
635  * Menus
636  ****************************************************************************/
637
638 void DialogsProvider::menuAction( QObject *data )
639 {
640     QVLCMenu::DoAction( data );
641 }
642
643 void DialogsProvider::menuUpdateAction( QObject *data )
644 {
645     MenuFunc *func = qobject_cast<MenuFunc *>(data);
646     assert( func );
647     func->doFunc( p_intf );
648 }
649
650 void DialogsProvider::SDMenuAction( QString data )
651 {
652     char *psz_sd = strdup( qtu( data ) );
653     if( !playlist_IsServicesDiscoveryLoaded( THEPL, psz_sd ) )
654         playlist_ServicesDiscoveryAdd( THEPL, psz_sd );
655     else
656         playlist_ServicesDiscoveryRemove( THEPL, psz_sd );
657     free( psz_sd );
658 }
659
660 /**
661  * Play the MRL contained in the Recently played menu.
662  **/
663 void DialogsProvider::playMRL( const QString &mrl )
664 {
665     playlist_Add( THEPL, qtu( mrl ) , NULL,
666            PLAYLIST_APPEND | PLAYLIST_GO , PLAYLIST_END, true, false );
667
668     RecentsMRL::getInstance( p_intf )->addRecent( mrl );
669 }
670
671 /*************************************
672  * Interactions
673  *************************************/
674 void DialogsProvider::doInteraction( intf_dialog_args_t *p_arg )
675 {
676     InteractionDialog *qdialog;
677     interaction_dialog_t *p_dialog = p_arg->p_dialog;
678     switch( p_dialog->i_action )
679     {
680     case INTERACT_NEW:
681         qdialog = new InteractionDialog( p_intf, p_dialog );
682         p_dialog->p_private = (void*)qdialog;
683         if( !(p_dialog->i_status == ANSWERED_DIALOG) )
684             qdialog->show();
685         break;
686     case INTERACT_UPDATE:
687         qdialog = (InteractionDialog*)(p_dialog->p_private);
688         if( qdialog )
689             qdialog->update();
690         else
691         {
692             /* The INTERACT_NEW message was forgotten
693                so we must create the dialog and update it*/
694             qdialog = new InteractionDialog( p_intf, p_dialog );
695             p_dialog->p_private = (void*)qdialog;
696             if( !(p_dialog->i_status == ANSWERED_DIALOG) )
697                 qdialog->show();
698             if( qdialog )
699                 qdialog->update();
700         }
701         break;
702     case INTERACT_HIDE:
703         msg_Dbg( p_intf, "Hide the Interaction Dialog" );
704         qdialog = (InteractionDialog*)(p_dialog->p_private);
705         if( qdialog )
706             qdialog->hide();
707         p_dialog->i_status = HIDDEN_DIALOG;
708         break;
709     case INTERACT_DESTROY:
710         msg_Dbg( p_intf, "Destroy the Interaction Dialog" );
711         qdialog = (InteractionDialog*)(p_dialog->p_private);
712         if( !p_dialog->i_flags & DIALOG_NONBLOCKING_ERROR )
713             delete qdialog;
714         p_dialog->i_status = DESTROYED_DIALOG;
715         break;
716     }
717 }
718