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