1 /*****************************************************************************
2 * open.cpp : Panels for the open dialogs
3 ****************************************************************************
4 * Copyright (C) 2006-2009 the VideoLAN team
5 * Copyright (C) 2007 Société des arts technologiques
6 * Copyright (C) 2007 Savoir-faire Linux
10 * Authors: Clément Stenac <zorglub@videolan.org>
11 * Jean-Baptiste Kempf <jb@videolan.org>
12 * Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
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.
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.
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 *****************************************************************************/
34 #include "components/open_panels.hpp"
35 #include "dialogs/open.hpp"
36 #include "dialogs_provider.hpp" /* Open Subtitle file */
37 #include "util/qt_dirs.hpp"
39 #include <QFileDialog>
40 #include <QDialogButtonBox>
42 #include <QStackedLayout>
46 #include <QScrollArea>
48 #include <QStringListModel>
50 #define I_DEVICE_TOOLTIP N_("Select the device or the VIDEO_TS directory")
52 static const char *psz_devModule[] = { "v4l", "v4l2", "pvr", "dvb", "bda",
53 "dshow", "screen", "jack" };
55 /**************************************************************************
56 * Open Files and subtitles *
57 **************************************************************************/
58 FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
59 OpenPanel( _parent, _p_intf ), dialogBox( NULL )
61 /* Classic UI Setup */
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(" *")); */
74 /* lineFileEdit = ui.fileEdit;
75 //TODO later: fill the fileCompleteList with previous items played.
76 QCompleter *fileCompleter = new QCompleter( fileCompleteList, this );
77 fileCompleter->setModel( new QDirModel( fileCompleter ) );
78 lineFileEdit->setCompleter( fileCompleter );*/
79 if( config_GetInt( p_intf, "qt-embedded-open" ) )
81 ui.tempWidget->hide();
86 /* Deactivate the subtitles control by default. */
87 ui.subFrame->setEnabled( false );
88 /* Build the subs size combo box */
89 setfillVLCConfigCombo( "freetype-rel-fontsize" , p_intf,
91 /* Build the subs align combo box */
92 setfillVLCConfigCombo( "subsdec-align", p_intf, ui.alignSubComboBox );
95 BUTTONACT( ui.fileBrowseButton, browseFile() );
96 BUTTONACT( ui.delFileButton, deleteFile() );
98 BUTTONACT( ui.subBrowseButton, browseFileSub() );
99 CONNECT( ui.subCheckBox, toggled( bool ), this, toggleSubtitleFrame( bool ) );
101 CONNECT( ui.fileListWidg, itemChanged( QListWidgetItem * ), this, updateMRL() );
102 CONNECT( ui.subInput, textChanged( const QString& ), this, updateMRL() );
103 CONNECT( ui.alignSubComboBox, currentIndexChanged( int ), this, updateMRL() );
104 CONNECT( ui.sizeSubComboBox, currentIndexChanged( int ), this, updateMRL() );
107 inline void FileOpenPanel::BuildOldPanel()
109 /** BEGIN QFileDialog tweaking **/
110 /* Use a QFileDialog and customize it because we don't want to
111 rewrite it all. Be careful to your eyes cause there are a few hacks.
112 Be very careful and test correctly when you modify this. */
114 /* Make this QFileDialog a child of tempWidget from the ui. */
115 dialogBox = new FileOpenBox( ui.tempWidget, NULL,
116 p_intf->p_sys->filepath, "" );
118 dialogBox->setFileMode( QFileDialog::ExistingFiles );
119 dialogBox->setAcceptMode( QFileDialog::AcceptOpen );
120 dialogBox->restoreState(
121 getSettings()->value( "file-dialog-state" ).toByteArray() );
123 /* We don't want to see a grip in the middle of the window, do we? */
124 dialogBox->setSizeGripEnabled( false );
127 dialogBox->setToolTip( qtr( "Select one or multiple files" ) );
128 dialogBox->setMinimumHeight( 250 );
130 // But hide the two OK/Cancel buttons. Enable them for debug.
131 QDialogButtonBox *fileDialogAcceptBox =
132 dialogBox->findChildren<QDialogButtonBox*>()[0];
133 fileDialogAcceptBox->hide();
135 /* Ugly hacks to get the good Widget */
136 //This lineEdit is the normal line in the fileDialog.
137 QLineEdit *lineFileEdit = dialogBox->findChildren<QLineEdit*>()[0];
138 /* Make a list of QLabel inside the QFileDialog to access the good ones */
139 QList<QLabel *> listLabel = dialogBox->findChildren<QLabel*>();
141 /* Hide the FileNames one. Enable it for debug */
142 listLabel[1]->setText( qtr( "File names:" ) );
143 /* Change the text that was uncool in the usual box */
144 listLabel[2]->setText( qtr( "Filter:" ) );
146 dialogBox->layout()->setMargin( 0 );
147 dialogBox->layout()->setSizeConstraint( QLayout::SetNoConstraint );
149 /** END of QFileDialog tweaking **/
151 // Add the DialogBox to the layout
152 ui.gridLayout->addWidget( dialogBox, 0, 0, 1, 3 );
154 CONNECT( lineFileEdit, textChanged( const QString& ), this, updateMRL() );
155 dialogBox->installEventFilter( this );
158 FileOpenPanel::~FileOpenPanel()
161 getSettings()->setValue( "file-dialog-state", dialogBox->saveState() );
164 void FileOpenPanel::browseFile()
166 QStringList files = QFileDialog::getOpenFileNames( this );
167 foreach( const QString &file, files)
169 QListWidgetItem *item =
170 new QListWidgetItem( toNativeSeparators( file ), ui.fileListWidg );
171 item->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled );
172 ui.fileListWidg->addItem( item );
177 void FileOpenPanel::deleteFile()
179 int i = ui.fileListWidg->currentRow();
182 QListWidgetItem *temp = ui.fileListWidg->takeItem( i );
189 /* Show a fileBrowser to select a subtitle */
190 void FileOpenPanel::browseFileSub()
192 // TODO Handle selection of more than one subtitles file
193 QStringList files = THEDP->showSimpleOpen( qtr("Open subtitles file"),
194 EXT_FILTER_SUBTITLE, p_intf->p_sys->filepath );
196 if( files.isEmpty() ) return;
197 ui.subInput->setText( toNativeSeparators( files.join(" ") ) );
201 void FileOpenPanel::toggleSubtitleFrame( bool b )
203 ui.subFrame->setEnabled( b );
210 /* Update the current MRL */
211 void FileOpenPanel::updateMRL()
213 QStringList fileList;
217 if( dialogBox == NULL )
218 for( int i = 0; i < ui.fileListWidg->count(); i++ )
220 if( !ui.fileListWidg->item( i )->text().isEmpty() )
221 fileList << ui.fileListWidg->item( i )->text();
224 fileList = dialogBox->selectedFiles();
227 if( ui.subCheckBox->isChecked() && !ui.subInput->text().isEmpty() ) {
228 mrl.append( " :sub-file=" + colon_escape( ui.subInput->text() ) );
229 int align = ui.alignSubComboBox->itemData(
230 ui.alignSubComboBox->currentIndex() ).toInt();
231 mrl.append( " :subsdec-align=" + QString().setNum( align ) );
232 int size = ui.sizeSubComboBox->itemData(
233 ui.sizeSubComboBox->currentIndex() ).toInt();
234 mrl.append( " :freetype-rel-fontsize=" + QString().setNum( size ) );
237 emit mrlUpdated( fileList, mrl );
238 emit methodChanged( "file-caching" );
241 /* Function called by Open Dialog when clicke on Play/Enqueue */
242 void FileOpenPanel::accept()
244 p_intf->p_sys->filepath = dialogBox->directory().absolutePath();
245 ui.fileListWidg->clear();
248 /* Function called by Open Dialog when clicked on cancel */
249 void FileOpenPanel::clear()
251 ui.fileListWidg->clear();
252 ui.subInput->clear();
255 /**************************************************************************
256 * Open Discs ( DVD, CD, VCD and similar devices ) *
257 **************************************************************************/
258 DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
259 OpenPanel( _parent, _p_intf )
263 /* Get the default configuration path for the devices */
264 psz_dvddiscpath = config_GetPsz( p_intf, "dvd" );
265 psz_vcddiscpath = config_GetPsz( p_intf, "vcd" );
266 psz_cddadiscpath = config_GetPsz( p_intf, "cd-audio" );
268 /* State to avoid overwritting the users changes with the configuration */
273 ui.browseDiscButton->setToolTip( qtr( I_DEVICE_TOOLTIP ));
274 ui.deviceCombo->setToolTip( qtr(I_DEVICE_TOOLTIP) );
276 #ifdef WIN32 /* Disc drives probing for Windows */
279 if( GetLogicalDriveStringsA( sizeof( szDrives ) - 1, szDrives ) )
281 char *drive = szDrives;
282 UINT oldMode = SetErrorMode( SEM_FAILCRITICALERRORS );
285 if( GetDriveTypeA(drive) == DRIVE_CDROM )
286 ui.deviceCombo->addItem( drive );
288 /* go to next drive */
291 SetErrorMode(oldMode);
293 #else /* Use a Completer under Linux */
294 QCompleter *discCompleter = new QCompleter( this );
295 discCompleter->setModel( new QDirModel( discCompleter ) );
296 ui.deviceCombo->setCompleter( discCompleter );
300 BUTTONACT( ui.dvdRadioButton, updateButtons() );
301 BUTTONACT( ui.vcdRadioButton, updateButtons() );
302 BUTTONACT( ui.audioCDRadioButton, updateButtons() );
303 BUTTONACT( ui.dvdsimple, updateButtons() );
304 BUTTONACT( ui.browseDiscButton, browseDevice() );
305 BUTTON_SET_ACT_I( ui.ejectButton, "", eject, qtr( "Eject the disc" ),
308 CONNECT( ui.deviceCombo, editTextChanged( QString ), this, updateMRL());
309 CONNECT( ui.titleSpin, valueChanged( int ), this, updateMRL());
310 CONNECT( ui.chapterSpin, valueChanged( int ), this, updateMRL());
311 CONNECT( ui.audioSpin, valueChanged( int ), this, updateMRL());
312 CONNECT( ui.subtitlesSpin, valueChanged( int ), this, updateMRL());
314 /* Run once the updateButtons function in order to fill correctly the comboBoxes */
318 DiscOpenPanel::~DiscOpenPanel()
320 free( psz_dvddiscpath );
321 free( psz_vcddiscpath );
322 free( psz_cddadiscpath );
325 void DiscOpenPanel::clear()
327 ui.titleSpin->setValue( 0 );
328 ui.chapterSpin->setValue( 0 );
329 ui.subtitlesSpin->setValue( -1 );
330 ui.audioSpin->setValue( -1 );
337 #define setDrive( psz_name ) {\
338 int index = ui.deviceCombo->findText( qfu( psz_name ) ); \
339 if( index != -1 ) ui.deviceCombo->setCurrentIndex( index );}
341 #define setDrive( psz_name ) {\
342 ui.deviceCombo->setEditText( qfu( psz_name ) ); }
345 /* update the buttons according the type of device */
346 void DiscOpenPanel::updateButtons()
348 if ( ui.dvdRadioButton->isChecked() )
352 setDrive( psz_dvddiscpath );
355 ui.titleLabel->setText( qtr("Title") );
356 ui.chapterLabel->show();
357 ui.chapterSpin->show();
358 ui.diskOptionBox_2->show();
359 ui.dvdsimple->setEnabled( true );
361 else if ( ui.vcdRadioButton->isChecked() )
365 setDrive( psz_vcddiscpath );
368 ui.titleLabel->setText( qtr("Entry") );
369 ui.chapterLabel->hide();
370 ui.chapterSpin->hide();
371 ui.diskOptionBox_2->show();
372 ui.dvdsimple->setEnabled( false );
378 setDrive( psz_cddadiscpath );
381 ui.titleLabel->setText( qtr("Track") );
382 ui.chapterLabel->hide();
383 ui.chapterSpin->hide();
384 ui.diskOptionBox_2->hide();
385 ui.dvdsimple->setEnabled( false );
393 /* Update the current MRL */
394 void DiscOpenPanel::updateMRL()
397 QStringList fileList;
399 /* CDDAX and VCDX not implemented. TODO ? No. */
401 if( ui.dvdRadioButton->isChecked() ) {
402 if( !ui.dvdsimple->isChecked() )
405 mrl = "dvdsimple://";
406 mrl += ui.deviceCombo->currentText();
407 emit methodChanged( "dvdnav-caching" );
409 if ( ui.titleSpin->value() > 0 ) {
410 mrl += QString("@%1").arg( ui.titleSpin->value() );
411 if ( ui.chapterSpin->value() > 0 ) {
412 mrl+= QString(":%1").arg( ui.chapterSpin->value() );
417 } else if ( ui.vcdRadioButton->isChecked() ) {
418 mrl = "vcd://" + ui.deviceCombo->currentText();
419 emit methodChanged( "vcd-caching" );
421 if( ui.titleSpin->value() > 0 ) {
422 mrl += QString("@E%1").arg( ui.titleSpin->value() );
427 mrl = "cdda://" + ui.deviceCombo->currentText();
430 fileList << mrl; mrl = "";
432 if ( ui.dvdRadioButton->isChecked() || ui.vcdRadioButton->isChecked() )
434 if ( ui.audioSpin->value() >= 0 ) {
435 mrl += " :audio-track=" +
436 QString("%1").arg( ui.audioSpin->value() );
438 if ( ui.subtitlesSpin->value() >= 0 ) {
439 mrl += " :sub-track=" +
440 QString("%1").arg( ui.subtitlesSpin->value() );
445 if( ui.titleSpin->value() > 0 )
446 mrl += QString(" :cdda-track=%1").arg( ui.titleSpin->value() );
448 emit mrlUpdated( fileList, mrl );
451 void DiscOpenPanel::browseDevice()
453 QString dir = QFileDialog::getExistingDirectory( this,
454 qtr( I_DEVICE_TOOLTIP ) );
456 ui.deviceCombo->setEditText( toNativeSepNoSlash( dir ) );
461 void DiscOpenPanel::eject()
463 intf_Eject( p_intf, qtu( ui.deviceCombo->currentText() ) );
466 void DiscOpenPanel::accept()
469 /**************************************************************************
470 * Open Network streams and URL pages *
471 **************************************************************************/
472 NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
473 OpenPanel( _parent, _p_intf )
478 CONNECT( ui.protocolCombo, activated( int ),
479 this, updateProtocol( int ) );
480 CONNECT( ui.portSpin, valueChanged( int ), this, updateMRL() );
481 CONNECT( ui.addressText, textChanged( const QString& ), this, updateMRL());
483 ui.protocolCombo->addItem( "" );
484 ui.protocolCombo->addItem("HTTP", QVariant("http"));
485 ui.protocolCombo->addItem("HTTPS", QVariant("https"));
486 ui.protocolCombo->addItem("MMS", QVariant("mms"));
487 ui.protocolCombo->addItem("FTP", QVariant("ftp"));
488 ui.protocolCombo->addItem("RTSP", QVariant("rtsp"));
489 ui.protocolCombo->addItem("RTP", QVariant("rtp"));
490 ui.protocolCombo->addItem("UDP", QVariant("udp"));
491 ui.protocolCombo->addItem("RTMP", QVariant("rtmp"));
493 updateProtocol( ui.protocolCombo->currentIndex() );
495 if( config_GetInt( p_intf, "qt-recentplay" ) )
497 mrlList = new QStringListModel(
498 getSettings()->value( "Open/netMRL" ).toStringList() );
499 QCompleter *completer = new QCompleter( mrlList, this );
500 ui.addressText->setCompleter( completer );
502 CONNECT( ui.addressText, editingFinished(), this, updateCompleter() );
508 NetOpenPanel::~NetOpenPanel()
510 if( !mrlList ) return;
512 QStringList tempL = mrlList->stringList();
513 while( tempL.size() > 8 ) tempL.removeFirst();
515 getSettings()->setValue( "Open/netMRL", tempL );
520 void NetOpenPanel::clear()
523 /* update the widgets according the type of protocol */
524 void NetOpenPanel::updateProtocol( int idx_proto ) {
525 QString addr = ui.addressText->text();
526 QString proto = ui.protocolCombo->itemData( idx_proto ).toString();
528 ui.portSpin->setEnabled( idx_proto == UDP_PROTO ||
529 idx_proto == RTP_PROTO );
531 if( idx_proto == NO_PROTO ) return;
533 /* If we already have a protocol in the address, replace it */
534 if( addr.contains( "://"))
536 if( idx_proto != UDP_PROTO && idx_proto != RTP_PROTO )
537 addr.replace( QRegExp("^.*://@*"), proto + "://");
538 else if ( ( addr.contains(QRegExp("://((22[4-9])|(23\\d)|(\\[?[fF]{2}[0-9a-fA-F]{2}:))"))) ||
539 ( !addr.contains(QRegExp("^\\d{1,3}[.]\\d{1,3}[.]\\d{1,3}[.]\\d{1,3}")) &&
540 !addr.contains(QRegExp(":[a-fA-F0-9]{1,4}:")) ) )
541 addr.replace( QRegExp("^.*://"), proto + "://@");
543 addr.replace( QRegExp("^.*://"), proto + "://");
544 addr.replace( QRegExp("@+"), "@");
545 ui.addressText->setText( addr );
550 void NetOpenPanel::updateMRL() {
552 QString addr = ui.addressText->text();
553 addr = QUrl::toPercentEncoding( addr, ":/?#@!$&'()*+,;=" );
554 int idx_proto = ui.protocolCombo->currentIndex();
555 int addr_is_multicast = addr.contains(QRegExp("^(22[4-9])|(23\\d)|(\\[?[fF]{2}[0-9a-fA-F]{2}:)"))?1:0;
556 int addr_is_ipv4 = addr.contains(QRegExp("^\\d{1,3}[.]\\d{1,3}[.]\\d{1,3}[.]\\d{1,3}"))?1:0;
557 int addr_is_ipv6 = addr.contains(QRegExp(":[a-fA-F0-9]{1,4}:"))?1:0;
558 int addr_has_port = addr.contains(QRegExp("[^:]{5}:\\d{1,5}$"))?1:0;
559 if( addr.contains( "://"))
561 /* Match the correct item in the comboBox */
562 ui.protocolCombo->setCurrentIndex(
563 ui.protocolCombo->findData( addr.section( ':', 0, 0 ) ) );
568 switch( idx_proto ) {
570 mrl = "http://" + addr;
571 emit methodChanged("http-caching");
574 mrl = "https://" + addr;
575 emit methodChanged("http-caching");
578 mrl = "mms://" + addr;
579 emit methodChanged("mms-caching");
582 mrl = "ftp://" + addr;
583 emit methodChanged("ftp-caching");
586 mrl = "rtsp://" + addr;
587 emit methodChanged("rtsp-caching");
590 if(( addr_is_multicast ) || ( !addr_is_ipv4 && !addr_is_ipv6 ))
595 if ( addr_is_ipv6 && !addr.contains('[') )
597 mrl += "[" + addr + "]";
601 mrl += QString(":%1").arg( ui.portSpin->value() );
602 emit methodChanged("udp-caching");
605 if(( addr_is_multicast ) || ( !addr_is_ipv4 && !addr_is_ipv6 ))
609 if ( addr_is_ipv6 && !addr.contains('[') )
610 mrl += "[" + addr + "]"; /* Add [] to IPv6 */
614 mrl += QString(":%1").arg( ui.portSpin->value() );
615 emit methodChanged("rtp-caching");
618 mrl = "rtmp://" + addr;
619 emit methodChanged("rtmp-caching");
624 QStringList qsl; qsl<< mrl;
625 emit mrlUpdated( qsl, "" );
628 void NetOpenPanel::updateCompleter()
631 QStringList tempL = mrlList->stringList();
632 if( !tempL.contains( ui.addressText->text() ) )
633 tempL.append( ui.addressText->text() );
634 mrlList->setStringList( tempL );
637 /**************************************************************************
638 * Open Capture device ( DVB, PVR, V4L, and similar ) *
639 **************************************************************************/
640 CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
641 OpenPanel( _parent, _p_intf )
643 isInitialized = false;
646 void CaptureOpenPanel::initialize()
648 if( isInitialized ) return;
650 msg_Dbg( p_intf, "Initialization of Capture device panel" );
651 isInitialized = true;
655 BUTTONACT( ui.advancedButton, advancedDialog() );
657 /* Create two stacked layouts in the main comboBoxes */
658 QStackedLayout *stackedDevLayout = new QStackedLayout;
659 ui.cardBox->setLayout( stackedDevLayout );
661 QStackedLayout *stackedPropLayout = new QStackedLayout;
662 ui.optionsBox->setLayout( stackedPropLayout );
664 /* Creation and connections of the WIdgets in the stacked layout */
665 #define addModuleAndLayouts( number, name, label ) \
666 QWidget * name ## DevPage = new QWidget( this ); \
667 QWidget * name ## PropPage = new QWidget( this ); \
668 stackedDevLayout->addWidget( name ## DevPage ); \
669 stackedPropLayout->addWidget( name ## PropPage ); \
670 QGridLayout * name ## DevLayout = new QGridLayout; \
671 QGridLayout * name ## PropLayout = new QGridLayout; \
672 name ## DevPage->setLayout( name ## DevLayout ); \
673 name ## PropPage->setLayout( name ## PropLayout ); \
674 ui.deviceCombo->addItem( qtr( label ), QVariant( number ) );
676 #define CuMRL( widget, slot ) CONNECT( widget , slot , this, updateMRL() );
679 /*********************
680 * DirectShow Stuffs *
681 *********************/
682 if( module_exists( "dshow" ) ){
683 addModuleAndLayouts( DSHOW_DEVICE, dshow, "DirectShow" );
687 module_config_t *p_config =
688 config_FindConfig( VLC_OBJECT(p_intf), "dshow-vdev" );
689 vdevDshowW = new StringListConfigControl(
690 VLC_OBJECT(p_intf), p_config, this, false, dshowDevLayout, line );
693 p_config = config_FindConfig( VLC_OBJECT(p_intf), "dshow-adev" );
694 adevDshowW = new StringListConfigControl(
695 VLC_OBJECT(p_intf), p_config, this, false, dshowDevLayout, line );
698 /* dshow Properties */
699 QLabel *dshowVSizeLabel = new QLabel( qtr( "Video size" ) );
700 dshowPropLayout->addWidget( dshowVSizeLabel, 0, 0 );
702 dshowVSizeLine = new QLineEdit;
703 dshowPropLayout->addWidget( dshowVSizeLine, 0, 1);
704 dshowPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
708 CuMRL( vdevDshowW->combo, currentIndexChanged ( int ) );
709 CuMRL( adevDshowW->combo, currentIndexChanged ( int ) );
710 CuMRL( dshowVSizeLine, textChanged( const QString& ) );
716 if( module_exists( "bda" ) ){
717 addModuleAndLayouts( BDA_DEVICE, bda, "DVB DirectShow" );
720 QLabel *bdaTypeLabel = new QLabel( qtr( "DVB Type:" ) );
722 bdas = new QRadioButton( "DVB-S" );
723 bdas->setChecked( true );
724 bdac = new QRadioButton( "DVB-C" );
725 bdat = new QRadioButton( "DVB-T" );
726 bdaa = new QRadioButton( "ATSC" );
728 bdaDevLayout->addWidget( bdaTypeLabel, 0, 0 );
729 bdaDevLayout->addWidget( bdas, 0, 1 );
730 bdaDevLayout->addWidget( bdac, 0, 2 );
731 bdaDevLayout->addWidget( bdat, 0, 3 );
732 bdaDevLayout->addWidget( bdaa, 0, 4 );
735 QLabel *bdaFreqLabel =
736 new QLabel( qtr( "Transponder/multiplex frequency" ) );
737 bdaPropLayout->addWidget( bdaFreqLabel, 0, 0 );
739 bdaFreq = new QSpinBox;
740 bdaFreq->setAlignment( Qt::AlignRight );
741 bdaFreq->setSuffix(" kHz");
742 bdaFreq->setSingleStep( 1000 );
743 setSpinBoxFreq( bdaFreq )
744 bdaPropLayout->addWidget( bdaFreq, 0, 1 );
746 bdaSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
747 bdaPropLayout->addWidget( bdaSrateLabel, 1, 0 );
749 bdaSrate = new QSpinBox;
750 bdaSrate->setAlignment( Qt::AlignRight );
751 bdaSrate->setSuffix(" kHz");
752 setSpinBoxFreq( bdaSrate );
753 bdaPropLayout->addWidget( bdaSrate, 1, 1 );
755 bdaBandLabel = new QLabel( qtr( "Bandwidth" ) );
756 bdaPropLayout->addWidget( bdaBandLabel, 2, 0 );
758 bdaBandBox = new QComboBox;
759 setfillVLCConfigCombo( "dvb-bandwidth", p_intf, bdaBandBox );
760 bdaPropLayout->addWidget( bdaBandBox, 2, 1 );
762 bdaBandLabel->hide();
764 bdaPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
768 CuMRL( bdaFreq, valueChanged ( int ) );
769 CuMRL( bdaSrate, valueChanged ( int ) );
770 CuMRL( bdaBandBox, currentIndexChanged ( int ) );
771 BUTTONACT( bdas, updateButtons() );
772 BUTTONACT( bdat, updateButtons() );
773 BUTTONACT( bdac, updateButtons() );
774 BUTTONACT( bdaa, updateButtons() );
775 BUTTONACT( bdas, updateMRL() );
776 BUTTONACT( bdat, updateMRL() );
777 BUTTONACT( bdac, updateMRL() );
778 BUTTONACT( bdaa, updateMRL() );
785 if( module_exists( "v4l2" ) ){
786 addModuleAndLayouts( V4L2_DEVICE, v4l2, "Video for Linux 2" );
789 QLabel *v4l2VideoDeviceLabel = new QLabel( qtr( "Video device name" ) );
790 v4l2DevLayout->addWidget( v4l2VideoDeviceLabel, 0, 0 );
792 v4l2VideoDevice = new QLineEdit;
793 v4l2DevLayout->addWidget( v4l2VideoDevice, 0, 1 );
795 QLabel *v4l2AudioDeviceLabel = new QLabel( qtr( "Audio device name" ) );
796 v4l2DevLayout->addWidget( v4l2AudioDeviceLabel, 1, 0 );
798 v4l2AudioDevice = new QLineEdit;
799 v4l2DevLayout->addWidget( v4l2AudioDevice, 1, 1 );
801 /* v4l2 Props panel */
802 QLabel *v4l2StdLabel = new QLabel( qtr( "Standard" ) );
803 v4l2PropLayout->addWidget( v4l2StdLabel, 0 , 0 );
805 v4l2StdBox = new QComboBox;
806 setfillVLCConfigCombo( "v4l2-standard", p_intf, v4l2StdBox );
807 v4l2PropLayout->addWidget( v4l2StdBox, 0 , 1 );
808 v4l2PropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
812 CuMRL( v4l2VideoDevice, textChanged( const QString& ) );
813 CuMRL( v4l2AudioDevice, textChanged( const QString& ) );
814 CuMRL( v4l2StdBox, currentIndexChanged ( int ) );
820 if( module_exists( "v4l" ) ){
821 addModuleAndLayouts( V4L_DEVICE, v4l, "Video for Linux" );
824 QLabel *v4lVideoDeviceLabel = new QLabel( qtr( "Video device name" ) );
825 v4lDevLayout->addWidget( v4lVideoDeviceLabel, 0, 0 );
827 v4lVideoDevice = new QLineEdit;
828 v4lDevLayout->addWidget( v4lVideoDevice, 0, 1 );
830 QLabel *v4lAudioDeviceLabel = new QLabel( qtr( "Audio device name" ) );
831 v4lDevLayout->addWidget( v4lAudioDeviceLabel, 1, 0 );
833 v4lAudioDevice = new QLineEdit;
834 v4lDevLayout->addWidget( v4lAudioDevice, 1, 1 );
836 /* V4l Props panel */
837 QLabel *v4lNormLabel = new QLabel( qtr( "Norm" ) );
838 v4lPropLayout->addWidget( v4lNormLabel, 0 , 0 );
840 v4lNormBox = new QComboBox;
841 setfillVLCConfigCombo( "v4l-norm", p_intf, v4lNormBox );
842 v4lPropLayout->addWidget( v4lNormBox, 0 , 1 );
844 QLabel *v4lFreqLabel = new QLabel( qtr( "Frequency" ) );
845 v4lPropLayout->addWidget( v4lFreqLabel, 1 , 0 );
847 v4lFreq = new QSpinBox;
848 v4lFreq->setAlignment( Qt::AlignRight );
849 v4lFreq->setSuffix(" kHz");
850 setSpinBoxFreq( v4lFreq );
851 v4lPropLayout->addWidget( v4lFreq, 1 , 1 );
852 v4lPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
856 CuMRL( v4lVideoDevice, textChanged( const QString& ) );
857 CuMRL( v4lAudioDevice, textChanged( const QString& ) );
858 CuMRL( v4lFreq, valueChanged ( int ) );
859 CuMRL( v4lNormBox, currentIndexChanged ( int ) );
865 if( module_exists( "jack" ) ){
866 addModuleAndLayouts( JACK_DEVICE, jack, "JACK Audio Connection Kit" );
868 /* Jack Main panel */
870 QLabel *jackChannelsLabel = new QLabel( qtr( "Channels:" ) );
871 jackDevLayout->addWidget( jackChannelsLabel, 1, 0 );
873 jackChannels = new QSpinBox;
874 setSpinBoxFreq( jackChannels );
875 jackChannels->setMaximum(255);
876 jackChannels->setValue(2);
877 jackChannels->setAlignment( Qt::AlignRight );
878 jackDevLayout->addWidget( jackChannels, 1, 1 );
881 QLabel *jackPortsLabel = new QLabel( qtr( "Selected ports:" ) );
882 jackDevLayout->addWidget( jackPortsLabel, 0 , 0 );
884 jackPortsSelected = new QLineEdit( qtr( ".*") );
885 jackPortsSelected->setAlignment( Qt::AlignRight );
886 jackDevLayout->addWidget( jackPortsSelected, 0, 1 );
888 /* Jack Props panel */
891 QLabel *jackCachingLabel = new QLabel( qtr( "Input caching:" ) );
892 jackPropLayout->addWidget( jackCachingLabel, 1 , 0 );
893 jackCaching = new QSpinBox;
894 setSpinBoxFreq( jackCaching );
895 jackCaching->setSuffix( " ms" );
896 jackCaching->setValue(1000);
897 jackCaching->setAlignment( Qt::AlignRight );
898 jackPropLayout->addWidget( jackCaching, 1 , 2 );
901 jackPace = new QCheckBox(qtr( "Use VLC pace" ));
902 jackPropLayout->addWidget( jackPace, 2, 1 );
905 jackConnect = new QCheckBox( qtr( "Auto connnection" ));
906 jackPropLayout->addWidget( jackConnect, 2, 2 );
909 CuMRL( jackChannels, valueChanged( int ) );
910 CuMRL( jackCaching, valueChanged( int ) );
911 CuMRL( jackPace, stateChanged( int ) );
912 CuMRL( jackConnect, stateChanged( int ) );
913 CuMRL( jackPortsSelected, textChanged( const QString& ) );
919 if( module_exists( "pvr" ) ){
920 addModuleAndLayouts( PVR_DEVICE, pvr, "PVR" );
923 QLabel *pvrDeviceLabel = new QLabel( qtr( "Device name" ) );
924 pvrDevLayout->addWidget( pvrDeviceLabel, 0, 0 );
926 pvrDevice = new QLineEdit;
927 pvrDevLayout->addWidget( pvrDevice, 0, 1 );
929 QLabel *pvrRadioDeviceLabel = new QLabel( qtr( "Radio device name" ) );
930 pvrDevLayout->addWidget( pvrRadioDeviceLabel, 1, 0 );
932 pvrRadioDevice = new QLineEdit;
933 pvrDevLayout->addWidget( pvrRadioDevice, 1, 1 );
935 /* PVR props panel */
936 QLabel *pvrNormLabel = new QLabel( qtr( "Norm" ) );
937 pvrPropLayout->addWidget( pvrNormLabel, 0, 0 );
939 pvrNormBox = new QComboBox;
940 setfillVLCConfigCombo( "pvr-norm", p_intf, pvrNormBox );
941 pvrPropLayout->addWidget( pvrNormBox, 0, 1 );
943 QLabel *pvrFreqLabel = new QLabel( qtr( "Frequency" ) );
944 pvrPropLayout->addWidget( pvrFreqLabel, 1, 0 );
946 pvrFreq = new QSpinBox;
947 pvrFreq->setAlignment( Qt::AlignRight );
948 pvrFreq->setSuffix(" kHz");
949 setSpinBoxFreq( pvrFreq );
950 pvrPropLayout->addWidget( pvrFreq, 1, 1 );
952 QLabel *pvrBitrLabel = new QLabel( qtr( "Bitrate" ) );
953 pvrPropLayout->addWidget( pvrBitrLabel, 2, 0 );
955 pvrBitr = new QSpinBox;
956 pvrBitr->setAlignment( Qt::AlignRight );
957 pvrBitr->setSuffix(" kHz");
958 setSpinBoxFreq( pvrBitr );
959 pvrPropLayout->addWidget( pvrBitr, 2, 1 );
960 pvrPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
964 CuMRL( pvrDevice, textChanged( const QString& ) );
965 CuMRL( pvrRadioDevice, textChanged( const QString& ) );
967 CuMRL( pvrFreq, valueChanged ( int ) );
968 CuMRL( pvrBitr, valueChanged ( int ) );
969 CuMRL( pvrNormBox, currentIndexChanged ( int ) );
975 if( module_exists( "dvb" ) ){
976 addModuleAndLayouts( DVB_DEVICE, dvb, "DVB" );
979 QLabel *dvbDeviceLabel = new QLabel( qtr( "Adapter card to tune" ) );
980 QLabel *dvbTypeLabel = new QLabel( qtr( "DVB Type:" ) );
982 dvbCard = new QSpinBox;
983 dvbCard->setAlignment( Qt::AlignRight );
984 dvbCard->setPrefix( "/dev/dvb/adapter" );
986 dvbDevLayout->addWidget( dvbDeviceLabel, 0, 0 );
987 dvbDevLayout->addWidget( dvbCard, 0, 2, 1, 2 );
989 dvbs = new QRadioButton( "DVB-S" );
990 dvbs->setChecked( true );
991 dvbc = new QRadioButton( "DVB-C" );
992 dvbt = new QRadioButton( "DVB-T" );
994 dvbDevLayout->addWidget( dvbTypeLabel, 1, 0 );
995 dvbDevLayout->addWidget( dvbs, 1, 1 );
996 dvbDevLayout->addWidget( dvbc, 1, 2 );
997 dvbDevLayout->addWidget( dvbt, 1, 3 );
999 /* DVB Props panel */
1000 QLabel *dvbFreqLabel =
1001 new QLabel( qtr( "Transponder/multiplex frequency" ) );
1002 dvbPropLayout->addWidget( dvbFreqLabel, 0, 0 );
1004 dvbFreq = new QSpinBox;
1005 dvbFreq->setAlignment( Qt::AlignRight );
1006 dvbFreq->setSuffix(" kHz");
1007 dvbFreq->setSingleStep( 1000 );
1008 setSpinBoxFreq( dvbFreq );
1009 dvbPropLayout->addWidget( dvbFreq, 0, 1 );
1011 dvbSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
1012 dvbPropLayout->addWidget( dvbSrateLabel, 1, 0 );
1014 dvbSrate = new QSpinBox;
1015 dvbSrate->setAlignment( Qt::AlignRight );
1016 dvbSrate->setSuffix(" kHz");
1017 setSpinBoxFreq( dvbSrate );
1018 dvbPropLayout->addWidget( dvbSrate, 1, 1 );
1020 dvbBandLabel = new QLabel( qtr( "Bandwidth" ) );
1021 dvbPropLayout->addWidget( dvbBandLabel, 2, 0 );
1023 dvbBandBox = new QComboBox;
1024 /* This doesn't work since dvb-bandwidth doesn't seem to be a
1026 setfillVLCConfigCombo( "dvb-bandwidth", p_intf, bdaBandBox );
1028 dvbBandBox->addItem( qtr( "Auto" ), 0 );
1029 dvbBandBox->addItem( qtr( "6 MHz" ), 6 );
1030 dvbBandBox->addItem( qtr( "7 MHz" ), 7 );
1031 dvbBandBox->addItem( qtr( "8 MHz" ), 8 );
1032 dvbPropLayout->addWidget( dvbBandBox, 2, 1 );
1034 dvbBandLabel->hide();
1037 dvbPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
1041 CuMRL( dvbCard, valueChanged ( int ) );
1042 CuMRL( dvbFreq, valueChanged ( int ) );
1043 CuMRL( dvbSrate, valueChanged ( int ) );
1044 CuMRL( dvbBandBox, currentIndexChanged ( int ) );
1046 BUTTONACT( dvbs, updateButtons() );
1047 BUTTONACT( dvbt, updateButtons() );
1048 BUTTONACT( dvbc, updateButtons() );
1049 BUTTONACT( dvbs, updateMRL() );
1050 BUTTONACT( dvbt, updateMRL() );
1051 BUTTONACT( dvbc, updateMRL() );
1060 addModuleAndLayouts( SCREEN_DEVICE, screen, "Desktop" );
1061 QLabel *screenLabel = new QLabel( qtr( "Your display will be "
1062 "opened and played in order to stream or save it." ) );
1063 screenLabel->setWordWrap( true );
1064 screenDevLayout->addWidget( screenLabel, 0, 0 );
1066 QLabel *screenFPSLabel = new QLabel(
1067 qtr( "Desired frame rate for the capture." ) );
1068 screenPropLayout->addWidget( screenFPSLabel, 0, 0 );
1070 screenFPS = new QSpinBox;
1071 screenFPS->setValue( 1 );
1072 screenFPS->setAlignment( Qt::AlignRight );
1073 screenPropLayout->addWidget( screenFPS, 0, 1 );
1075 /* Screen connect */
1076 CuMRL( screenFPS, valueChanged( int ) );
1078 /* General connects */
1079 CONNECT( ui.deviceCombo, activated( int ) ,
1080 stackedDevLayout, setCurrentIndex( int ) );
1081 CONNECT( ui.deviceCombo, activated( int ),
1082 stackedPropLayout, setCurrentIndex( int ) );
1083 CONNECT( ui.deviceCombo, activated( int ), this, updateMRL() );
1084 CONNECT( ui.deviceCombo, activated( int ), this, updateButtons() );
1087 #undef addModuleAndLayouts
1090 CaptureOpenPanel::~CaptureOpenPanel()
1094 void CaptureOpenPanel::clear()
1099 void CaptureOpenPanel::updateMRL()
1102 QStringList fileList;
1103 int i_devicetype = ui.deviceCombo->itemData(
1104 ui.deviceCombo->currentIndex() ).toInt();
1105 switch( i_devicetype )
1109 if( bdas->isChecked() ) mrl = "dvb-s://";
1110 else if( bdat->isChecked() ) mrl = "dvb-t://";
1111 else if( bdac->isChecked() ) mrl = "dvb-c://";
1112 else if( bdaa->isChecked() ) mrl = "atsc://";
1114 mrl += "frequency=" + QString::number( bdaFreq->value() );
1115 if( bdac->isChecked() || bdat->isChecked() || bdaa->isChecked() )
1117 fileList << mrl; mrl = "";
1119 if( bdas->isChecked() || bdac->isChecked() )
1120 mrl += " :dvb-srate=" + QString::number( bdaSrate->value() );
1121 else if( bdat->isChecked() || bdaa->isChecked() )
1122 mrl += " :dvb-bandwidth=" +
1123 QString::number( bdaBandBox->itemData(
1124 bdaBandBox->currentIndex() ).toInt() );
1127 fileList << "dshow://";
1128 mrl+= " :dshow-vdev=" +
1129 colon_escape( QString("%1").arg( vdevDshowW->getValue() ) );
1130 mrl+= " :dshow-adev=" +
1131 colon_escape( QString("%1").arg( adevDshowW->getValue() ) );
1132 if( dshowVSizeLine->isModified() )
1133 mrl += " :dshow-size=" + dshowVSizeLine->text();
1137 fileList << "v4l://";
1138 mrl += " :v4l-vdev=" + v4lVideoDevice->text();
1139 mrl += " :v4l-adev=" + v4lAudioDevice->text();
1140 mrl += " :v4l-norm=" + QString::number( v4lNormBox->currentIndex() );
1141 mrl += " :v4l-frequency=" + QString::number( v4lFreq->value() );
1144 fileList << "v4l2://";
1145 mrl += " :v4l2-dev=" + v4l2VideoDevice->text();
1146 mrl += " :v4l2-adev=" + v4l2AudioDevice->text();
1147 mrl += " :v4l2-standard=" + QString::number( v4l2StdBox->currentIndex() );
1151 mrl += "channels=" + QString::number( jackChannels->value() );
1152 mrl += ":ports=" + jackPortsSelected->text();
1153 fileList << mrl; mrl = "";
1155 mrl += " :jack-input-caching=" + QString::number( jackCaching->value() );
1156 if ( jackPace->isChecked() )
1158 mrl += " :jack-input-use-vlc-pace";
1160 if ( jackConnect->isChecked() )
1162 mrl += " :jack-input-auto-connect";
1166 fileList << "pvr://";
1167 mrl += " :pvr-device=" + pvrDevice->text();
1168 mrl += " :pvr-radio-device=" + pvrRadioDevice->text();
1169 mrl += " :pvr-norm=" + QString::number( pvrNormBox->currentIndex() );
1170 if( pvrFreq->value() )
1171 mrl += " :pvr-frequency=" + QString::number( pvrFreq->value() );
1172 if( pvrBitr->value() )
1173 mrl += " :pvr-bitrate=" + QString::number( pvrBitr->value() );
1177 mrl += "frequency=" + QString::number( dvbFreq->value() );
1178 if( dvbc->isChecked() || dvbt->isChecked() )
1180 fileList << mrl; mrl= "";
1182 mrl += " :dvb-adapter=" + QString::number( dvbCard->value() );
1183 if( dvbs->isChecked() || dvbc->isChecked() )
1184 mrl += " :dvb-srate=" + QString::number( dvbSrate->value() );
1185 else if( dvbt->isChecked() )
1186 mrl += " :dvb-bandwidth=" +
1187 QString::number( dvbBandBox->itemData(
1188 dvbBandBox->currentIndex() ).toInt() );
1193 fileList << "screen://";
1194 mrl = " :screen-fps=" + QString::number( screenFPS->value() );
1199 if( !advMRL.isEmpty() ) mrl += advMRL;
1201 emit mrlUpdated( fileList, mrl );
1205 * Update the Buttons (show/hide) for the GUI as all device type don't
1206 * use the same ui. elements.
1208 void CaptureOpenPanel::updateButtons()
1210 /* Be sure to display the ui Elements in case they were hidden by
1211 * some Device Type (like Screen://) */
1212 ui.optionsBox->show();
1213 ui.advancedButton->show();
1214 /* Get the current Device Number */
1215 int i_devicetype = ui.deviceCombo->itemData(
1216 ui.deviceCombo->currentIndex() ).toInt();
1217 switch( i_devicetype )
1221 if( bdas->isChecked() || bdac->isChecked() )
1224 bdaSrateLabel->show();
1226 bdaBandLabel->hide();
1228 else if( bdat->isChecked() || bdaa->isChecked() )
1231 bdaSrateLabel->hide();
1233 bdaBandLabel->show();
1238 if( dvbs->isChecked() || dvbc->isChecked() )
1241 dvbSrateLabel->show();
1243 dvbBandLabel->hide();
1245 else if( dvbt->isChecked() )
1248 dvbSrateLabel->hide();
1250 dvbBandLabel->show();
1255 //ui.optionsBox->hide();
1256 ui.advancedButton->hide();
1263 void CaptureOpenPanel::advancedDialog()
1265 /* Get selected device type */
1266 int i_devicetype = ui.deviceCombo->itemData(
1267 ui.deviceCombo->currentIndex() ).toInt();
1269 /* Get the corresponding module */
1270 module_t *p_module =
1271 module_find( psz_devModule[i_devicetype] );
1272 if( NULL == p_module ) return;
1275 QList<ConfigControl *> controls;
1277 /* Get the confsize */
1278 unsigned int i_confsize;
1279 module_config_t *p_config;
1280 p_config = module_config_get( p_module, &i_confsize );
1282 /* New Adv Prop dialog */
1283 adv = new QDialog( this );
1284 adv->setWindowTitle( qtr( "Advanced Options" ) );
1286 /* A main Layout with a Frame */
1287 QVBoxLayout *mainLayout = new QVBoxLayout( adv );
1288 QScrollArea *scroll = new QScrollArea;
1289 mainLayout->addWidget( scroll );
1291 QFrame *advFrame = new QFrame;
1292 /* GridLayout inside the Frame */
1293 QGridLayout *gLayout = new QGridLayout( advFrame );
1295 scroll->setWidgetResizable( true );
1296 scroll->setWidget( advFrame );
1298 /* Create the options inside the FrameLayout */
1299 for( int n = 0; n < (int)i_confsize; n++ )
1301 module_config_t *p_item = p_config + n;
1302 ConfigControl *config = ConfigControl::createControl(
1303 VLC_OBJECT( p_intf ), p_item, advFrame, gLayout, n );
1305 controls.append( config );
1309 QDialogButtonBox *advButtonBox = new QDialogButtonBox( adv );
1310 QPushButton *closeButton = new QPushButton( qtr( "OK" ) );
1311 QPushButton *cancelButton = new QPushButton( qtr( "Cancel" ) );
1313 CONNECT( closeButton, clicked(), adv, accept() );
1314 CONNECT( cancelButton, clicked(), adv, reject() );
1316 advButtonBox->addButton( closeButton, QDialogButtonBox::AcceptRole );
1317 advButtonBox->addButton( cancelButton, QDialogButtonBox::RejectRole );
1319 mainLayout->addWidget( advButtonBox );
1321 /* Creation of the MRL */
1324 QString tempMRL = "";
1325 for( int i = 0; i < controls.size(); i++ )
1327 ConfigControl *control = controls[i];
1329 tempMRL += (i ? " :" : ":");
1331 if( control->getType() == CONFIG_ITEM_BOOL )
1332 if( !(qobject_cast<VIntConfigControl *>(control)->getValue() ) )
1335 tempMRL += control->getName();
1337 switch( control->getType() )
1339 case CONFIG_ITEM_STRING:
1340 case CONFIG_ITEM_FILE:
1341 case CONFIG_ITEM_DIRECTORY:
1342 case CONFIG_ITEM_MODULE:
1343 tempMRL += colon_escape( QString("=%1").arg( qobject_cast<VStringConfigControl *>(control)->getValue() ) );
1345 case CONFIG_ITEM_INTEGER:
1346 tempMRL += QString("=%1").arg( qobject_cast<VIntConfigControl *>(control)->getValue() );
1348 case CONFIG_ITEM_FLOAT:
1349 tempMRL += QString("=%1").arg( qobject_cast<VFloatConfigControl *>(control)->getValue() );
1355 msg_Dbg( p_intf, "%s", qtu( advMRL ) );
1357 for( int i = 0; i < controls.size(); i++ )
1359 ConfigControl *control = controls[i];
1363 module_config_free( p_config );
1364 module_release (p_module);