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