]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/open_panels.cpp
Fix behaviour of DVDSimple button while not in DVD opening
[vlc] / modules / gui / qt4 / components / open_panels.cpp
1 /*****************************************************************************
2  * open.cpp : Panels for the open dialogs
3  ****************************************************************************
4  * Copyright (C) 2006-2007 the VideoLAN team
5  * Copyright (C) 2007 Société des arts technologiques
6  * Copyright (C) 2007 Savoir-faire Linux
7  *
8  * $Id$
9  *
10  * Authors: Clément Stenac <zorglub@videolan.org>
11  *          Jean-Baptiste Kempf <jb@videolan.org>
12  *          Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
13  *
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 2 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not, write to the Free Software
26  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
27  *****************************************************************************/
28
29 #ifdef HAVE_CONFIG_H
30 # include "config.h"
31 #endif
32
33 #include "qt4.hpp"
34 #include "components/open_panels.hpp"
35 #include "dialogs/open.hpp"
36 #include "dialogs_provider.hpp"
37
38 #include <QFileDialog>
39 #include <QDialogButtonBox>
40 #include <QLineEdit>
41 #include <QStackedLayout>
42 #include <QListView>
43 #include <QCompleter>
44 #include <QDirModel>
45 #include <QScrollArea>
46 #include <QUrl>
47
48 /**************************************************************************
49  * Open Files and subtitles                                               *
50  **************************************************************************/
51 FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
52                                 OpenPanel( _parent, _p_intf )
53 {
54     /* Classic UI Setup */
55     ui.setupUi( this );
56
57     /** BEGIN QFileDialog tweaking **/
58     /* Use a QFileDialog and customize it because we don't want to
59        rewrite it all. Be careful to your eyes cause there are a few hacks.
60        Be very careful and test correctly when you modify this. */
61
62     /* Set Filters for file selection */
63     QString fileTypes = "";
64     ADD_FILTER_MEDIA( fileTypes );
65     ADD_FILTER_VIDEO( fileTypes );
66     ADD_FILTER_AUDIO( fileTypes );
67     ADD_FILTER_PLAYLIST( fileTypes );
68     ADD_FILTER_ALL( fileTypes );
69     fileTypes.replace( QString(";*"), QString(" *"));
70
71     // Make this QFileDialog a child of tempWidget from the ui.
72     dialogBox = new FileOpenBox( ui.tempWidget, NULL,
73             qfu( p_intf->p_sys->psz_filepath ), fileTypes );
74
75     dialogBox->setFileMode( QFileDialog::ExistingFiles );
76     dialogBox->setAcceptMode( QFileDialog::AcceptOpen );
77     dialogBox->setViewMode( config_GetInt( p_intf, "qt-open-detail" ) ?
78             QFileDialog::Detail : QFileDialog::List );
79
80     /* We don't want to see a grip in the middle of the window, do we? */
81     dialogBox->setSizeGripEnabled( false );
82
83     /* Add a tooltip */
84     dialogBox->setToolTip( qtr( "Select one or multiple files" ) );
85
86     // But hide the two OK/Cancel buttons. Enable them for debug.
87     QDialogButtonBox *fileDialogAcceptBox =
88                       dialogBox->findChildren<QDialogButtonBox*>()[0];
89     fileDialogAcceptBox->hide();
90
91     /* Ugly hacks to get the good Widget */
92     //This lineEdit is the normal line in the fileDialog.
93 #if HAS_QT43
94     lineFileEdit = dialogBox->findChildren<QLineEdit*>()[0];
95 #else
96     lineFileEdit = dialogBox->findChildren<QLineEdit*>()[1];
97 #endif
98     /* Make a list of QLabel inside the QFileDialog to access the good ones */
99     QList<QLabel *> listLabel = dialogBox->findChildren<QLabel*>();
100
101     /* Hide the FileNames one. Enable it for debug */
102     listLabel[1]->setText( qtr( "File names:" ) );
103     /* Change the text that was uncool in the usual box */
104     listLabel[2]->setText( qtr( "Filter:" ) );
105
106     dialogBox->layout()->setMargin( 0 );
107     dialogBox->layout()->setSizeConstraint( QLayout::SetNoConstraint );
108
109     /** END of QFileDialog tweaking **/
110
111     // Add the DialogBox to the layout
112     ui.gridLayout->addWidget( dialogBox, 0, 0, 1, 3 );
113
114     //TODO later: fill the fileCompleteList with previous items played.
115     QCompleter *fileCompleter = new QCompleter( fileCompleteList, this );
116     fileCompleter->setModel( new QDirModel( fileCompleter ) );
117     lineFileEdit->setCompleter( fileCompleter );
118
119     // Hide the subtitles control by default.
120     ui.subFrame->hide();
121
122     /* Build the subs size combo box */
123     setfillVLCConfigCombo( "freetype-rel-fontsize" , p_intf,
124                             ui.sizeSubComboBox );
125
126     /* Build the subs align combo box */
127     setfillVLCConfigCombo( "subsdec-align", p_intf, ui.alignSubComboBox );
128
129     /* Connects  */
130     BUTTONACT( ui.subBrowseButton, browseFileSub() );
131     BUTTONACT( ui.subCheckBox, toggleSubtitleFrame());
132
133     CONNECT( lineFileEdit, textChanged( QString ), this, updateMRL() );
134     CONNECT( ui.subInput, textChanged( QString ), this, updateMRL() );
135     CONNECT( ui.alignSubComboBox, currentIndexChanged( int ), this, updateMRL() );
136     CONNECT( ui.sizeSubComboBox, currentIndexChanged( int ), this, updateMRL() );
137 }
138
139 FileOpenPanel::~FileOpenPanel()
140 {
141 }
142
143 /* Show a fileBrowser to select a subtitle */
144 void FileOpenPanel::browseFileSub()
145 {
146     // TODO Handle selection of more than one subtitles file
147     QStringList files = THEDP->showSimpleOpen( qtr("Open subtitles file"),
148                             EXT_FILTER_SUBTITLE,
149                             dialogBox->directory().absolutePath() );
150     if( files.isEmpty() ) return;
151     ui.subInput->setText( files.join(" ") );
152     updateMRL();
153 }
154
155 /* Update the current MRL */
156 void FileOpenPanel::updateMRL()
157 {
158     QString mrl = "";
159     foreach( QString file, dialogBox->selectedFiles() ) {
160          mrl += "\"" + file + "\" ";
161     }
162
163     if( ui.subCheckBox->isChecked() ) {
164         mrl.append( " :sub-file=\"" + ui.subInput->text() + "\"" );
165         int align = ui.alignSubComboBox->itemData(
166                     ui.alignSubComboBox->currentIndex() ).toInt();
167         mrl.append( " :subsdec-align=" + QString().setNum( align ) );
168         int size = ui.sizeSubComboBox->itemData(
169                    ui.sizeSubComboBox->currentIndex() ).toInt();
170         mrl.append( " :freetype-rel-fontsize=" + QString().setNum( size ) );
171     }
172
173     emit mrlUpdated( mrl );
174     emit methodChanged( "file-caching" );
175 }
176
177 /* Function called by Open Dialog when clicke on Play/Enqueue */
178 void FileOpenPanel::accept()
179 {
180     //TODO set the completer
181     p_intf->p_sys->psz_filepath = qtu( dialogBox->directory().absolutePath() );
182 }
183
184 void FileOpenBox::accept()
185 {
186     OpenDialog::getInstance( NULL, NULL )->play();
187 }
188
189 /* Function called by Open Dialog when clicked on cancel */
190 void FileOpenPanel::clear()
191 {
192     lineFileEdit->clear();
193     ui.subInput->clear();
194 }
195
196 void FileOpenPanel::toggleSubtitleFrame()
197 {
198     TOGGLEV( ui.subFrame );
199
200     /* Update the MRL */
201     updateMRL();
202 }
203
204 /**************************************************************************
205  * Open Discs ( DVD, CD, VCD and similar devices )                        *
206  **************************************************************************/
207 DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
208                                 OpenPanel( _parent, _p_intf )
209 {
210     ui.setupUi( this );
211
212     /* Get the default configuration path for the devices */
213     psz_dvddiscpath = config_GetPsz( p_intf, "dvd" );
214     psz_vcddiscpath = config_GetPsz( p_intf, "vcd" );
215     psz_cddadiscpath = config_GetPsz( p_intf, "cd-audio" );
216
217     /* State to avoid overwritting the users changes with the configuration */
218     b_firstdvd = true;
219     b_firstvcd = true;
220     b_firstcdda = true;
221
222 #if WIN32 /* Disc drives probing for Windows */
223     char szDrives[512];
224     szDrives[0] = '\0';
225     if( GetLogicalDriveStringsA( sizeof( szDrives ) - 1, szDrives ) )
226     {
227         char *drive = szDrives;
228         UINT oldMode = SetErrorMode( SEM_FAILCRITICALERRORS );
229         while( *drive )
230         {
231             if( GetDriveTypeA(drive) == DRIVE_CDROM )
232                 ui.deviceCombo->addItem( drive );
233
234             /* go to next drive */
235             while( *(drive++) );
236         }
237         SetErrorMode(oldMode);
238     }
239 #else /* Use a Completer under Linux */
240     QCompleter *discCompleter = new QCompleter( this );
241     discCompleter->setModel( new QDirModel( discCompleter ) );
242     ui.deviceCombo->setCompleter( discCompleter );
243 #endif
244
245     /* CONNECTs */
246     BUTTONACT( ui.dvdRadioButton, updateButtons() );
247     BUTTONACT( ui.vcdRadioButton, updateButtons() );
248     BUTTONACT( ui.audioCDRadioButton, updateButtons() );
249     BUTTONACT( ui.dvdsimple, updateButtons() );
250     BUTTONACT( ui.browseDiscButton, browseDevice() );
251     BUTTONACT( ui.ejectButton, eject() );
252
253     CONNECT( ui.deviceCombo, editTextChanged( QString ), this, updateMRL());
254     CONNECT( ui.titleSpin, valueChanged( int ), this, updateMRL());
255     CONNECT( ui.chapterSpin, valueChanged( int ), this, updateMRL());
256     CONNECT( ui.audioSpin, valueChanged( int ), this, updateMRL());
257     CONNECT( ui.subtitlesSpin, valueChanged( int ), this, updateMRL());
258
259     /* Run once the updateButtons function in order to fill correctly the comboBoxes */
260     updateButtons();
261 }
262
263 DiscOpenPanel::~DiscOpenPanel()
264 {
265     delete psz_dvddiscpath;
266     delete psz_vcddiscpath;
267     delete psz_cddadiscpath;
268 }
269
270 void DiscOpenPanel::clear()
271 {
272     ui.titleSpin->setValue( 0 );
273     ui.chapterSpin->setValue( 0 );
274     b_firstcdda = true;
275     b_firstdvd = true;
276     b_firstvcd = true;
277 }
278
279 #ifdef WIN32
280     #define setDrive( psz_name ) {\
281     int index = ui.deviceCombo->findText( qfu( psz_name ) ); \
282     if( index != -1 ) ui.deviceCombo->setCurrentIndex( index );}
283 #else
284     #define setDrive( psz_name ) {\
285     ui.deviceCombo->setEditText( qfu( psz_name ) ); }
286 #endif
287
288 /* update the buttons according the type of device */
289 void DiscOpenPanel::updateButtons()
290 {
291     if ( ui.dvdRadioButton->isChecked() )
292     {
293         if( b_firstdvd )
294         {
295             setDrive( psz_dvddiscpath );
296             b_firstdvd = false;
297         }
298         ui.titleLabel->setText( qtr("Title") );
299         ui.chapterLabel->show();
300         ui.chapterSpin->show();
301         ui.diskOptionBox_2->show();
302         ui.dvdsimple->setEnabled( true );
303     }
304     else if ( ui.vcdRadioButton->isChecked() )
305     {
306         if( b_firstvcd )
307         {
308             setDrive( psz_vcddiscpath );
309             b_firstvcd = false;
310         }
311         ui.titleLabel->setText( qtr("Entry") );
312         ui.chapterLabel->hide();
313         ui.chapterSpin->hide();
314         ui.diskOptionBox_2->show();
315         ui.dvdsimple->setEnabled( false );
316     }
317     else /* CDDA */
318     {
319         if( b_firstcdda )
320         {
321             setDrive( psz_cddadiscpath );
322             b_firstcdda = false;
323         }
324         ui.titleLabel->setText( qtr("Track") );
325         ui.chapterLabel->hide();
326         ui.chapterSpin->hide();
327         ui.diskOptionBox_2->hide();
328         ui.dvdsimple->setEnabled( false );
329     }
330
331     updateMRL();
332 }
333
334 /* Update the current MRL */
335 void DiscOpenPanel::updateMRL()
336 {
337     QString mrl = "";
338
339     /* CDDAX and VCDX not implemented. TODO ? */
340     /* DVD */
341     if( ui.dvdRadioButton->isChecked() ) {
342         if( !ui.dvdsimple->isChecked() )
343             mrl = "\"dvd://";
344         else
345             mrl = "\"dvdsimple://";
346         mrl += ui.deviceCombo->currentText();
347         emit methodChanged( "dvdnav-caching" );
348
349         if ( ui.titleSpin->value() > 0 ) {
350             mrl += QString("@%1").arg( ui.titleSpin->value() );
351             if ( ui.chapterSpin->value() > 0 ) {
352                 mrl+= QString(":%1").arg( ui.chapterSpin->value() );
353             }
354         }
355
356     /* VCD */
357     } else if ( ui.vcdRadioButton->isChecked() ) {
358         mrl = "\"vcd://" + ui.deviceCombo->currentText();
359         emit methodChanged( "vcd-caching" );
360
361         if( ui.titleSpin->value() > 0 ) {
362             mrl += QString("@E%1").arg( ui.titleSpin->value() );
363         }
364
365     /* CDDA */
366     } else {
367         mrl = "\"cdda://" + ui.deviceCombo->currentText();
368         if( ui.titleSpin->value() > 0 ) {
369             QString("@%1").arg( ui.titleSpin->value() );
370         }
371     }
372
373     mrl += "\"";
374
375     if ( ui.dvdRadioButton->isChecked() || ui.vcdRadioButton->isChecked() )
376     {
377         if ( ui.audioSpin->value() >= 0 ) {
378             mrl += " :audio-track=" +
379                 QString("%1").arg( ui.audioSpin->value() );
380         }
381         if ( ui.subtitlesSpin->value() >= 0 ) {
382             mrl += " :sub-track=" +
383                 QString("%1").arg( ui.subtitlesSpin->value() );
384         }
385     }
386     emit mrlUpdated( mrl );
387 }
388
389 void DiscOpenPanel::browseDevice()
390 {
391     QString dir = QFileDialog::getExistingDirectory( 0,
392             qtr("Open a device or a VIDEO_TS directory") );
393     if (!dir.isEmpty()) {
394         ui.deviceCombo->setEditText( dir );
395     }
396     updateMRL();
397 }
398
399 void DiscOpenPanel::eject()
400 {
401     intf_Eject( p_intf, qtu( ui.deviceCombo->currentText() ) );
402 }
403
404 void DiscOpenPanel::accept()
405 {}
406
407 /**************************************************************************
408  * Open Network streams and URL pages                                     *
409  **************************************************************************/
410 NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
411                                 OpenPanel( _parent, _p_intf )
412 {
413     ui.setupUi( this );
414
415     /* CONNECTs */
416     CONNECT( ui.protocolCombo, activated( int ),
417              this, updateProtocol( int ) );
418     CONNECT( ui.portSpin, valueChanged( int ), this, updateMRL() );
419     CONNECT( ui.addressText, textChanged( QString ), this, updateMRL());
420     CONNECT( ui.timeShift, clicked(), this, updateMRL());
421     CONNECT( ui.ipv6, clicked(), this, updateMRL());
422
423     typedef QPair<QString,QString> QPairString;
424     QMap<int, QPairString> protocols;
425 #define P(value,name,dsc) do { protocols[value] = QPairString( QString(dsc), QString(name) );} while(0)
426     P( NO_PROTO,    "",         "" );
427     P( UDPM_PROTO,  "udp",      "UDP/RTP (multicast)" );
428     P( HTTP_PROTO,  "http",     "HTTP" );
429     P( HTTPS_PROTO, "https",    "HTTPS" );
430     P( MMS_PROTO,   "mms",      "MMS" );
431     P( FTP_PROTO,   "ftp",      "FTP" );
432     P( RTSP_PROTO,  "rtsp",     "RTSP" );
433     P( UDP_PROTO,   "udp",      "UDP/RTP (unicast)" );
434     P( RTMP_PROTO,  "rtmp",     "RTMP" );
435 #undef P
436     foreach( QPairString e, protocols ) /* Sorted by key, exactly what we need */
437         ui.protocolCombo->addItem( e.first, QVariant(e.second.isEmpty() ) );
438 }
439
440 NetOpenPanel::~NetOpenPanel()
441 {}
442
443 void NetOpenPanel::clear()
444 {}
445
446 /* update the widgets according the type of protocol */
447 void NetOpenPanel::updateProtocol( int idx_proto ) {
448     QString addr = ui.addressText->text();
449     QString proto = ui.protocolCombo->itemData( idx_proto ).toString();
450
451     ui.timeShift->setEnabled( idx_proto == UDP_PROTO ||
452                               idx_proto == UDPM_PROTO );
453     ui.ipv6->setEnabled( idx_proto == UDP_PROTO );
454     ui.addressText->setEnabled( idx_proto != UDP_PROTO );
455     ui.portSpin->setEnabled( idx_proto == UDP_PROTO ||
456                              idx_proto == UDPM_PROTO );
457
458     if( idx_proto == NO_PROTO ) return;
459
460     /* If we already have a protocol in the address, replace it */
461     if( addr.contains( "://"))
462     {
463         if( idx_proto != UDPM_PROTO )
464             addr.replace( QRegExp("^.*://@*"), proto + "://");
465         else
466              addr.replace( QRegExp("^.*://"), proto + "://@");
467         ui.addressText->setText( addr );
468     }
469     updateMRL();
470 }
471
472 void NetOpenPanel::updateMRL() {
473     QString mrl = "";
474     QString addr = ui.addressText->text();
475     addr = QUrl::toPercentEncoding( addr, ":/?#@!$&'()*+,;=" );
476     int idx_proto = ui.protocolCombo->currentIndex();
477
478     if( addr.contains( "://"))
479     {
480         /* Match the correct item in the comboBox */
481         ui.protocolCombo->setCurrentIndex(
482                 ui.protocolCombo->findData( addr.section( ':', 0, 0 ) ) );
483
484         if( idx_proto != UDP_PROTO || idx_proto != UDPM_PROTO )
485             mrl = addr;
486     }
487     else
488     {
489         switch( idx_proto ) {
490         case HTTP_PROTO:
491             mrl = "http://" + addr;
492             emit methodChanged("http-caching");
493             break;
494         case HTTPS_PROTO:
495             mrl = "https://" + addr;
496             emit methodChanged("http-caching");
497             break;
498         case MMS_PROTO:
499             mrl = "mms://" + addr;
500             emit methodChanged("mms-caching");
501             break;
502         case FTP_PROTO:
503             mrl = "ftp://" + addr;
504             emit methodChanged("ftp-caching");
505             break;
506         case RTSP_PROTO:
507             mrl = "rtsp://" + addr;
508             emit methodChanged("rtsp-caching");
509             break;
510         case UDP_PROTO:
511             mrl = "udp://@";
512             if( ui.ipv6->isEnabled() && ui.ipv6->isChecked() )
513             {
514                 mrl += "[::]";
515             }
516             mrl += QString(":%1").arg( ui.portSpin->value() );
517             emit methodChanged("udp-caching");
518             break;
519         case UDPM_PROTO: /* UDP multicast */
520             mrl = "udp://@";
521             /* Add [] to IPv6 */
522             if ( addr.contains(':') && !addr.contains('[') )
523             {
524                 mrl += "[" + addr + "]";
525             }
526             else mrl += addr;
527             mrl += QString(":%1").arg( ui.portSpin->value() );
528             emit methodChanged("udp-caching");
529             break;
530         case RTMP_PROTO:
531             mrl = "rtmp://" + addr;
532             emit methodChanged("rtmp-caching");
533             break;
534
535         }
536     }
537
538     // Encode the boring stuffs
539
540     if( ui.timeShift->isEnabled() && ui.timeShift->isChecked() ) {
541         mrl += " :access-filter=timeshift";
542     }
543     emit mrlUpdated( mrl );
544 }
545
546 /**************************************************************************
547  * Open Capture device ( DVB, PVR, V4L, and similar )                     *
548  **************************************************************************/
549 CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
550                                 OpenPanel( _parent, _p_intf )
551 {
552     ui.setupUi( this );
553
554     BUTTONACT( ui.advancedButton, advancedDialog() );
555
556     /* Create two stacked layouts in the main comboBoxes */
557     QStackedLayout *stackedDevLayout = new QStackedLayout;
558     ui.cardBox->setLayout( stackedDevLayout );
559
560     QStackedLayout *stackedPropLayout = new QStackedLayout;
561     ui.optionsBox->setLayout( stackedPropLayout );
562
563     /* Creation and connections of the WIdgets in the stacked layout */
564 #define addModuleAndLayouts( number, name, label )                    \
565     QWidget * name ## DevPage = new QWidget( this );                  \
566     QWidget * name ## PropPage = new QWidget( this );                 \
567     stackedDevLayout->addWidget( name ## DevPage );        \
568     stackedPropLayout->addWidget( name ## PropPage );      \
569     QGridLayout * name ## DevLayout = new QGridLayout;                \
570     QGridLayout * name ## PropLayout = new QGridLayout;               \
571     name ## DevPage->setLayout( name ## DevLayout );                  \
572     name ## PropPage->setLayout( name ## PropLayout );                \
573     ui.deviceCombo->addItem( qtr( label ), QVariant( number ) );
574
575 #define CuMRL( widget, slot ) CONNECT( widget , slot , this, updateMRL() );
576
577 #ifdef WIN32
578     /*********************
579      * DirectShow Stuffs *
580      *********************/
581     if( module_Exists( p_intf, "dshow" ) ){
582     addModuleAndLayouts( DSHOW_DEVICE, dshow, "DirectShow" );
583
584     /* dshow Main */
585     int line = 0;
586     module_config_t *p_config =
587         config_FindConfig( VLC_OBJECT(p_intf), "dshow-vdev" );
588     vdevDshowW = new StringListConfigControl(
589         VLC_OBJECT(p_intf), p_config, this, false, dshowDevLayout, line );
590     line++;
591
592     p_config = config_FindConfig( VLC_OBJECT(p_intf), "dshow-adev" );
593     adevDshowW = new StringListConfigControl(
594         VLC_OBJECT(p_intf), p_config, this, false, dshowDevLayout, line );
595     line++;
596
597     /* dshow Properties */
598     QLabel *dshowVSizeLabel = new QLabel( qtr( "Video size" ) );
599     dshowPropLayout->addWidget( dshowVSizeLabel, 0, 0 );
600
601     dshowVSizeLine = new QLineEdit;
602     dshowPropLayout->addWidget( dshowVSizeLine, 0, 1);
603     dshowPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
604             1, 0, 3, 1 );
605
606     /* dshow CONNECTs */
607     CuMRL( vdevDshowW->combo, currentIndexChanged ( int ) );
608     CuMRL( adevDshowW->combo, currentIndexChanged ( int ) );
609     CuMRL( dshowVSizeLine, textChanged( QString ) );
610     }
611
612     /**************
613      * BDA Stuffs *
614      **************/
615     if( module_Exists( p_intf, "bda" ) ){
616     addModuleAndLayouts( BDA_DEVICE, bda, "DVB DirectShow" );
617
618     /* bda Main */
619     QLabel *bdaTypeLabel = new QLabel( qtr( "DVB Type:" ) );
620
621     bdas = new QRadioButton( "DVB-S" );
622     bdas->setChecked( true );
623     bdac = new QRadioButton( "DVB-C" );
624     bdat = new QRadioButton( "DVB-T" );
625
626     bdaDevLayout->addWidget( bdaTypeLabel, 0, 0 );
627     bdaDevLayout->addWidget( bdas, 0, 1 );
628     bdaDevLayout->addWidget( bdac, 0, 2 );
629     bdaDevLayout->addWidget( bdat, 0, 3 );
630
631     /* bda Props */
632     QLabel *bdaFreqLabel =
633                     new QLabel( qtr( "Transponder/multiplex frequency" ) );
634     bdaPropLayout->addWidget( bdaFreqLabel, 0, 0 );
635
636     bdaFreq = new QSpinBox;
637     bdaFreq->setAlignment( Qt::AlignRight );
638     bdaFreq->setSuffix(" kHz");
639     bdaFreq->setSingleStep( 1000 );
640     setSpinBoxFreq( bdaFreq )
641     bdaPropLayout->addWidget( bdaFreq, 0, 1 );
642
643     bdaSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
644     bdaPropLayout->addWidget( bdaSrateLabel, 1, 0 );
645
646     bdaSrate = new QSpinBox;
647     bdaSrate->setAlignment( Qt::AlignRight );
648     bdaSrate->setSuffix(" kHz");
649     setSpinBoxFreq( bdaSrate );
650     bdaPropLayout->addWidget( bdaSrate, 1, 1 );
651
652     bdaBandLabel = new QLabel( qtr( "Bandwidth" ) );
653     bdaPropLayout->addWidget( bdaBandLabel, 2, 0 );
654
655     bdaBandBox = new QComboBox;
656     setfillVLCConfigCombo( "dvb-bandwidth", p_intf, bdaBandBox );
657     bdaPropLayout->addWidget( bdaBandBox, 2, 1 );
658
659     bdaBandLabel->hide();
660     bdaBandBox->hide();
661     bdaPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
662             2, 0, 2, 1 );
663
664     /* bda CONNECTs */
665     CuMRL( bdaFreq, valueChanged ( int ) );
666     CuMRL( bdaSrate, valueChanged ( int ) );
667     CuMRL( bdaBandBox,  currentIndexChanged ( int ) );
668     BUTTONACT( bdas, updateButtons() );
669     BUTTONACT( bdat, updateButtons() );
670     BUTTONACT( bdac, updateButtons() );
671     BUTTONACT( bdas, updateMRL() );
672     BUTTONACT( bdat, updateMRL() );
673     BUTTONACT( bdac, updateMRL() );
674     }
675
676 #else /* WIN32 */
677     /*******
678      * V4L2*
679      *******/
680     if( module_Exists( p_intf, "v4l2" ) ){
681     addModuleAndLayouts( V4L2_DEVICE, v4l2, "Video for Linux 2" );
682
683     /* V4l Main panel */
684     QLabel *v4l2VideoDeviceLabel = new QLabel( qtr( "Video device name" ) );
685     v4l2DevLayout->addWidget( v4l2VideoDeviceLabel, 0, 0 );
686
687     v4l2VideoDevice = new QLineEdit;
688     v4l2DevLayout->addWidget( v4l2VideoDevice, 0, 1 );
689
690     QLabel *v4l2AudioDeviceLabel = new QLabel( qtr( "Audio device name" ) );
691     v4l2DevLayout->addWidget( v4l2AudioDeviceLabel, 1, 0 );
692
693     v4l2AudioDevice = new QLineEdit;
694     v4l2DevLayout->addWidget( v4l2AudioDevice, 1, 1 );
695
696     /* v4l2 Props panel */
697     QLabel *v4l2StdLabel = new QLabel( qtr( "Standard" ) );
698     v4l2PropLayout->addWidget( v4l2StdLabel, 0 , 0 );
699
700     v4l2StdBox = new QComboBox;
701     setfillVLCConfigCombo( "v4l2-standard", p_intf, v4l2StdBox );
702     v4l2PropLayout->addWidget( v4l2StdBox, 0 , 1 );
703     v4l2PropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
704             1, 0, 3, 1 );
705
706     /* v4l2 CONNECTs */
707     CuMRL( v4l2VideoDevice, textChanged( QString ) );
708     CuMRL( v4l2AudioDevice, textChanged( QString ) );
709     CuMRL( v4l2StdBox,  currentIndexChanged ( int ) );
710     }
711
712     /*******
713      * V4L *
714      *******/
715     if( module_Exists( p_intf, "v4l" ) ){
716     addModuleAndLayouts( V4L_DEVICE, v4l, "Video for Linux" );
717
718     /* V4l Main panel */
719     QLabel *v4lVideoDeviceLabel = new QLabel( qtr( "Video device name" ) );
720     v4lDevLayout->addWidget( v4lVideoDeviceLabel, 0, 0 );
721
722     v4lVideoDevice = new QLineEdit;
723     v4lDevLayout->addWidget( v4lVideoDevice, 0, 1 );
724
725     QLabel *v4lAudioDeviceLabel = new QLabel( qtr( "Audio device name" ) );
726     v4lDevLayout->addWidget( v4lAudioDeviceLabel, 1, 0 );
727
728     v4lAudioDevice = new QLineEdit;
729     v4lDevLayout->addWidget( v4lAudioDevice, 1, 1 );
730
731     /* V4l Props panel */
732     QLabel *v4lNormLabel = new QLabel( qtr( "Norm" ) );
733     v4lPropLayout->addWidget( v4lNormLabel, 0 , 0 );
734
735     v4lNormBox = new QComboBox;
736     setfillVLCConfigCombo( "v4l-norm", p_intf, v4lNormBox );
737     v4lPropLayout->addWidget( v4lNormBox, 0 , 1 );
738
739     QLabel *v4lFreqLabel = new QLabel( qtr( "Frequency" ) );
740     v4lPropLayout->addWidget( v4lFreqLabel, 1 , 0 );
741
742     v4lFreq = new QSpinBox;
743     v4lFreq->setAlignment( Qt::AlignRight );
744     v4lFreq->setSuffix(" kHz");
745     setSpinBoxFreq( v4lFreq );
746     v4lPropLayout->addWidget( v4lFreq, 1 , 1 );
747     v4lPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
748             2, 0, 2, 1 );
749
750     /* v4l CONNECTs */
751     CuMRL( v4lVideoDevice, textChanged( QString ) );
752     CuMRL( v4lAudioDevice, textChanged( QString ) );
753     CuMRL( v4lFreq, valueChanged ( int ) );
754     CuMRL( v4lNormBox,  currentIndexChanged ( int ) );
755     }
756
757     /*******
758      * JACK *
759      *******/
760     if( module_Exists( p_intf, "jack" ) ){
761     addModuleAndLayouts( JACK_DEVICE, jack, "JACK Audio Connection Kit" );
762
763     /* Jack Main panel */
764     /* Channels */
765     QLabel *jackChannelsLabel = new QLabel( qtr( "Channels:" ) );
766     jackDevLayout->addWidget( jackChannelsLabel, 1, 0 );
767
768     jackChannels = new QSpinBox;
769     setSpinBoxFreq( jackChannels );
770     jackChannels->setMaximum(255);
771     jackChannels->setValue(2);
772     jackChannels->setAlignment( Qt::AlignRight );
773     jackDevLayout->addWidget( jackChannels, 1, 1 );
774
775     /* Jack Props panel */
776
777     /* Selected ports */
778     QLabel *jackPortsLabel = new QLabel( qtr( "Selected ports:" ) );
779     jackPropLayout->addWidget( jackPortsLabel, 0 , 0 );
780
781     jackPortsSelected = new QLineEdit( qtr( ".*") );
782     jackPortsSelected->setAlignment( Qt::AlignRight );
783     jackPropLayout->addWidget( jackPortsSelected, 0, 1 );
784
785     /* Caching */
786     QLabel *jackCachingLabel = new QLabel( qtr( "Input caching:" ) );
787     jackPropLayout->addWidget( jackCachingLabel, 1 , 0 );
788     jackCaching = new QSpinBox;
789     setSpinBoxFreq( jackCaching );
790     jackCaching->setSuffix( " ms" );
791     jackCaching->setValue(1000);
792     jackCaching->setAlignment( Qt::AlignRight );
793     jackPropLayout->addWidget( jackCaching, 1 , 1 );
794
795     /* Pace */
796     jackPace = new QCheckBox(qtr( "Use VLC pace" ));
797     jackPropLayout->addWidget( jackPace, 2, 1 );
798
799     /* Auto Connect */
800     jackConnect = new QCheckBox( qtr( "Auto connnection" ));
801     jackPropLayout->addWidget( jackConnect, 3, 1 );
802
803     /* Jack CONNECTs */
804     CuMRL( jackChannels, valueChanged( int ) );
805     CuMRL( jackCaching, valueChanged( int ) );
806     CuMRL( jackPace, stateChanged( int ) );
807     CuMRL( jackConnect, stateChanged( int ) );
808     CuMRL( jackPortsSelected, textChanged( QString ) );
809     }
810
811     /************
812      * PVR      *
813      ************/
814     if( module_Exists( p_intf, "pvr" ) ){
815     addModuleAndLayouts( PVR_DEVICE, pvr, "PVR" );
816
817     /* PVR Main panel */
818     QLabel *pvrDeviceLabel = new QLabel( qtr( "Device name" ) );
819     pvrDevLayout->addWidget( pvrDeviceLabel, 0, 0 );
820
821     pvrDevice = new QLineEdit;
822     pvrDevLayout->addWidget( pvrDevice, 0, 1 );
823
824     QLabel *pvrRadioDeviceLabel = new QLabel( qtr( "Radio device name" ) );
825     pvrDevLayout->addWidget( pvrRadioDeviceLabel, 1, 0 );
826
827     pvrRadioDevice = new QLineEdit;
828     pvrDevLayout->addWidget( pvrRadioDevice, 1, 1 );
829
830     /* PVR props panel */
831     QLabel *pvrNormLabel = new QLabel( qtr( "Norm" ) );
832     pvrPropLayout->addWidget( pvrNormLabel, 0, 0 );
833
834     pvrNormBox = new QComboBox;
835     setfillVLCConfigCombo( "pvr-norm", p_intf, pvrNormBox );
836     pvrPropLayout->addWidget( pvrNormBox, 0, 1 );
837
838     QLabel *pvrFreqLabel = new QLabel( qtr( "Frequency" ) );
839     pvrPropLayout->addWidget( pvrFreqLabel, 1, 0 );
840
841     pvrFreq = new QSpinBox;
842     pvrFreq->setAlignment( Qt::AlignRight );
843     pvrFreq->setSuffix(" kHz");
844     setSpinBoxFreq( pvrFreq );
845     pvrPropLayout->addWidget( pvrFreq, 1, 1 );
846
847     QLabel *pvrBitrLabel = new QLabel( qtr( "Bitrate" ) );
848     pvrPropLayout->addWidget( pvrBitrLabel, 2, 0 );
849
850     pvrBitr = new QSpinBox;
851     pvrBitr->setAlignment( Qt::AlignRight );
852     pvrBitr->setSuffix(" kHz");
853     setSpinBoxFreq( pvrBitr );
854     pvrPropLayout->addWidget( pvrBitr, 2, 1 );
855     pvrPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
856             3, 0, 1, 1 );
857
858     /* PVR CONNECTs */
859     CuMRL( pvrDevice, textChanged( QString ) );
860     CuMRL( pvrRadioDevice, textChanged( QString ) );
861
862     CuMRL( pvrFreq, valueChanged ( int ) );
863     CuMRL( pvrBitr, valueChanged ( int ) );
864     CuMRL( pvrNormBox, currentIndexChanged ( int ) );
865     }
866
867     /**************
868      * DVB Stuffs *
869      **************/
870     if( module_Exists( p_intf, "dvb" ) ){
871     addModuleAndLayouts( DVB_DEVICE, dvb, "DVB" );
872
873     /* DVB Main */
874     QLabel *dvbDeviceLabel = new QLabel( qtr( "Adapter card to tune" ) );
875     QLabel *dvbTypeLabel = new QLabel( qtr( "DVB Type:" ) );
876
877     dvbCard = new QSpinBox;
878     dvbCard->setAlignment( Qt::AlignRight );
879     dvbCard->setPrefix( "/dev/dvb/adapter" );
880
881     dvbDevLayout->addWidget( dvbDeviceLabel, 0, 0 );
882     dvbDevLayout->addWidget( dvbCard, 0, 2, 1, 2 );
883
884     dvbs = new QRadioButton( "DVB-S" );
885     dvbs->setChecked( true );
886     dvbc = new QRadioButton( "DVB-C" );
887     dvbt = new QRadioButton( "DVB-T" );
888
889     dvbDevLayout->addWidget( dvbTypeLabel, 1, 0 );
890     dvbDevLayout->addWidget( dvbs, 1, 1 );
891     dvbDevLayout->addWidget( dvbc, 1, 2 );
892     dvbDevLayout->addWidget( dvbt, 1, 3 );
893
894     /* DVB Props panel */
895     QLabel *dvbFreqLabel =
896                     new QLabel( qtr( "Transponder/multiplex frequency" ) );
897     dvbPropLayout->addWidget( dvbFreqLabel, 0, 0 );
898
899     dvbFreq = new QSpinBox;
900     dvbFreq->setAlignment( Qt::AlignRight );
901     dvbFreq->setSuffix(" kHz");
902     setSpinBoxFreq( dvbFreq  );
903     dvbPropLayout->addWidget( dvbFreq, 0, 1 );
904
905     QLabel *dvbSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
906     dvbPropLayout->addWidget( dvbSrateLabel, 1, 0 );
907
908     dvbSrate = new QSpinBox;
909     dvbSrate->setAlignment( Qt::AlignRight );
910     dvbSrate->setSuffix(" kHz");
911     setSpinBoxFreq( dvbSrate );
912     dvbPropLayout->addWidget( dvbSrate, 1, 1 );
913     dvbPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
914             2, 0, 2, 1 );
915
916     /* DVB CONNECTs */
917     CuMRL( dvbCard, valueChanged ( int ) );
918     CuMRL( dvbFreq, valueChanged ( int ) );
919     CuMRL( dvbSrate, valueChanged ( int ) );
920
921     BUTTONACT( dvbs, updateButtons() );
922     BUTTONACT( dvbt, updateButtons() );
923     BUTTONACT( dvbc, updateButtons() );
924     }
925
926 #endif
927
928
929     /**********
930      * Screen *
931      **********/
932     addModuleAndLayouts( SCREEN_DEVICE, screen, "Desktop" );
933     QLabel *screenLabel = new QLabel( "This option will open your own "
934             "desktop in order to save or stream it.");
935     screenLabel->setWordWrap( true );
936     screenDevLayout->addWidget( screenLabel, 0, 0 );
937
938     /* General connects */
939     CONNECT( ui.deviceCombo, activated( int ) ,
940              stackedDevLayout, setCurrentIndex( int ) );
941     CONNECT( ui.deviceCombo, activated( int ),
942              stackedPropLayout, setCurrentIndex( int ) );
943     CONNECT( ui.deviceCombo, activated( int ), this, updateMRL() );
944     CONNECT( ui.deviceCombo, activated( int ), this, updateButtons() );
945
946 #undef addModule
947 }
948
949 CaptureOpenPanel::~CaptureOpenPanel()
950 {
951 }
952
953 void CaptureOpenPanel::clear()
954 {
955     advMRL.clear();
956 }
957
958 void CaptureOpenPanel::updateMRL()
959 {
960     QString mrl = "";
961     int i_devicetype = ui.deviceCombo->itemData(
962             ui.deviceCombo->currentIndex() ).toInt();
963     switch( i_devicetype )
964     {
965 #ifdef WIN32
966     case BDA_DEVICE:
967         if( bdas->isChecked() ) mrl = "dvb-s://";
968         else if(  bdat->isChecked() ) mrl = "dvb-t://";
969         else if(  bdac->isChecked() ) mrl = "dvb-c://";
970         else return;
971         mrl += " :dvb-frequency=" + QString("%1").arg( bdaFreq->value() );
972         if( bdas->isChecked() || bdac->isChecked() )
973             mrl += " :dvb-srate=" + QString("%1").arg( bdaSrate->value() );
974         else
975             mrl += " :dvb-bandwidth=" +
976                 QString("%1").arg( bdaBandBox->itemData(
977                     bdaBandBox->currentIndex() ).toInt() );
978         break;
979     case DSHOW_DEVICE:
980         mrl = "dshow://";
981         mrl+= " :dshow-vdev=" + QString("\"%1\"").arg( vdevDshowW->getValue() );
982         mrl+= " :dshow-adev=" + QString("\"%1\"").arg( adevDshowW->getValue() );
983         if( dshowVSizeLine->isModified() )
984             mrl += " :dshow-size=" + dshowVSizeLine->text();
985         break;
986 #else
987     case V4L_DEVICE:
988         mrl = "v4l://";
989         mrl += " :v4l-vdev=" + v4lVideoDevice->text();
990         mrl += " :v4l-adev=" + v4lAudioDevice->text();
991         mrl += " :v4l-norm=" + QString("%1").arg( v4lNormBox->currentIndex() );
992         mrl += " :v4l-frequency=" + QString("%1").arg( v4lFreq->value() );
993         break;
994     case V4L2_DEVICE:
995         mrl = "v4l2://";
996         mrl += " :v4l2-dev=" + v4l2VideoDevice->text();
997         mrl += " :v4l2-adev=" + v4l2AudioDevice->text();
998         mrl += " :v4l2-standard=" + QString("%1").arg( v4l2StdBox->currentIndex() );
999         break;
1000     case JACK_DEVICE:
1001         mrl = "jack://";
1002         mrl += "channels=" + QString("%1").arg( jackChannels->value() );
1003         mrl += ":ports=" + jackPortsSelected->text();
1004         mrl += " --jack-input-caching=" + QString("%1").arg( jackCaching->value() );
1005         if ( jackPace->isChecked() )
1006         {
1007                 mrl += " --jack-input-use-vlc-pace";
1008         }
1009         if ( jackConnect->isChecked() )
1010         {
1011                 mrl += " --jack-input-auto-connect";
1012         }
1013         break;
1014     case PVR_DEVICE:
1015         mrl = "pvr://";
1016         mrl += " :pvr-device=" + pvrDevice->text();
1017         mrl += " :pvr-radio-device=" + pvrRadioDevice->text();
1018         mrl += " :pvr-norm=" + QString("%1").arg( pvrNormBox->currentIndex() );
1019         if( pvrFreq->value() )
1020             mrl += " :pvr-frequency=" + QString("%1").arg( pvrFreq->value() );
1021         if( pvrBitr->value() )
1022             mrl += " :pvr-bitrate=" + QString("%1").arg( pvrBitr->value() );
1023         break;
1024     case DVB_DEVICE:
1025         mrl = "dvb://";
1026         mrl += " :dvb-adapter=" + QString("%1").arg( dvbCard->value() );
1027         mrl += " :dvb-frequency=" + QString("%1").arg( dvbFreq->value() );
1028         mrl += " :dvb-srate=" + QString("%1").arg( dvbSrate->value() );
1029         break;
1030 #endif
1031     case SCREEN_DEVICE:
1032         mrl = "screen://";
1033         updateButtons();
1034         break;
1035     }
1036
1037     if( !advMRL.isEmpty() ) mrl += advMRL;
1038
1039     emit mrlUpdated( mrl );
1040 }
1041
1042 /**
1043  * Update the Buttons (show/hide) for the GUI as all device type don't
1044  * use the same ui. elements.
1045  **/
1046 void CaptureOpenPanel::updateButtons()
1047 {
1048     /*  Be sure to display the ui Elements in case they were hidden by
1049      *  some Device Type (like Screen://) */
1050     ui.optionsBox->show();
1051     ui.advancedButton->show();
1052     /* Get the current Device Number */
1053     int i_devicetype = ui.deviceCombo->itemData(
1054                                 ui.deviceCombo->currentIndex() ).toInt();
1055     switch( i_devicetype )
1056     {
1057 #ifdef WIN32
1058     case BDA_DEVICE:
1059         if( bdas->isChecked() || bdac->isChecked() )
1060         {
1061             bdaSrate->show();
1062             bdaSrateLabel->show();
1063             bdaBandBox->hide();
1064             bdaBandLabel->hide();
1065         }
1066         else
1067         {
1068             bdaSrate->hide();
1069             bdaSrateLabel->hide();
1070             bdaBandBox->show();
1071             bdaBandLabel->show();
1072         }
1073         break;
1074 #else
1075     case DVB_DEVICE:
1076         if( dvbs->isChecked() ) dvbFreq->setSuffix(" kHz");
1077         if( dvbc->isChecked() || dvbt->isChecked() ) dvbFreq->setSuffix(" Hz");
1078         break;
1079 #endif
1080     case SCREEN_DEVICE:
1081         ui.optionsBox->hide();
1082         ui.advancedButton->hide();
1083         break;
1084     }
1085
1086     advMRL.clear();
1087 }
1088
1089 void CaptureOpenPanel::advancedDialog()
1090 {
1091     /* Get selected device type */
1092     int i_devicetype = ui.deviceCombo->itemData(
1093                                 ui.deviceCombo->currentIndex() ).toInt();
1094
1095     /* Get the corresponding module */
1096     module_t *p_module =
1097         module_Find( VLC_OBJECT(p_intf), psz_devModule[i_devicetype] );
1098     if( NULL == p_module ) return;
1099
1100     /* Init */
1101     QList<ConfigControl *> controls;
1102
1103     /* Get the confsize  */
1104     unsigned int i_confsize;
1105     module_config_t *p_config;
1106     p_config = module_GetConfig( p_module, &i_confsize );
1107
1108     /* New Adv Prop dialog */
1109     adv = new QDialog( this );
1110     adv->setWindowTitle( qtr( "Advanced options..." ) );
1111
1112     /* A main Layout with a Frame */
1113     QVBoxLayout *mainLayout = new QVBoxLayout( adv );
1114     QFrame *advFrame = new QFrame;
1115     QScrollArea *scroll = new QScrollArea;
1116     mainLayout->addWidget( scroll );
1117
1118     /* GridLayout inside the Frame */
1119     QGridLayout *gLayout = new QGridLayout( advFrame );
1120     gLayout->setSizeConstraint( QLayout::SetFixedSize );
1121
1122     scroll->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
1123     scroll->setWidgetResizable( true );
1124     scroll->setWidget( advFrame );
1125
1126     /* Create the options inside the FrameLayout */
1127     for( int n = 0; n < i_confsize; n++ )
1128     {
1129         module_config_t *p_item = p_config + n;
1130         ConfigControl *config = ConfigControl::createControl(
1131                         VLC_OBJECT( p_intf ), p_item, advFrame, gLayout, n );
1132         controls.append( config );
1133     }
1134
1135     /* Button stuffs */
1136     QDialogButtonBox *advButtonBox = new QDialogButtonBox( adv );
1137     QPushButton *closeButton = new QPushButton( qtr( "Ok" ) );
1138     QPushButton *cancelButton = new QPushButton( qtr( "Cancel" ) );
1139
1140     CONNECT( closeButton, clicked(), adv, accept() );
1141     CONNECT( cancelButton, clicked(), adv, reject() );
1142
1143     advButtonBox->addButton( closeButton, QDialogButtonBox::AcceptRole );
1144     advButtonBox->addButton( cancelButton, QDialogButtonBox::RejectRole );
1145
1146     mainLayout->addWidget( advButtonBox );
1147
1148     /* Creation of the MRL */
1149     if( adv->exec() )
1150     {
1151         QString tempMRL = "";
1152         for( int i = 0; i < controls.size(); i++ )
1153         {
1154             ConfigControl *control = controls[i];
1155             if( !control )
1156             {
1157                 msg_Dbg( p_intf, "This shouldn't happen, please report" );
1158                 continue;
1159             }
1160
1161             tempMRL += (i ? " :" : ":");
1162
1163             if( control->getType() == CONFIG_ITEM_BOOL )
1164                 if( !(qobject_cast<VIntConfigControl *>(control)->getValue() ) )
1165                     tempMRL += "no-";
1166
1167             tempMRL += control->getName();
1168
1169             switch( control->getType() )
1170             {
1171                 case CONFIG_ITEM_STRING:
1172                 case CONFIG_ITEM_FILE:
1173                 case CONFIG_ITEM_DIRECTORY:
1174                 case CONFIG_ITEM_MODULE:
1175                     tempMRL += QString("=\"%1\"").arg( qobject_cast<VStringConfigControl *>(control)->getValue() );
1176                     break;
1177                 case CONFIG_ITEM_INTEGER:
1178                     tempMRL += QString("=%1").arg( qobject_cast<VIntConfigControl *>(control)->getValue() );
1179                     break;
1180                 case CONFIG_ITEM_FLOAT:
1181                     tempMRL += QString("=%1").arg( qobject_cast<VFloatConfigControl *>(control)->getValue() );
1182                     break;
1183             }
1184         }
1185         advMRL = tempMRL;
1186         updateMRL();
1187         msg_Dbg( p_intf, "%s", qtu( advMRL ) );
1188     }
1189     delete adv;
1190 }
1191