f795c9aa075c6f05e5159c78e04688451e86bfec
[vlc.git] / modules / gui / qt4 / main_interface.cpp
1 /*****************************************************************************
2  * main_inteface.cpp : Main interface
3  ****************************************************************************
4  * Copyright (C) 2006 the VideoLAN team
5  * $Id$
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/
22
23 #include "qt4.hpp"
24 #include "main_interface.hpp"
25 #include "input_manager.hpp"
26 #include "util/input_slider.hpp"
27 #include "util/qvlcframe.hpp"
28 #include "util/customwidgets.hpp"
29 #include "dialogs_provider.hpp"
30 #include "components/interface_widgets.hpp"
31 #include "dialogs/playlist.hpp"
32 #include "menus.hpp"
33
34 #include <QMenuBar>
35 #include <QCloseEvent>
36 #include <QPushButton>
37 #include <QStatusBar>
38 #include <QKeyEvent>
39 #include <QUrl>
40
41 #include <assert.h>
42 #include <vlc_keys.h>
43 #include <vlc_vout.h>
44
45 #ifdef WIN32
46     #define PREF_W 410
47     #define PREF_H 121
48 #else
49     #define PREF_W 450
50     #define PREF_H 125
51 #endif
52
53 #define VISIBLE(i) (i && i->isVisible())
54
55 #define SET_WIDTH(i,j) i->widgetSize.setWidth(j)
56 #define SET_HEIGHT(i,j) i->widgetSize.setHeight(j)
57 #define SET_WH( i,j,k) i->widgetSize.setWidth(j); i->widgetSize.setHeight(k);
58
59 #define DS(i) i.width(),i.height()
60
61 static int InteractCallback( vlc_object_t *, const char *, vlc_value_t,
62                              vlc_value_t, void *);
63 /* Video handling */
64 static void *DoRequest( intf_thread_t *p_intf, vout_thread_t *p_vout,
65                         int *pi1, int *pi2, unsigned int*pi3,unsigned int*pi4)
66 {
67     return p_intf->p_sys->p_mi->requestVideo( p_vout, pi1, pi2, pi3, pi4 );
68 }
69 static void DoRelease( intf_thread_t *p_intf, void *p_win )
70 {
71     return p_intf->p_sys->p_mi->releaseVideo( p_win );
72 }
73 static int DoControl( intf_thread_t *p_intf, void *p_win, int i_q, va_list a )
74 {
75     return p_intf->p_sys->p_mi->controlVideo( p_win, i_q, a );
76 }
77
78 bool embeddedPlaylistWasActive;
79 bool videoIsActive;
80 QSize savedVideoSize;
81
82 MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
83 {
84     /* Configuration */
85     settings = new QSettings( "VideoLAN", "VLC" );
86     settings->beginGroup( "MainWindow" );
87
88     need_components_update = false;
89     bgWidget = NULL; videoWidget = NULL; playlistWidget = NULL;
90     embeddedPlaylistWasActive = videoIsActive = false;
91
92     videoEmbeddedFlag = false;
93     if( config_GetInt( p_intf, "embedded-video" ) ) videoEmbeddedFlag = true;
94
95     alwaysVideoFlag = false;
96     if( videoEmbeddedFlag && config_GetInt( p_intf, "qt-always-video" ))
97         alwaysVideoFlag = true;
98
99     playlistEmbeddedFlag = settings->value("playlist-embedded", true).toBool();
100     advControlsEnabled= settings->value( "adv-controls", false ).toBool();
101     visualSelectorEnabled= settings->value( "visual-selector", false ).toBool();
102
103     /* UI */
104     setWindowTitle( qtr( "VLC media player" ) );
105     handleMainUi( settings );
106     QVLCMenu::createMenuBar( this, p_intf, playlistEmbeddedFlag,
107                              advControlsEnabled, visualSelectorEnabled );
108     timeLabel = new QLabel( 0 );
109     nameLabel = new QLabel( 0 );
110     statusBar()->addWidget( nameLabel, 4 );
111     statusBar()->addPermanentWidget( timeLabel, 1 );
112
113     setFocusPolicy( Qt::StrongFocus );
114     setAcceptDrops(true);
115
116     /* Init input manager */
117     MainInputManager::getInstance( p_intf );
118     ON_TIMEOUT( updateOnTimer() );
119
120     /* Volume control */
121     CONNECT( ui.volumeSlider, valueChanged(int), this, updateVolume(int) );
122     /* Connect the input manager to the GUI elements it manages */
123     CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ),
124              slider, setPosition( float,int, int ) );
125     CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ),
126              this, setDisplay( float, int, int ) );
127     CONNECT( THEMIM->getIM(), nameChanged( QString ), this,setName( QString ) );
128     CONNECT( THEMIM->getIM(), statusChanged( int ), this, setStatus( int ) );
129     CONNECT( THEMIM->getIM(), navigationChanged( int ), this, setNavigation(int) );
130     CONNECT( slider, sliderDragged( float ),
131              THEMIM->getIM(), sliderUpdate( float ) );
132
133     CONNECT( ui.prevSectionButton, clicked(), THEMIM->getIM(),
134              sectionPrev() );
135     CONNECT( ui.nextSectionButton, clicked(), THEMIM->getIM(),
136              sectionNext() );
137     CONNECT( ui.menuButton, clicked(), THEMIM->getIM(),
138              sectionMenu() );
139
140     var_Create( p_intf, "interaction", VLC_VAR_ADDRESS );
141     var_AddCallback( p_intf, "interaction", InteractCallback, this );
142     p_intf->b_interaction = VLC_TRUE;
143 }
144
145 MainInterface::~MainInterface()
146 {
147     settings->setValue( "playlist-embedded", playlistEmbeddedFlag );
148     settings->setValue( "adv-controls", advControlsEnabled );
149     settings->setValue( "pos", pos() );
150     settings->endGroup();
151     delete settings;
152     p_intf->b_interaction = VLC_FALSE;
153     var_DelCallback( p_intf, "interaction", InteractCallback, this );
154
155     p_intf->pf_request_window = NULL;
156     p_intf->pf_release_window = NULL;
157     p_intf->pf_control_window = NULL;
158 }
159
160 void MainInterface::handleMainUi( QSettings *settings )
161 {
162     QWidget *main = new QWidget( this );
163     setCentralWidget( main );
164     ui.setupUi( centralWidget() );
165
166     slider = new InputSlider( Qt::Horizontal, NULL );
167     ui.hboxLayout->insertWidget( 0, slider );
168     ui.discFrame->hide();
169     BUTTON_SET_IMG( ui.prevSectionButton, "", previous.png, "" );
170     BUTTON_SET_IMG( ui.nextSectionButton, "", next.png, "" );
171     BUTTON_SET_IMG( ui.menuButton, "", previous.png, "" );
172
173     BUTTON_SET_ACT_I( ui.prevButton, "" , previous.png,
174                       qtr("Previous"), prev() );
175     BUTTON_SET_ACT_I( ui.nextButton, "", next.png, qtr("Next"), next() );
176     BUTTON_SET_ACT_I( ui.playButton, "", play.png, qtr("Play"), play() );
177     BUTTON_SET_ACT_I( ui.stopButton, "", stop.png, qtr("Stop"), stop() );
178
179     /* Volume */
180     ui.volMuteLabel->setPixmap( QPixmap( ":/pixmaps/volume-low.png" ) );
181     ui.volumeSlider->setMaximum( 100 );
182     ui.volMuteLabel->setToolTip( qtr( "Mute" ) );
183     VolumeClickHandler *h = new VolumeClickHandler( p_intf, this );
184     ui.volMuteLabel->installEventFilter(h);
185     ui.volumeSlider->setFocusPolicy( Qt::NoFocus );
186
187     BUTTON_SET_IMG( ui.playlistButton, "" , playlist_icon.png,
188                         playlistEmbeddedFlag ?  qtr( "Show playlist" ) :
189                                                 qtr( "Open playlist" ) );
190     BUTTONACT( ui.playlistButton, playlist() );
191
192     /* Set initial size */
193     resize ( PREF_W, PREF_H );
194
195     addSize = QSize( ui.vboxLayout->margin() * 2, PREF_H );
196
197     advControls = new ControlsWidget( p_intf );
198     ui.vboxLayout->insertWidget( 0, advControls );
199     advControls->updateGeometry();
200     if( !advControlsEnabled ) advControls->hide();
201     need_components_update = true;
202
203     visualSelector = new VisualSelector( p_intf );
204     ui.vboxLayout->insertWidget( 0, visualSelector );
205     visualSelector->hide();
206
207     if( alwaysVideoFlag )
208     {
209         bgWidget = new BackgroundWidget( p_intf );
210         bgWidget->widgetSize = settings->value( "backgroundSize",
211                                                 QSize( 200, 200 ) ).toSize();
212         bgWidget->resize( bgWidget->widgetSize );
213         bgWidget->updateGeometry();
214         ui.vboxLayout->insertWidget( 0, bgWidget );
215     }
216
217     if( videoEmbeddedFlag )
218     {
219         videoWidget = new VideoWidget( p_intf );
220         videoWidget->widgetSize = QSize( 1, 1 );
221         videoWidget->resize( videoWidget->widgetSize );
222         ui.vboxLayout->insertWidget( 0, videoWidget );
223
224         p_intf->pf_request_window  = ::DoRequest;
225         p_intf->pf_release_window  = ::DoRelease;
226         p_intf->pf_control_window  = ::DoControl;
227     }
228     setMinimumSize( PREF_W, addSize.height() );
229 }
230
231 /**********************************************************************
232  * Handling of the components
233  **********************************************************************/
234 void MainInterface::calculateInterfaceSize()
235 {
236     int width = 0, height = 0;
237     if( VISIBLE( bgWidget ) )
238     {
239         width = bgWidget->widgetSize.width();
240         height = bgWidget->widgetSize.height();
241         assert( !(playlistWidget && playlistWidget->isVisible() ) );
242     }
243     else if( VISIBLE( playlistWidget ) )
244     {
245         width = playlistWidget->widgetSize.width();
246         height = playlistWidget->widgetSize.height();
247     }
248     else if( videoIsActive )
249     {
250         width =  videoWidget->widgetSize.width() ;
251         height = videoWidget->widgetSize.height();
252     }
253     else
254     {
255         width = PREF_W - addSize.width();
256         height = PREF_H - addSize.height();
257     }
258     if( VISIBLE( visualSelector ) )
259         height += visualSelector->height();
260     if( VISIBLE( advControls) )
261     {
262         height += advControls->sizeHint().height();
263     }
264     mainSize = QSize( width + addSize.width(), height + addSize.height() );
265 }
266
267 void MainInterface::resizeEvent( QResizeEvent *e )
268 {
269     videoWidget->widgetSize.setWidth(  e->size().width() - addSize.width() );
270     if( videoWidget && videoIsActive && videoWidget->widgetSize.height() > 1 )
271     {
272         SET_WH( videoWidget, e->size().width() - addSize.width(),
273                              e->size().height()  - addSize.height() );
274         videoWidget->updateGeometry();
275     }
276     if( VISIBLE( playlistWidget ) )
277     {
278         SET_WH( playlistWidget , e->size().width() - addSize.width(),
279                                  e->size().height() - addSize.height() );
280         playlistWidget->updateGeometry();
281     }
282 }
283
284 void *MainInterface::requestVideo( vout_thread_t *p_nvout, int *pi_x,
285                                    int *pi_y, unsigned int *pi_width,
286                                    unsigned int *pi_height )
287 {
288     void *ret = videoWidget->request( p_nvout,pi_x, pi_y, pi_width, pi_height );
289     if( ret )
290     {
291         videoIsActive = true;
292         if( VISIBLE( playlistWidget ) )
293         {
294             embeddedPlaylistWasActive = true;
295             playlistWidget->hide();
296         }
297         bool bgWasVisible = false;
298         if( VISIBLE( bgWidget) )
299         {
300             bgWasVisible = true;
301             bgWidget->hide();
302         }
303         if( THEMIM->getIM()->hasVideo() || !bgWasVisible )
304         {
305             videoWidget->widgetSize = QSize( *pi_width, *pi_height );
306         }
307         else /* Background widget available, use its size */
308         {
309             /* Ok, our visualizations are bad, so don't do this for the moment
310              * use the requested size anyway */
311             // videoWidget->widgetSize = bgWidget->widgeTSize;
312             videoWidget->widgetSize = QSize( *pi_width, *pi_height );
313         }
314         videoWidget->updateGeometry(); /// FIXME: Needed ?
315         need_components_update = true;
316     }
317     return ret;
318 }
319
320 void MainInterface::releaseVideo( void *p_win )
321 {
322     videoWidget->release( p_win );
323     videoWidget->widgetSize = QSize( 0, 0 );
324     videoWidget->resize( videoWidget->widgetSize );
325
326     if( embeddedPlaylistWasActive )
327         playlistWidget->show();
328     else if( bgWidget )
329         bgWidget->show();
330
331     videoIsActive = false;
332     need_components_update = true;
333 }
334
335 int MainInterface::controlVideo( void *p_window, int i_query, va_list args )
336 {
337     int i_ret = VLC_EGENERIC;
338     switch( i_query )
339     {
340         case VOUT_GET_SIZE:
341         {
342             unsigned int *pi_width  = va_arg( args, unsigned int * );
343             unsigned int *pi_height = va_arg( args, unsigned int * );
344             *pi_width = videoWidget->widgetSize.width();
345             *pi_height = videoWidget->widgetSize.height();
346             i_ret = VLC_SUCCESS;
347             break;
348         }
349         case VOUT_SET_SIZE:
350         {
351             unsigned int i_width  = va_arg( args, unsigned int );
352             unsigned int i_height = va_arg( args, unsigned int );
353             videoWidget->widgetSize = QSize( i_width, i_height );
354             videoWidget->updateGeometry();
355             need_components_update = true;
356             i_ret = VLC_SUCCESS;
357             break;
358         }
359         case VOUT_SET_STAY_ON_TOP:
360         default:
361             msg_Warn( p_intf, "unsupported control query" );
362             break;
363     }
364     return i_ret;
365 }
366
367 void MainInterface::advanced()
368 {
369     if( !VISIBLE( advControls ) )
370     {
371         advControls->show();
372         advControlsEnabled = true;
373     }
374     else
375     {
376         advControls->hide();
377         advControlsEnabled = false;
378     }
379     doComponentsUpdate();
380 }
381
382 void MainInterface::visual()
383 {
384     if( !VISIBLE( visualSelector) )
385     {
386         visualSelector->show();
387         if( !THEMIM->getIM()->hasVideo() )
388         {
389             /* Show the background widget */
390         }
391         visualSelectorEnabled = true;
392     }
393     else
394     {
395         /* Stop any currently running visualization */
396         visualSelector->hide();
397         visualSelectorEnabled = false;
398     }
399     doComponentsUpdate();
400 }
401
402 void MainInterface::playlist()
403 {
404     // Toggle the playlist dialog
405     if( !playlistEmbeddedFlag )
406     {
407         if( playlistWidget )
408         {
409             /// \todo Destroy it
410         }
411         THEDP->playlistDialog();
412         return;
413     }
414
415     if( !playlistWidget )
416     {
417         PlaylistDialog::killInstance();
418         playlistWidget = new PlaylistWidget( p_intf );
419         ui.vboxLayout->insertWidget( 0, playlistWidget );
420         playlistWidget->widgetSize = settings->value( "playlistSize",
421                                                QSize( 650, 310 ) ).toSize();
422         playlistWidget->hide();
423     }
424     if( VISIBLE( playlistWidget ) )
425     {
426         playlistWidget->hide();
427         if( videoIsActive )
428         {
429             videoWidget->widgetSize = savedVideoSize;
430             videoWidget->resize( videoWidget->widgetSize );
431             videoWidget->updateGeometry();
432         }
433     }
434     else
435     {
436         playlistWidget->show();
437         if( videoIsActive )
438         {
439             savedVideoSize = videoWidget->widgetSize;
440             videoWidget->widgetSize.setHeight( 0 );
441             videoWidget->resize( videoWidget->widgetSize );
442             videoWidget->updateGeometry();
443         }
444         if( VISIBLE( bgWidget ) ) bgWidget->hide();
445     }
446     doComponentsUpdate();
447 }
448
449 /* Video widget cannot do this synchronously as it runs in another thread */
450 /* Well, could it, actually ? Probably dangerous ... */
451 void MainInterface::doComponentsUpdate()
452 {
453     calculateInterfaceSize();
454     resize( mainSize );
455 }
456
457 void MainInterface::undockPlaylist()
458 {
459     if( playlistWidget )
460     {
461         playlistWidget->hide();
462         playlistWidget->deleteLater();
463         ui.vboxLayout->removeWidget( playlistWidget );
464         playlistWidget = NULL;
465         playlistEmbeddedFlag = false;
466
467         menuBar()->clear();
468         QVLCMenu::createMenuBar( this, p_intf, false, advControlsEnabled,
469                                  visualSelectorEnabled);
470
471         if( videoIsActive )
472         {
473             videoWidget->widgetSize = savedVideoSize;
474             videoWidget->resize( videoWidget->widgetSize );
475             videoWidget->updateGeometry();
476         }
477
478         doComponentsUpdate();
479         THEDP->playlistDialog();
480     }
481 }
482
483 void MainInterface::customEvent( QEvent *event )
484 {
485     if( event->type() == PLDockEvent_Type )
486     {
487         PlaylistDialog::killInstance();
488         playlistEmbeddedFlag = true;
489         menuBar()->clear();
490         QVLCMenu::createMenuBar(this, p_intf, true, advControlsEnabled,
491                                 visualSelectorEnabled);
492         playlist();
493     }
494 }
495
496
497 /************************************************************************
498  * D&D
499  ************************************************************************/
500 void MainInterface::dropEvent(QDropEvent *event)
501 {
502      const QMimeData *mimeData = event->mimeData();
503
504      /* D&D of a subtitles file, add it on the fly */
505      if( mimeData->urls().size() == 1 )
506      {
507         if( THEMIM->getIM()->hasInput() )
508         {
509             if( input_AddSubtitles( THEMIM->getInput(),
510                                     qtu( mimeData->urls()[0].toString() ),
511                                     VLC_TRUE ) )
512             {
513                 event->acceptProposedAction();
514                 return;
515             }
516         }
517      }
518      bool first = true;
519      foreach( QUrl url, mimeData->urls() ) {
520         QString s = url.toString();
521         if( s.length() > 0 ) {
522             playlist_Add( THEPL, qtu(s), NULL,
523                           PLAYLIST_APPEND | (first ? PLAYLIST_GO:0),
524                           PLAYLIST_END, VLC_TRUE );
525             first = false;
526         }
527      }
528      event->acceptProposedAction();
529 }
530 void MainInterface::dragEnterEvent(QDragEnterEvent *event)
531 {
532      event->acceptProposedAction();
533 }
534 void MainInterface::dragMoveEvent(QDragMoveEvent *event)
535 {
536      event->acceptProposedAction();
537 }
538 void MainInterface::dragLeaveEvent(QDragLeaveEvent *event)
539 {
540      event->accept();
541 }
542
543 /************************************************************************
544  * Other stuff
545  ************************************************************************/
546 void MainInterface::keyPressEvent( QKeyEvent *e )
547 {
548     int i_vlck = qtEventToVLCKey( e );
549     if( i_vlck >= 0 )
550     {
551         var_SetInteger( p_intf->p_libvlc, "key-pressed", i_vlck );
552         e->accept();
553     }
554     else
555         e->ignore();
556 }
557
558 void MainInterface::stop()
559 {
560     playlist_Stop( THEPL );
561 }
562 void MainInterface::play()
563 {
564     if( playlist_IsEmpty(THEPL) )
565     {
566         /* The playlist is empty, open a file requester */
567         THEDP->simpleOpenDialog();
568         setStatus( 0 );
569         return;
570     }
571     THEMIM->togglePlayPause();
572 }
573 void MainInterface::prev()
574 {
575     playlist_Prev( THEPL );
576 }
577 void MainInterface::next()
578 {
579     playlist_Next( THEPL );
580 }
581
582 void MainInterface::setDisplay( float pos, int time, int length )
583 {
584     char psz_length[MSTRTIME_MAX_SIZE], psz_time[MSTRTIME_MAX_SIZE];
585     secstotimestr( psz_length, length );
586     secstotimestr( psz_time, time );
587     QString title;
588     title.sprintf( "%s/%s", psz_time, psz_length );
589     timeLabel->setText( " "+title+" " );
590 }
591
592 void MainInterface::setName( QString name )
593 {
594     nameLabel->setText( " " + name+" " );
595 }
596
597 void MainInterface::setStatus( int status )
598 {
599     if( status == 1 ) // Playing
600         ui.playButton->setIcon( QIcon( ":/pixmaps/pause.png" ) );
601     else
602         ui.playButton->setIcon( QIcon( ":/pixmaps/play.png" ) );
603 }
604
605 #define HELP_MENU N_("Menu")
606 #define HELP_PCH N_("Previous chapter")
607 #define HELP_NCH N_("Next chapter")
608 #define HELP_PTR N_("Previous track")
609 #define HELP_NTR N_("Next track")
610
611 void MainInterface::setNavigation( int navigation )
612 {
613     // 1 = chapter, 2 = title, 0 = no
614     if( navigation == 0 )
615     {
616         ui.discFrame->hide();
617     } else if( navigation == 1 ) {
618         ui.prevSectionButton->show();
619         ui.prevSectionButton->setToolTip( qfu(HELP_PCH) );
620         ui.nextSectionButton->show();
621         ui.nextSectionButton->setToolTip( qfu(HELP_NCH) );
622         ui.menuButton->show();
623         ui.discFrame->show();
624     } else {
625         ui.prevSectionButton->show();
626         ui.prevSectionButton->setToolTip( qfu(HELP_PCH) );
627         ui.nextSectionButton->show();
628         ui.nextSectionButton->setToolTip( qfu(HELP_NCH) );
629         ui.menuButton->hide();
630         ui.discFrame->show();
631     }
632 }
633
634 static bool b_my_volume;
635
636 void MainInterface::updateOnTimer()
637 {
638     /* \todo Make this event-driven */
639     advControls->enableInput( THEMIM->getIM()->hasInput() );
640     advControls->enableVideo( THEMIM->getIM()->hasVideo() );
641
642     if( intf_ShouldDie( p_intf ) )
643     {
644         QApplication::closeAllWindows();
645         QApplication::quit();
646     }
647     if( need_components_update )
648     {
649         doComponentsUpdate();
650         need_components_update = false;
651     }
652
653     audio_volume_t i_volume;
654     aout_VolumeGet( p_intf, &i_volume );
655     i_volume = (i_volume *  200 )/ AOUT_VOLUME_MAX ;
656     int i_gauge = ui.volumeSlider->value();
657     b_my_volume = false;
658     if( i_volume - i_gauge > 1 || i_gauge - i_volume > 1 )
659     {
660         b_my_volume = true;
661         ui.volumeSlider->setValue( i_volume );
662         b_my_volume = false;
663     }
664 }
665
666 void MainInterface::closeEvent( QCloseEvent *e )
667 {
668     hide();
669     p_intf->b_die = VLC_TRUE;
670 }
671
672 void MainInterface::updateVolume( int sliderVolume )
673 {
674     if( !b_my_volume )
675     {
676         int i_res = sliderVolume * AOUT_VOLUME_MAX /
677                             (2*ui.volumeSlider->maximum() );
678         aout_VolumeSet( p_intf, i_res );
679     }
680 }
681
682 static int InteractCallback( vlc_object_t *p_this,
683                              const char *psz_var, vlc_value_t old_val,
684                              vlc_value_t new_val, void *param )
685 {
686     intf_dialog_args_t *p_arg = new intf_dialog_args_t;
687     p_arg->p_dialog = (interaction_dialog_t *)(new_val.p_address);
688     DialogEvent *event = new DialogEvent( INTF_DIALOG_INTERACTION, 0, p_arg );
689     QApplication::postEvent( THEDP, static_cast<QEvent*>(event) );
690     return VLC_SUCCESS;
691 }