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