]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs_provider.cpp
Qt: don't attach the core dialogs to the Main Interface but to the Dialog Provider.
[vlc] / modules / gui / qt4 / dialogs_provider.cpp
1 /*****************************************************************************
2  * dialogs_provider.cpp : Dialog Provider
3  *****************************************************************************
4  * Copyright (C) 2006-2009 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/external.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     DialogHandler *dialogHandler = new DialogHandler (p_intf, this );
82 }
83
84 DialogsProvider::~DialogsProvider()
85 {
86     PlaylistDialog::killInstance();
87     MediaInfoDialog::killInstance();
88     MessagesDialog::killInstance();
89     ExtendedDialog::killInstance();
90     BookmarksDialog::killInstance();
91     HelpDialog::killInstance();
92 #ifdef UPDATE_CHECK
93     UpdateDialog::killInstance();
94 #endif
95
96     delete menusMapper;
97     delete menusUpdateMapper;
98     delete SDMapper;
99 }
100
101 void DialogsProvider::quit()
102 {
103     b_isDying = true;
104     libvlc_Quit( p_intf->p_libvlc );
105 }
106
107 void DialogsProvider::customEvent( QEvent *event )
108 {
109     if( event->type() == (int)DialogEvent_Type )
110     {
111         DialogEvent *de = static_cast<DialogEvent*>(event);
112         switch( de->i_dialog )
113         {
114         case INTF_DIALOG_FILE_SIMPLE:
115         case INTF_DIALOG_FILE:
116             openDialog(); break;
117         case INTF_DIALOG_FILE_GENERIC:
118             openFileGenericDialog( de->p_arg ); break;
119         case INTF_DIALOG_DISC:
120             openDiscDialog(); break;
121         case INTF_DIALOG_NET:
122             openNetDialog(); break;
123         case INTF_DIALOG_SAT:
124         case INTF_DIALOG_CAPTURE:
125             openCaptureDialog(); break;
126         case INTF_DIALOG_DIRECTORY:
127             PLAppendDir(); break;
128         case INTF_DIALOG_PLAYLIST:
129             playlistDialog(); break;
130         case INTF_DIALOG_MESSAGES:
131             messagesDialog(); break;
132         case INTF_DIALOG_FILEINFO:
133            mediaInfoDialog(); break;
134         case INTF_DIALOG_PREFS:
135            prefsDialog(); break;
136         case INTF_DIALOG_BOOKMARKS:
137            bookmarksDialog(); break;
138         case INTF_DIALOG_EXTENDED:
139            extendedDialog(); break;
140 #ifdef ENABLE_VLM
141         case INTF_DIALOG_VLM:
142            vlmDialog(); break;
143 #endif
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 *p = new PrefsDialog( (QWidget *)p_intf->p_sys->p_mi, p_intf );
178     p->toggleVisible();
179 }
180
181 void DialogsProvider::extendedDialog()
182 {
183     ExtendedDialog::getInstance( p_intf )->showTab( 0 );
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 )->showTab( 0 );
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 *toolbarEditor = new ToolbarEditDialog( (QWidget *)p_intf->p_sys->p_mi, p_intf );
248     if( toolbarEditor->exec() == QDialog::Accepted )
249         emit toolBarConfUpdated();
250 }
251
252 void DialogsProvider::pluginDialog()
253 {
254     PluginDialog *diag = new PluginDialog( p_intf );
255     diag->show();
256 }
257
258 /* Generic open file */
259 void DialogsProvider::openFileGenericDialog( intf_dialog_args_t *p_arg )
260 {
261     if( p_arg == NULL )
262     {
263         msg_Warn( p_intf, "openFileGenericDialog() called with NULL arg" );
264         return;
265     }
266
267     /* Replace the extensions to a Qt format */
268     int i = 0;
269     QString extensions = qfu( p_arg->psz_extensions );
270     while ( ( i = extensions.indexOf( "|", i ) ) != -1 )
271     {
272         if( ( extensions.count( "|" ) % 2 ) == 0 )
273             extensions.replace( i, 1, ");;" );
274         else
275             extensions.replace( i, 1, "(" );
276     }
277     extensions.replace(QString(";*"), QString(" *"));
278     extensions.append( ")" );
279
280     /* Save */
281     if( p_arg->b_save )
282     {
283         QString file = QFileDialog::getSaveFileName( NULL, p_arg->psz_title,
284                                         p_intf->p_sys->filepath, extensions );
285         if( !file.isEmpty() )
286         {
287             p_arg->i_results = 1;
288             p_arg->psz_results = (char **)malloc( p_arg->i_results * sizeof( char * ) );
289             p_arg->psz_results[0] = strdup( qtu( toNativeSepNoSlash( file ) ) );
290         }
291         else
292             p_arg->i_results = 0;
293     }
294     else /* non-save mode */
295     {
296         QStringList files = QFileDialog::getOpenFileNames( NULL,
297                 p_arg->psz_title, p_intf->p_sys->filepath,
298                 extensions );
299         p_arg->i_results = files.count();
300         p_arg->psz_results = (char **)malloc( p_arg->i_results * sizeof( char * ) );
301         i = 0;
302         foreach( const QString &file, files )
303             p_arg->psz_results[i++] = strdup( qtu( toNativeSepNoSlash( file ) ) );
304     }
305
306     /* Callback */
307     if( p_arg->pf_callback )
308         p_arg->pf_callback( p_arg );
309
310     /* Clean afterwards */
311     if( p_arg->psz_results )
312     {
313         for( i = 0; i < p_arg->i_results; i++ )
314             free( p_arg->psz_results[i] );
315         free( p_arg->psz_results );
316     }
317     free( p_arg->psz_title );
318     free( p_arg->psz_extensions );
319     free( p_arg );
320 }
321 /****************************************************************************
322  * All the open/add stuff
323  * Open Dialog first - Simple Open then
324  ****************************************************************************/
325
326 void DialogsProvider::openDialog( int i_tab )
327 {
328     OpenDialog::getInstance( p_intf->p_sys->p_mi , p_intf )->showTab( i_tab );
329 }
330 void DialogsProvider::openDialog()
331 {
332     openDialog( OPEN_FILE_TAB );
333 }
334 void DialogsProvider::openFileDialog()
335 {
336     openDialog( OPEN_FILE_TAB );
337 }
338 void DialogsProvider::openDiscDialog()
339 {
340     openDialog( OPEN_DISC_TAB );
341 }
342 void DialogsProvider::openNetDialog()
343 {
344     openDialog( OPEN_NETWORK_TAB );
345 }
346 void DialogsProvider::openCaptureDialog()
347 {
348     openDialog( OPEN_CAPTURE_TAB );
349 }
350
351 /* Same as the open one, but force the enqueue */
352 void DialogsProvider::PLAppendDialog()
353 {
354     OpenDialog::getInstance( p_intf->p_sys->p_mi, p_intf, false,
355                              OPEN_AND_ENQUEUE )->showTab( OPEN_FILE_TAB );
356 }
357
358 void DialogsProvider::MLAppendDialog()
359 {
360     OpenDialog::getInstance( p_intf->p_sys->p_mi, p_intf, false,
361                             OPEN_AND_ENQUEUE, false, false )
362                                     ->showTab( OPEN_FILE_TAB );
363 }
364
365 /**
366  * Simple open
367  ***/
368 QStringList DialogsProvider::showSimpleOpen( QString help,
369                                              int filters,
370                                              QString path )
371 {
372     QString fileTypes = "";
373     if( filters & EXT_FILTER_MEDIA ) {
374         ADD_FILTER_MEDIA( fileTypes );
375     }
376     if( filters & EXT_FILTER_VIDEO ) {
377         ADD_FILTER_VIDEO( fileTypes );
378     }
379     if( filters & EXT_FILTER_AUDIO ) {
380         ADD_FILTER_AUDIO( fileTypes );
381     }
382     if( filters & EXT_FILTER_PLAYLIST ) {
383         ADD_FILTER_PLAYLIST( fileTypes );
384     }
385     if( filters & EXT_FILTER_SUBTITLE ) {
386         ADD_FILTER_SUBTITLE( fileTypes );
387     }
388     ADD_FILTER_ALL( fileTypes );
389     fileTypes.replace(QString(";*"), QString(" *"));
390
391     return QFileDialog::getOpenFileNames( NULL,
392         help.isEmpty() ? qtr(I_OP_SEL_FILES ) : help,
393         path.isEmpty() ? p_intf->p_sys->filepath : path,
394         fileTypes );
395 }
396
397 /**
398  * Open a file,
399  * pl helps you to choose from playlist or media library,
400  * go to start or enqueue
401  **/
402 void DialogsProvider::addFromSimple( bool pl, bool go)
403 {
404     QStringList files = DialogsProvider::showSimpleOpen();
405     int i = 0;
406     files.sort();
407     foreach( const QString &file, files )
408     {
409         playlist_Add( THEPL, qtu( toNativeSeparators( file ) ), NULL,
410                       go ? ( PLAYLIST_APPEND | ( i ? 0 : PLAYLIST_GO ) |
411                                                ( i ? PLAYLIST_PREPARSE : 0 ) )
412                          : ( PLAYLIST_APPEND | PLAYLIST_PREPARSE ),
413                       PLAYLIST_END,
414                       pl ? true : false, false );
415         RecentsMRL::getInstance( p_intf )->addRecent(
416                 toNativeSeparators( file ) );
417         i++;
418     }
419 }
420
421 void DialogsProvider::simpleOpenDialog()
422 {
423     addFromSimple( true, true ); /* Playlist and Go */
424 }
425
426 void DialogsProvider::simplePLAppendDialog()
427 {
428     addFromSimple( true, false );
429 }
430
431 void DialogsProvider::simpleMLAppendDialog()
432 {
433     addFromSimple( false, false );
434 }
435
436 /* Url & Clipboard */
437 /**
438  * Open a MRL.
439  * If the clipboard contains URLs, the first is automatically 'preselected'.
440  **/
441 void DialogsProvider::openUrlDialog()
442 {
443     OpenUrlDialog *oud = OpenUrlDialog::getInstance( p_intf->p_sys->p_mi,
444                                                      p_intf );
445     if( oud->exec() == QDialog::Accepted )
446     {
447         QString url = oud->url();
448         if( !url.isEmpty() )
449         {
450             playlist_Add( THEPL, qtu( url ),
451                           NULL, !oud->shouldEnqueue() ?
452                                   ( PLAYLIST_APPEND | PLAYLIST_GO )
453                                 : ( PLAYLIST_APPEND | PLAYLIST_PREPARSE ),
454                           PLAYLIST_END, true, false );
455             RecentsMRL::getInstance( p_intf )->addRecent( url );
456         }
457     }
458 }
459
460 /* Directory */
461 /**
462  * Open a directory,
463  * pl helps you to choose from playlist or media library,
464  * go to start or enqueue
465  **/
466 static void openDirectory( intf_thread_t *p_intf, bool pl, bool go )
467 {
468     QString dir = QFileDialog::getExistingDirectory( NULL, qtr("Open Directory") );
469
470     if (!dir.isEmpty() )
471     {
472         QString mrl = dir.endsWith( "VIDEO_TS", Qt::CaseInsensitive ) ?
473             "dvd://" : "directory://" + toNativeSeparators( dir );
474         input_item_t *p_input = input_item_New( THEPL, qtu( mrl ), NULL );
475
476         /* FIXME: playlist_AddInput() can fail */
477         playlist_AddInput( THEPL, p_input,
478                        go ? ( PLAYLIST_APPEND | PLAYLIST_GO ) : PLAYLIST_APPEND,
479                        PLAYLIST_END, pl, pl_Unlocked );
480         RecentsMRL::getInstance( p_intf )->addRecent( mrl );
481         if( !go )
482             input_Read( THEPL, p_input, true );
483         vlc_gc_decref( p_input );
484     }
485 }
486
487 void DialogsProvider::PLOpenDir()
488 {
489     openDirectory( p_intf, true, true );
490 }
491
492 void DialogsProvider::PLAppendDir()
493 {
494     openDirectory( p_intf, true, false );
495 }
496
497 void DialogsProvider::MLAppendDir()
498 {
499     openDirectory( p_intf, false , false );
500 }
501
502 /****************
503  * Playlist     *
504  ****************/
505 void DialogsProvider::openAPlaylist()
506 {
507     QStringList files = showSimpleOpen( qtr( "Open playlist..." ),
508                                         EXT_FILTER_PLAYLIST );
509     foreach( const QString &file, files )
510     {
511         playlist_Import( THEPL, qtu( toNativeSeparators( file ) ) );
512     }
513 }
514
515 void DialogsProvider::saveAPlaylist()
516 {
517     QFileDialog *qfd = new QFileDialog( NULL,
518                                    qtr( "Save playlist as..." ),
519                                    p_intf->p_sys->filepath,
520                                    qtr( "XSPF playlist (*.xspf);; " ) +
521                                    qtr( "M3U playlist (*.m3u);; " ) +
522                                    qtr( "HTML playlist (*.html)" ) );
523     qfd->setFileMode( QFileDialog::AnyFile );
524     qfd->setAcceptMode( QFileDialog::AcceptSave );
525     qfd->setConfirmOverwrite( true );
526
527     if( qfd->exec() == QDialog::Accepted )
528     {
529         if( qfd->selectedFiles().count() > 0 )
530         {
531             static const char psz_xspf[] = "export-xspf",
532                               psz_m3u[] = "export-m3u",
533                               psz_html[] = "export-html";
534             const char *psz_module;
535
536             QString file = qfd->selectedFiles().first();
537             QString filter = qfd->selectedFilter();
538
539             if( file.contains( ".xsp" ) || filter.contains( "XSPF" ) )
540             {
541                 psz_module = psz_xspf;
542                 if( !file.contains( ".xsp" ) )
543                     file.append( ".xspf" );
544             }
545             else if( file.contains( ".m3u" )  || filter.contains( "M3U" ) )
546             {
547                 psz_module = psz_m3u;
548                 if( !file.contains( ".m3u" ) )
549                     file.append( ".m3u" );
550             }
551             else if( file.contains(".html" ) || filter.contains( "HTML" ) )
552             {
553                 psz_module = psz_html;
554                 if( !file.contains( "html" ) )
555                     file.append( ".html" );
556             }
557             else
558             {
559                 msg_Err( p_intf, "Impossible to recognise the file type" );
560                 delete qfd;
561                 return;
562             }
563
564             playlist_Export( THEPL, qtu( toNativeSeparators( file ) ),
565                         THEPL->p_local_category, psz_module);
566         }
567     }
568     delete qfd;
569 }
570
571 /****************************************************************************
572  * Sout emulation
573  ****************************************************************************/
574
575 void DialogsProvider::streamingDialog( QWidget *parent,
576                                        QString mrl,
577                                        bool b_transcode_only,
578                                        QStringList options )
579 {
580     char *psz_soutoption;
581
582     /* Stream */
583     if( !b_transcode_only )
584     {
585         SoutDialog *s = new SoutDialog( parent, p_intf, mrl );
586         if( s->exec() == QDialog::Accepted )
587         {
588             psz_soutoption = strdup( qtu( s->getMrl() ) );
589             delete s;
590         }
591         else
592         {
593             delete s; return;
594         }
595     } else {
596     /* Convert */
597         ConvertDialog *s = new ConvertDialog( parent, p_intf, mrl );
598         if( s->exec() == QDialog::Accepted )
599         {
600             psz_soutoption = strdup( qtu( s->getMrl() ) );
601             delete s;
602         }
603         else
604         {
605             delete s; return;
606         }
607     }
608
609     /* Get SoutMRL */
610     if( !EMPTY_STR( psz_soutoption ) )
611     {
612         options += QString( psz_soutoption ).split( " :");
613
614         /* Create Input */
615         input_item_t *p_input;
616         p_input = input_item_New( p_intf, qtu( mrl ), _("Streaming") );
617
618         /* Add normal Options */
619         for( int j = 0; j < options.size(); j++ )
620         {
621             QString qs = colon_unescape( options[j] );
622             if( !qs.isEmpty() )
623             {
624                 input_item_AddOption( p_input, qtu( qs ),
625                         VLC_INPUT_OPTION_TRUSTED );
626                 msg_Dbg( p_intf, "Adding option: %s", qtu( qs ) );
627             }
628         }
629
630         /* Switch between enqueuing and starting the item */
631         /* FIXME: playlist_AddInput() can fail */
632         playlist_AddInput( THEPL, p_input,
633                 PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END, true, pl_Unlocked );
634         vlc_gc_decref( p_input );
635
636         RecentsMRL::getInstance( p_intf )->addRecent( mrl );
637     }
638     free( psz_soutoption );
639 }
640
641 void DialogsProvider::openAndStreamingDialogs()
642 {
643     OpenDialog::getInstance( p_intf->p_sys->p_mi, p_intf, false, OPEN_AND_STREAM )
644                                 ->showTab( OPEN_FILE_TAB );
645 }
646
647 void DialogsProvider::openAndTranscodingDialogs()
648 {
649     OpenDialog::getInstance( p_intf->p_sys->p_mi , p_intf, false, OPEN_AND_SAVE )
650                                 ->showTab( OPEN_FILE_TAB );
651 }
652
653 void DialogsProvider::loadSubtitlesFile()
654 {
655     input_thread_t *p_input = THEMIM->getInput();
656     if( !p_input ) return;
657
658     input_item_t *p_item = input_GetItem( p_input );
659     if( !p_item ) return;
660
661     char *path = input_item_GetURI( p_item );
662     if( !path ) path = strdup( "" );
663
664     char *sep = strrchr( path, DIR_SEP_CHAR );
665     if( sep ) *sep = '\0';
666
667     QStringList qsl = showSimpleOpen( qtr( "Open subtitles..." ),
668                                       EXT_FILTER_SUBTITLE,
669                                       path );
670     free( path );
671     foreach( const QString &qsFile, qsl )
672     {
673         if( input_AddSubtitle( p_input, qtu( toNativeSeparators( qsFile ) ),
674                     true ) )
675             msg_Warn( p_intf, "unable to load subtitles from '%s'",
676                       qtu( qsFile ) );
677     }
678 }
679
680
681 /****************************************************************************
682  * Menus
683  ****************************************************************************/
684
685 void DialogsProvider::menuAction( QObject *data )
686 {
687     QVLCMenu::DoAction( data );
688 }
689
690 void DialogsProvider::menuUpdateAction( QObject *data )
691 {
692     MenuFunc *func = qobject_cast<MenuFunc *>(data);
693     assert( func );
694     func->doFunc( p_intf );
695 }
696
697 void DialogsProvider::SDMenuAction( QString data )
698 {
699     char *psz_sd = strdup( qtu( data ) );
700     if( !playlist_IsServicesDiscoveryLoaded( THEPL, psz_sd ) )
701         playlist_ServicesDiscoveryAdd( THEPL, psz_sd );
702     else
703         playlist_ServicesDiscoveryRemove( THEPL, psz_sd );
704     free( psz_sd );
705 }
706
707 /**
708  * Play the MRL contained in the Recently played menu.
709  **/
710 void DialogsProvider::playMRL( const QString &mrl )
711 {
712     playlist_Add( THEPL, qtu( mrl ) , NULL,
713            PLAYLIST_APPEND | PLAYLIST_GO , PLAYLIST_END, true, false );
714
715     RecentsMRL::getInstance( p_intf )->addRecent( mrl );
716 }