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