X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fqt4%2Fcomponents%2Fopen_panels.cpp;h=6e4afb5bcd073018e41fe387200bf9734701616e;hb=012e93a73382df07238a122f9de884b5270c252e;hp=a37dc279d2562c650b197a7624abadc102954d8a;hpb=473924674c85c5f5c11a5c2e0564ad6cc8f7d566;p=vlc diff --git a/modules/gui/qt4/components/open_panels.cpp b/modules/gui/qt4/components/open_panels.cpp index a37dc279d2..6e4afb5bcd 100644 --- a/modules/gui/qt4/components/open_panels.cpp +++ b/modules/gui/qt4/components/open_panels.cpp @@ -1,7 +1,7 @@ /***************************************************************************** * open.cpp : Panels for the open dialogs **************************************************************************** - * Copyright (C) 2006-2008 the VideoLAN team + * Copyright (C) 2006-2009 the VideoLAN team * Copyright (C) 2007 Société des arts technologiques * Copyright (C) 2007 Savoir-faire Linux * @@ -33,7 +33,8 @@ #include "qt4.hpp" #include "components/open_panels.hpp" #include "dialogs/open.hpp" -#include "dialogs_provider.hpp" +#include "dialogs_provider.hpp" /* Open Subtitle file */ +#include "util/qt_dirs.hpp" #include #include @@ -44,48 +45,88 @@ #include #include #include +#include -#define I_DEVICE_TOOLTIP "Select the device or the VIDEO_TS directory" +#define I_DEVICE_TOOLTIP N_("Select the device or the VIDEO_TS directory") + +static const char *psz_devModule[] = { "v4l", "v4l2", "pvr", "dvb", "bda", + "dshow", "screen", "jack" }; /************************************************************************** * Open Files and subtitles * **************************************************************************/ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : - OpenPanel( _parent, _p_intf ) + OpenPanel( _parent, _p_intf ), dialogBox( NULL ) { /* Classic UI Setup */ ui.setupUi( this ); - /** BEGIN QFileDialog tweaking **/ - /* Use a QFileDialog and customize it because we don't want to - rewrite it all. Be careful to your eyes cause there are a few hacks. - Be very careful and test correctly when you modify this. */ - /* Set Filters for file selection */ - QString fileTypes = ""; +/* QString fileTypes = ""; ADD_FILTER_MEDIA( fileTypes ); ADD_FILTER_VIDEO( fileTypes ); ADD_FILTER_AUDIO( fileTypes ); ADD_FILTER_PLAYLIST( fileTypes ); ADD_FILTER_ALL( fileTypes ); - fileTypes.replace( QString(";*"), QString(" *")); + fileTypes.replace( QString(";*"), QString(" *")); */ + - // Make this QFileDialog a child of tempWidget from the ui. +/* lineFileEdit = ui.fileEdit; + //TODO later: fill the fileCompleteList with previous items played. + QCompleter *fileCompleter = new QCompleter( fileCompleteList, this ); + fileCompleter->setModel( new QDirModel( fileCompleter ) ); + lineFileEdit->setCompleter( fileCompleter );*/ + if( var_InheritBool( p_intf, "qt-embedded-open" ) ) + { + ui.tempWidget->hide(); + BuildOldPanel(); + } + + /* Subtitles */ + /* Deactivate the subtitles control by default. */ + ui.subFrame->setEnabled( false ); + /* Build the subs size combo box */ + setfillVLCConfigCombo( "freetype-rel-fontsize" , p_intf, + ui.sizeSubComboBox ); + /* Build the subs align combo box */ + setfillVLCConfigCombo( "subsdec-align", p_intf, ui.alignSubComboBox ); + + /* Connects */ + BUTTONACT( ui.fileBrowseButton, browseFile() ); + BUTTONACT( ui.removeFileButton, removeFile() ); + + BUTTONACT( ui.subBrowseButton, browseFileSub() ); + CONNECT( ui.subCheckBox, toggled( bool ), this, toggleSubtitleFrame( bool ) ); + + CONNECT( ui.fileListWidg, itemChanged( QListWidgetItem * ), this, updateMRL() ); + CONNECT( ui.subInput, textChanged( const QString& ), this, updateMRL() ); + CONNECT( ui.alignSubComboBox, currentIndexChanged( int ), this, updateMRL() ); + CONNECT( ui.sizeSubComboBox, currentIndexChanged( int ), this, updateMRL() ); + updateButtons(); +} + +inline void FileOpenPanel::BuildOldPanel() +{ + /** BEGIN QFileDialog tweaking **/ + /* Use a QFileDialog and customize it because we don't want to + rewrite it all. Be careful to your eyes cause there are a few hacks. + Be very careful and test correctly when you modify this. */ + + /* Make this QFileDialog a child of tempWidget from the ui. */ dialogBox = new FileOpenBox( ui.tempWidget, NULL, - qfu( p_intf->p_sys->psz_filepath ), fileTypes ); + p_intf->p_sys->filepath, "" ); dialogBox->setFileMode( QFileDialog::ExistingFiles ); dialogBox->setAcceptMode( QFileDialog::AcceptOpen ); -#if HAS_QT43 dialogBox->restoreState( getSettings()->value( "file-dialog-state" ).toByteArray() ); -#endif /* We don't want to see a grip in the middle of the window, do we? */ dialogBox->setSizeGripEnabled( false ); /* Add a tooltip */ dialogBox->setToolTip( qtr( "Select one or multiple files" ) ); + dialogBox->setMinimumHeight( 250 ); // But hide the two OK/Cancel buttons. Enable them for debug. QDialogButtonBox *fileDialogAcceptBox = @@ -94,11 +135,7 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : /* Ugly hacks to get the good Widget */ //This lineEdit is the normal line in the fileDialog. -#if HAS_QT43 - lineFileEdit = dialogBox->findChildren()[0]; -#else - lineFileEdit = dialogBox->findChildren()[1]; -#endif + QLineEdit *lineFileEdit = dialogBox->findChildren()[0]; /* Make a list of QLabel inside the QFileDialog to access the good ones */ QList listLabel = dialogBox->findChildren(); @@ -115,36 +152,42 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : // Add the DialogBox to the layout ui.gridLayout->addWidget( dialogBox, 0, 0, 1, 3 ); - //TODO later: fill the fileCompleteList with previous items played. - QCompleter *fileCompleter = new QCompleter( fileCompleteList, this ); - fileCompleter->setModel( new QDirModel( fileCompleter ) ); - lineFileEdit->setCompleter( fileCompleter ); - - // Hide the subtitles control by default. - ui.subFrame->hide(); - - /* Build the subs size combo box */ - setfillVLCConfigCombo( "freetype-rel-fontsize" , p_intf, - ui.sizeSubComboBox ); - - /* Build the subs align combo box */ - setfillVLCConfigCombo( "subsdec-align", p_intf, ui.alignSubComboBox ); + CONNECT( lineFileEdit, textChanged( const QString& ), this, updateMRL() ); + dialogBox->installEventFilter( this ); +} - /* Connects */ - BUTTONACT( ui.subBrowseButton, browseFileSub() ); - BUTTONACT( ui.subCheckBox, toggleSubtitleFrame()); +FileOpenPanel::~FileOpenPanel() +{ + if( dialogBox ) + getSettings()->setValue( "file-dialog-state", dialogBox->saveState() ); +} - CONNECT( lineFileEdit, textChanged( QString ), this, updateMRL() ); - CONNECT( ui.subInput, textChanged( QString ), this, updateMRL() ); - CONNECT( ui.alignSubComboBox, currentIndexChanged( int ), this, updateMRL() ); - CONNECT( ui.sizeSubComboBox, currentIndexChanged( int ), this, updateMRL() ); +void FileOpenPanel::browseFile() +{ + QStringList files = QFileDialog::getOpenFileNames( this, qtr( "Select one or multiple files" ), p_intf->p_sys->filepath) ; + foreach( const QString &file, files ) + { + QListWidgetItem *item = + new QListWidgetItem( toNativeSeparators( file ), ui.fileListWidg ); + item->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled ); + ui.fileListWidg->addItem( item ); + savedirpathFromFile( file ); + } + updateButtons(); + updateMRL(); } -FileOpenPanel::~FileOpenPanel() +void FileOpenPanel::removeFile() { -#if HAS_QT43 - getSettings()->setValue( "file-dialog-state", dialogBox->saveState() ); -#endif + int i = ui.fileListWidg->currentRow(); + if( i != -1 ) + { + QListWidgetItem *temp = ui.fileListWidg->takeItem( i ); + delete temp; + } + + updateMRL(); + updateButtons(); } /* Show a fileBrowser to select a subtitle */ @@ -152,23 +195,41 @@ void FileOpenPanel::browseFileSub() { // TODO Handle selection of more than one subtitles file QStringList files = THEDP->showSimpleOpen( qtr("Open subtitles file"), - EXT_FILTER_SUBTITLE, - dialogBox->directory().absolutePath() ); + EXT_FILTER_SUBTITLE, p_intf->p_sys->filepath ); + if( files.isEmpty() ) return; - ui.subInput->setText( files.join(" ") ); + ui.subInput->setText( toNativeSeparators( files.join(" ") ) ); + updateMRL(); +} + +void FileOpenPanel::toggleSubtitleFrame( bool b ) +{ + ui.subFrame->setEnabled( b ); + + /* Update the MRL */ updateMRL(); } + /* Update the current MRL */ void FileOpenPanel::updateMRL() { - QString mrl = ""; - foreach( QString file, dialogBox->selectedFiles() ) { - mrl += "\"" + file + "\" "; - } + QStringList fileList; + QString mrl; - if( ui.subCheckBox->isChecked() ) { - mrl.append( " :sub-file=\"" + ui.subInput->text() + "\"" ); + /* File Listing */ + if( dialogBox == NULL ) + for( int i = 0; i < ui.fileListWidg->count(); i++ ) + { + if( !ui.fileListWidg->item( i )->text().isEmpty() ) + fileList << ui.fileListWidg->item( i )->text(); + } + else + fileList = dialogBox->selectedFiles(); + + /* Options */ + if( ui.subCheckBox->isChecked() && !ui.subInput->text().isEmpty() ) { + mrl.append( " :sub-file=" + colon_escape( ui.subInput->text() ) ); int align = ui.alignSubComboBox->itemData( ui.alignSubComboBox->currentIndex() ).toInt(); mrl.append( " :subsdec-align=" + QString().setNum( align ) ); @@ -177,35 +238,31 @@ void FileOpenPanel::updateMRL() mrl.append( " :freetype-rel-fontsize=" + QString().setNum( size ) ); } - emit mrlUpdated( mrl ); + emit mrlUpdated( fileList, mrl ); emit methodChanged( "file-caching" ); } /* Function called by Open Dialog when clicke on Play/Enqueue */ void FileOpenPanel::accept() { - //TODO set the completer - p_intf->p_sys->psz_filepath = qtu( dialogBox->directory().absolutePath() ); -} - -void FileOpenBox::accept() -{ - OpenDialog::getInstance( NULL, NULL, true )->selectSlots(); + if( dialogBox ) + p_intf->p_sys->filepath = dialogBox->directory().absolutePath(); + ui.fileListWidg->clear(); } /* Function called by Open Dialog when clicked on cancel */ void FileOpenPanel::clear() { - lineFileEdit->clear(); + ui.fileListWidg->clear(); ui.subInput->clear(); } -void FileOpenPanel::toggleSubtitleFrame() +/* Update buttons depending on current selection */ +void FileOpenPanel::updateButtons() { - TOGGLEV( ui.subFrame ); - - /* Update the MRL */ - updateMRL(); + bool b_has_files = ( ui.fileListWidg->count() > 0 ); + ui.removeFileButton->setEnabled( b_has_files ); + ui.subCheckBox->setEnabled( b_has_files ); } /************************************************************************** @@ -217,19 +274,19 @@ DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : ui.setupUi( this ); /* Get the default configuration path for the devices */ - psz_dvddiscpath = config_GetPsz( p_intf, "dvd" ); - psz_vcddiscpath = config_GetPsz( p_intf, "vcd" ); - psz_cddadiscpath = config_GetPsz( p_intf, "cd-audio" ); + psz_dvddiscpath = var_InheritString( p_intf, "dvd" ); + psz_vcddiscpath = var_InheritString( p_intf, "vcd" ); + psz_cddadiscpath = var_InheritString( p_intf, "cd-audio" ); /* State to avoid overwritting the users changes with the configuration */ b_firstdvd = true; b_firstvcd = true; b_firstcdda = true; - ui.browseDiscButton->setToolTip( I_DEVICE_TOOLTIP ); - ui.deviceCombo->setToolTip( I_DEVICE_TOOLTIP ); + ui.browseDiscButton->setToolTip( qtr( I_DEVICE_TOOLTIP )); + ui.deviceCombo->setToolTip( qtr(I_DEVICE_TOOLTIP) ); -#if WIN32 /* Disc drives probing for Windows */ +#ifdef WIN32 /* Disc drives probing for Windows */ char szDrives[512]; szDrives[0] = '\0'; if( GetLogicalDriveStringsA( sizeof( szDrives ) - 1, szDrives ) ) @@ -258,7 +315,7 @@ DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : BUTTONACT( ui.audioCDRadioButton, updateButtons() ); BUTTONACT( ui.dvdsimple, updateButtons() ); BUTTONACT( ui.browseDiscButton, browseDevice() ); - BUTTON_SET_ACT_I( ui.ejectButton, "", eject, qtr( "Eject the disc" ), + BUTTON_SET_ACT_I( ui.ejectButton, "", toolbar/eject, qtr( "Eject the disc" ), eject() ); CONNECT( ui.deviceCombo, editTextChanged( QString ), this, updateMRL()); @@ -273,15 +330,17 @@ DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : DiscOpenPanel::~DiscOpenPanel() { - delete psz_dvddiscpath; - delete psz_vcddiscpath; - delete psz_cddadiscpath; + free( psz_dvddiscpath ); + free( psz_vcddiscpath ); + free( psz_cddadiscpath ); } void DiscOpenPanel::clear() { ui.titleSpin->setValue( 0 ); ui.chapterSpin->setValue( 0 ); + ui.subtitlesSpin->setValue( -1 ); + ui.audioSpin->setValue( -1 ); b_firstcdda = true; b_firstdvd = true; b_firstvcd = true; @@ -342,20 +401,26 @@ void DiscOpenPanel::updateButtons() updateMRL(); } +#undef setDrive + /* Update the current MRL */ void DiscOpenPanel::updateMRL() { QString mrl = ""; + QStringList fileList; - /* CDDAX and VCDX not implemented. TODO ? */ + /* CDDAX and VCDX not implemented. TODO ? No. */ /* DVD */ if( ui.dvdRadioButton->isChecked() ) { if( !ui.dvdsimple->isChecked() ) - mrl = "\"dvd://"; + mrl = "dvd://"; else - mrl = "\"dvdsimple://"; + mrl = "dvdsimple://"; mrl += ui.deviceCombo->currentText(); - emit methodChanged( "dvdnav-caching" ); + if( !ui.dvdsimple->isChecked() ) + emit methodChanged( "dvdnav-caching" ); + else + emit methodChanged( "dvdread-caching" ); if ( ui.titleSpin->value() > 0 ) { mrl += QString("@%1").arg( ui.titleSpin->value() ); @@ -366,7 +431,7 @@ void DiscOpenPanel::updateMRL() /* VCD */ } else if ( ui.vcdRadioButton->isChecked() ) { - mrl = "\"vcd://" + ui.deviceCombo->currentText(); + mrl = "vcd://" + ui.deviceCombo->currentText(); emit methodChanged( "vcd-caching" ); if( ui.titleSpin->value() > 0 ) { @@ -375,13 +440,11 @@ void DiscOpenPanel::updateMRL() /* CDDA */ } else { - mrl = "\"cdda://" + ui.deviceCombo->currentText(); - if( ui.titleSpin->value() > 0 ) { - QString("@%1").arg( ui.titleSpin->value() ); - } + mrl = "cdda://" + ui.deviceCombo->currentText(); + emit methodChanged( "cdda-caching" ); } - mrl += "\""; + fileList << mrl; mrl = ""; if ( ui.dvdRadioButton->isChecked() || ui.vcdRadioButton->isChecked() ) { @@ -394,16 +457,21 @@ void DiscOpenPanel::updateMRL() QString("%1").arg( ui.subtitlesSpin->value() ); } } - emit mrlUpdated( mrl ); + else + { + if( ui.titleSpin->value() > 0 ) + mrl += QString(" :cdda-track=%1").arg( ui.titleSpin->value() ); + } + emit mrlUpdated( fileList, mrl ); } void DiscOpenPanel::browseDevice() { - QString dir = QFileDialog::getExistingDirectory( 0, + QString dir = QFileDialog::getExistingDirectory( this, qtr( I_DEVICE_TOOLTIP ) ); - if (!dir.isEmpty()) { - ui.deviceCombo->setEditText( dir ); - } + if (!dir.isEmpty()) + ui.deviceCombo->setEditText( toNativeSepNoSlash( dir ) ); + updateMRL(); } @@ -424,125 +492,90 @@ NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : ui.setupUi( this ); /* CONNECTs */ - CONNECT( ui.protocolCombo, activated( int ), - this, updateProtocol( int ) ); - CONNECT( ui.portSpin, valueChanged( int ), this, updateMRL() ); - CONNECT( ui.addressText, textChanged( QString ), this, updateMRL()); - CONNECT( ui.timeShift, clicked(), this, updateMRL()); - - ui.protocolCombo->addItem( "" ); - ui.protocolCombo->addItem("HTTP", QVariant("http")); - ui.protocolCombo->addItem("HTTPS", QVariant("https")); - ui.protocolCombo->addItem("MMS", QVariant("mms")); - ui.protocolCombo->addItem("FTP", QVariant("ftp")); - ui.protocolCombo->addItem("RTSP", QVariant("rtsp")); - ui.protocolCombo->addItem("RTP", QVariant("rtp")); - ui.protocolCombo->addItem("UDP", QVariant("udp")); - ui.protocolCombo->addItem("RTMP", QVariant("rtmp")); - - updateProtocol( ui.protocolCombo->currentIndex() ); -} + CONNECT( ui.urlText, textChanged( const QString& ), this, updateMRL()); -NetOpenPanel::~NetOpenPanel() -{} + if( var_InheritBool( p_intf, "qt-recentplay" ) ) + { + mrlList = new QStringListModel( + getSettings()->value( "Open/netMRL" ).toStringList() ); + QCompleter *completer = new QCompleter( mrlList, this ); + ui.urlText->setCompleter( completer ); -void NetOpenPanel::clear() -{} + CONNECT( ui.urlText, editingFinished(), this, updateCompleter() ); + } + else + mrlList = NULL; +} -/* update the widgets according the type of protocol */ -void NetOpenPanel::updateProtocol( int idx_proto ) { - QString addr = ui.addressText->text(); - QString proto = ui.protocolCombo->itemData( idx_proto ).toString(); +NetOpenPanel::~NetOpenPanel() +{ + if( !mrlList ) return; - ui.timeShift->setEnabled( idx_proto == UDP_PROTO ); - ui.portSpin->setEnabled( idx_proto == UDP_PROTO || - idx_proto == RTP_PROTO ); + QStringList tempL = mrlList->stringList(); + while( tempL.size() > 8 ) tempL.removeFirst(); - if( idx_proto == NO_PROTO ) return; + getSettings()->setValue( "Open/netMRL", tempL ); - /* If we already have a protocol in the address, replace it */ - if( addr.contains( "://")) - { - if( idx_proto != UDP_PROTO && idx_proto != RTP_PROTO ) - addr.replace( QRegExp("^.*://@*"), proto + "://"); - else - addr.replace( QRegExp("^.*://"), proto + "://@"); - ui.addressText->setText( addr ); - } - updateMRL(); + delete mrlList; } -void NetOpenPanel::updateMRL() { - QString mrl = ""; - QString addr = ui.addressText->text(); - addr = QUrl::toPercentEncoding( addr, ":/?#@!$&'()*+,;=" ); - int idx_proto = ui.protocolCombo->currentIndex(); +void NetOpenPanel::clear() +{} - if( addr.contains( "://")) - { - /* Match the correct item in the comboBox */ - ui.protocolCombo->setCurrentIndex( - ui.protocolCombo->findData( addr.section( ':', 0, 0 ) ) ); +static int strcmp_void( const void *k, const void *e ) +{ + return strcmp( (const char *)k, (const char *)e ); +} - if( idx_proto != UDP_PROTO || idx_proto != RTP_PROTO ) - mrl = addr; - } - else +void NetOpenPanel::updateMRL() +{ + static const struct caching_map { - switch( idx_proto ) { - case HTTP_PROTO: - mrl = "http://" + addr; - emit methodChanged("http-caching"); - break; - case HTTPS_PROTO: - mrl = "https://" + addr; - emit methodChanged("http-caching"); - break; - case MMS_PROTO: - mrl = "mms://" + addr; - emit methodChanged("mms-caching"); - break; - case FTP_PROTO: - mrl = "ftp://" + addr; - emit methodChanged("ftp-caching"); - break; - case RTSP_PROTO: - mrl = "rtsp://" + addr; - emit methodChanged("rtsp-caching"); - break; - case UDP_PROTO: - mrl = "udp://@"; - /* Add [] to IPv6 */ - if ( addr.contains(':') && !addr.contains('[') ) - { - mrl += "[" + addr + "]"; - } - else mrl += addr; - mrl += QString(":%1").arg( ui.portSpin->value() ); - emit methodChanged("udp-caching"); - break; - case RTP_PROTO: - mrl = "rtp://@"; - if ( addr.contains(':') && !addr.contains('[') ) - mrl += "[" + addr + "]"; /* Add [] to IPv6 */ - else - mrl += addr; - mrl += QString(":%1").arg( ui.portSpin->value() ); - emit methodChanged("rtp-caching"); - break; - case RTMP_PROTO: - mrl = "rtmp://" + addr; - emit methodChanged("rtmp-caching"); - break; - } - } - - // Encode the boring stuffs + char proto[6]; + char caching[6]; + } schemes[] = + { /* KEEP alphabetical order on first column!! */ + { "dccp", "rtp" }, + { "ftp", "ftp" }, + { "ftps", "ftp" }, + { "http", "http" }, + { "https", "http" }, + { "mms", "mms" }, + { "mmsh", "mms" }, + { "mmst", "mms" }, + { "mmsu", "mms" }, + { "sftp", "sftp" }, + { "smb", "smb" }, + { "rtmp", "rtmp" }, + { "rtp", "rtp" }, + { "rtsp", "rtsp" }, + { "udp", "udp" }, + }; + + QString url = ui.urlText->text(); + if( !url.contains( "://") ) + return; /* nothing to do this far */ + + /* Match the correct item in the comboBox */ + QString proto = url.section( ':', 0, 0 ); + const struct caching_map *r = (const struct caching_map *) + bsearch( qtu(proto), schemes, sizeof(schemes) / sizeof(schemes[0]), + sizeof(schemes[0]), strcmp_void ); + if( r != NULL && module_exists( r->caching ) ) + emit methodChanged( qfu( r->caching ) + qfu( "-caching" ) ); + + QStringList qsl; + qsl << url; + emit mrlUpdated( qsl, "" ); +} - if( ui.timeShift->isEnabled() && ui.timeShift->isChecked() ) { - mrl += " :access-filter=timeshift"; - } - emit mrlUpdated( mrl ); +void NetOpenPanel::updateCompleter() +{ + assert( mrlList ); + QStringList tempL = mrlList->stringList(); + if( !tempL.contains( ui.urlText->text() ) ) + tempL.append( ui.urlText->text() ); + mrlList->setStringList( tempL ); } /************************************************************************** @@ -551,6 +584,16 @@ void NetOpenPanel::updateMRL() { CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : OpenPanel( _parent, _p_intf ) { + isInitialized = false; +} + +void CaptureOpenPanel::initialize() +{ + if( isInitialized ) return; + + msg_Dbg( p_intf, "Initialization of Capture device panel" ); + isInitialized = true; + ui.setupUi( this ); BUTTONACT( ui.advancedButton, advancedDialog() ); @@ -563,13 +606,13 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : ui.optionsBox->setLayout( stackedPropLayout ); /* Creation and connections of the WIdgets in the stacked layout */ -#define addModuleAndLayouts( number, name, label ) \ +#define addModuleAndLayouts( number, name, label, layout ) \ QWidget * name ## DevPage = new QWidget( this ); \ QWidget * name ## PropPage = new QWidget( this ); \ stackedDevLayout->addWidget( name ## DevPage ); \ stackedPropLayout->addWidget( name ## PropPage ); \ - QGridLayout * name ## DevLayout = new QGridLayout; \ - QGridLayout * name ## PropLayout = new QGridLayout; \ + layout * name ## DevLayout = new layout; \ + layout * name ## PropLayout = new layout; \ name ## DevPage->setLayout( name ## DevLayout ); \ name ## PropPage->setLayout( name ## PropLayout ); \ ui.deviceCombo->addItem( qtr( label ), QVariant( number ) ); @@ -580,8 +623,8 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : /********************* * DirectShow Stuffs * *********************/ - if( module_Exists( p_intf, "dshow" ) ){ - addModuleAndLayouts( DSHOW_DEVICE, dshow, "DirectShow" ); + if( module_exists( "dshow" ) ){ + addModuleAndLayouts( DSHOW_DEVICE, dshow, "DirectShow", QGridLayout ); /* dshow Main */ int line = 0; @@ -608,14 +651,14 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : /* dshow CONNECTs */ CuMRL( vdevDshowW->combo, currentIndexChanged ( int ) ); CuMRL( adevDshowW->combo, currentIndexChanged ( int ) ); - CuMRL( dshowVSizeLine, textChanged( QString ) ); + CuMRL( dshowVSizeLine, textChanged( const QString& ) ); } /************** * BDA Stuffs * **************/ - if( module_Exists( p_intf, "bda" ) ){ - addModuleAndLayouts( BDA_DEVICE, bda, "DVB DirectShow" ); + if( module_exists( "bda" ) ){ + addModuleAndLayouts( BDA_DEVICE, bda, "DVB DirectShow", QGridLayout ); /* bda Main */ QLabel *bdaTypeLabel = new QLabel( qtr( "DVB Type:" ) ); @@ -624,11 +667,13 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : bdas->setChecked( true ); bdac = new QRadioButton( "DVB-C" ); bdat = new QRadioButton( "DVB-T" ); + bdaa = new QRadioButton( "ATSC" ); bdaDevLayout->addWidget( bdaTypeLabel, 0, 0 ); bdaDevLayout->addWidget( bdas, 0, 1 ); bdaDevLayout->addWidget( bdac, 0, 2 ); bdaDevLayout->addWidget( bdat, 0, 3 ); + bdaDevLayout->addWidget( bdaa, 0, 4 ); /* bda Props */ QLabel *bdaFreqLabel = @@ -670,17 +715,19 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : BUTTONACT( bdas, updateButtons() ); BUTTONACT( bdat, updateButtons() ); BUTTONACT( bdac, updateButtons() ); + BUTTONACT( bdaa, updateButtons() ); BUTTONACT( bdas, updateMRL() ); BUTTONACT( bdat, updateMRL() ); BUTTONACT( bdac, updateMRL() ); + BUTTONACT( bdaa, updateMRL() ); } #else /* WIN32 */ /******* * V4L2* *******/ - if( module_Exists( p_intf, "v4l2" ) ){ - addModuleAndLayouts( V4L2_DEVICE, v4l2, "Video for Linux 2" ); + if( module_exists( "v4l2" ) ){ + addModuleAndLayouts( V4L2_DEVICE, v4l2, "Video for Linux 2", QGridLayout ); /* V4l Main panel */ QLabel *v4l2VideoDeviceLabel = new QLabel( qtr( "Video device name" ) ); @@ -706,16 +753,16 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : 1, 0, 3, 1 ); /* v4l2 CONNECTs */ - CuMRL( v4l2VideoDevice, textChanged( QString ) ); - CuMRL( v4l2AudioDevice, textChanged( QString ) ); + CuMRL( v4l2VideoDevice, textChanged( const QString& ) ); + CuMRL( v4l2AudioDevice, textChanged( const QString& ) ); CuMRL( v4l2StdBox, currentIndexChanged ( int ) ); } /******* * V4L * *******/ - if( module_Exists( p_intf, "v4l" ) ){ - addModuleAndLayouts( V4L_DEVICE, v4l, "Video for Linux" ); + if( module_exists( "v4l" ) ){ + addModuleAndLayouts( V4L_DEVICE, v4l, "Video for Linux", QGridLayout ); /* V4l Main panel */ QLabel *v4lVideoDeviceLabel = new QLabel( qtr( "Video device name" ) ); @@ -750,8 +797,8 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : 2, 0, 2, 1 ); /* v4l CONNECTs */ - CuMRL( v4lVideoDevice, textChanged( QString ) ); - CuMRL( v4lAudioDevice, textChanged( QString ) ); + CuMRL( v4lVideoDevice, textChanged( const QString& ) ); + CuMRL( v4lAudioDevice, textChanged( const QString& ) ); CuMRL( v4lFreq, valueChanged ( int ) ); CuMRL( v4lNormBox, currentIndexChanged ( int ) ); } @@ -759,8 +806,9 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : /******* * JACK * *******/ - if( module_Exists( p_intf, "jack" ) ){ - addModuleAndLayouts( JACK_DEVICE, jack, "JACK Audio Connection Kit" ); + if( module_exists( "jack" ) ){ + addModuleAndLayouts( JACK_DEVICE, jack, "JACK Audio Connection Kit", + QGridLayout); /* Jack Main panel */ /* Channels */ @@ -774,15 +822,15 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : jackChannels->setAlignment( Qt::AlignRight ); jackDevLayout->addWidget( jackChannels, 1, 1 ); - /* Jack Props panel */ - /* Selected ports */ QLabel *jackPortsLabel = new QLabel( qtr( "Selected ports:" ) ); - jackPropLayout->addWidget( jackPortsLabel, 0 , 0 ); + jackDevLayout->addWidget( jackPortsLabel, 0 , 0 ); jackPortsSelected = new QLineEdit( qtr( ".*") ); jackPortsSelected->setAlignment( Qt::AlignRight ); - jackPropLayout->addWidget( jackPortsSelected, 0, 1 ); + jackDevLayout->addWidget( jackPortsSelected, 0, 1 ); + + /* Jack Props panel */ /* Caching */ QLabel *jackCachingLabel = new QLabel( qtr( "Input caching:" ) ); @@ -792,7 +840,7 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : jackCaching->setSuffix( " ms" ); jackCaching->setValue(1000); jackCaching->setAlignment( Qt::AlignRight ); - jackPropLayout->addWidget( jackCaching, 1 , 1 ); + jackPropLayout->addWidget( jackCaching, 1 , 2 ); /* Pace */ jackPace = new QCheckBox(qtr( "Use VLC pace" )); @@ -800,21 +848,21 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : /* Auto Connect */ jackConnect = new QCheckBox( qtr( "Auto connnection" )); - jackPropLayout->addWidget( jackConnect, 3, 1 ); + jackPropLayout->addWidget( jackConnect, 2, 2 ); /* Jack CONNECTs */ CuMRL( jackChannels, valueChanged( int ) ); CuMRL( jackCaching, valueChanged( int ) ); CuMRL( jackPace, stateChanged( int ) ); CuMRL( jackConnect, stateChanged( int ) ); - CuMRL( jackPortsSelected, textChanged( QString ) ); + CuMRL( jackPortsSelected, textChanged( const QString& ) ); } /************ * PVR * ************/ - if( module_Exists( p_intf, "pvr" ) ){ - addModuleAndLayouts( PVR_DEVICE, pvr, "PVR" ); + if( module_exists( "pvr" ) ){ + addModuleAndLayouts( PVR_DEVICE, pvr, "PVR", QGridLayout ); /* PVR Main panel */ QLabel *pvrDeviceLabel = new QLabel( qtr( "Device name" ) ); @@ -858,8 +906,8 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : 3, 0, 1, 1 ); /* PVR CONNECTs */ - CuMRL( pvrDevice, textChanged( QString ) ); - CuMRL( pvrRadioDevice, textChanged( QString ) ); + CuMRL( pvrDevice, textChanged( const QString& ) ); + CuMRL( pvrRadioDevice, textChanged( const QString& ) ); CuMRL( pvrFreq, valueChanged ( int ) ); CuMRL( pvrBitr, valueChanged ( int ) ); @@ -869,8 +917,8 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : /************** * DVB Stuffs * **************/ - if( module_Exists( p_intf, "dvb" ) ){ - addModuleAndLayouts( DVB_DEVICE, dvb, "DVB" ); + if( module_exists( "dvb" ) ){ + addModuleAndLayouts( DVB_DEVICE, dvb, "DVB", QGridLayout ); /* DVB Main */ QLabel *dvbDeviceLabel = new QLabel( qtr( "Adapter card to tune" ) ); @@ -901,10 +949,11 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : dvbFreq = new QSpinBox; dvbFreq->setAlignment( Qt::AlignRight ); dvbFreq->setSuffix(" kHz"); + dvbFreq->setSingleStep( 1000 ); setSpinBoxFreq( dvbFreq ); dvbPropLayout->addWidget( dvbFreq, 0, 1 ); - QLabel *dvbSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) ); + dvbSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) ); dvbPropLayout->addWidget( dvbSrateLabel, 1, 0 ); dvbSrate = new QSpinBox; @@ -912,6 +961,24 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : dvbSrate->setSuffix(" kHz"); setSpinBoxFreq( dvbSrate ); dvbPropLayout->addWidget( dvbSrate, 1, 1 ); + + dvbBandLabel = new QLabel( qtr( "Bandwidth" ) ); + dvbPropLayout->addWidget( dvbBandLabel, 2, 0 ); + + dvbBandBox = new QComboBox; + /* This doesn't work since dvb-bandwidth doesn't seem to be a + list of Integers + setfillVLCConfigCombo( "dvb-bandwidth", p_intf, bdaBandBox ); + */ + dvbBandBox->addItem( qtr( "Auto" ), 0 ); + dvbBandBox->addItem( qtr( "6 MHz" ), 6 ); + dvbBandBox->addItem( qtr( "7 MHz" ), 7 ); + dvbBandBox->addItem( qtr( "8 MHz" ), 8 ); + dvbPropLayout->addWidget( dvbBandBox, 2, 1 ); + + dvbBandLabel->hide(); + dvbBandBox->hide(); + dvbPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ), 2, 0, 2, 1 ); @@ -919,10 +986,14 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : CuMRL( dvbCard, valueChanged ( int ) ); CuMRL( dvbFreq, valueChanged ( int ) ); CuMRL( dvbSrate, valueChanged ( int ) ); + CuMRL( dvbBandBox, currentIndexChanged ( int ) ); BUTTONACT( dvbs, updateButtons() ); BUTTONACT( dvbt, updateButtons() ); BUTTONACT( dvbc, updateButtons() ); + BUTTONACT( dvbs, updateMRL() ); + BUTTONACT( dvbt, updateMRL() ); + BUTTONACT( dvbc, updateMRL() ); } #endif @@ -931,12 +1002,24 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : /********** * Screen * **********/ - addModuleAndLayouts( SCREEN_DEVICE, screen, "Desktop" ); - QLabel *screenLabel = new QLabel( "This option will open your own " - "desktop in order to save or stream it."); + addModuleAndLayouts( SCREEN_DEVICE, screen, "Desktop", QGridLayout ); + QLabel *screenLabel = new QLabel( qtr( "Your display will be " + "opened and played in order to stream or save it." ) ); screenLabel->setWordWrap( true ); screenDevLayout->addWidget( screenLabel, 0, 0 ); + QLabel *screenFPSLabel = new QLabel( + qtr( "Desired frame rate for the capture." ) ); + screenPropLayout->addWidget( screenFPSLabel, 0, 0 ); + + screenFPS = new QSpinBox; + screenFPS->setValue( 1 ); + screenFPS->setAlignment( Qt::AlignRight ); + screenPropLayout->addWidget( screenFPS, 0, 1 ); + + /* Screen connect */ + CuMRL( screenFPS, valueChanged( int ) ); + /* General connects */ CONNECT( ui.deviceCombo, activated( int ) , stackedDevLayout, setCurrentIndex( int ) ); @@ -945,7 +1028,8 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : CONNECT( ui.deviceCombo, activated( int ), this, updateMRL() ); CONNECT( ui.deviceCombo, activated( int ), this, updateButtons() ); -#undef addModule +#undef CuMRL +#undef addModuleAndLayouts } CaptureOpenPanel::~CaptureOpenPanel() @@ -960,6 +1044,7 @@ void CaptureOpenPanel::clear() void CaptureOpenPanel::updateMRL() { QString mrl = ""; + QStringList fileList; int i_devicetype = ui.deviceCombo->itemData( ui.deviceCombo->currentIndex() ).toInt(); switch( i_devicetype ) @@ -969,76 +1054,97 @@ void CaptureOpenPanel::updateMRL() if( bdas->isChecked() ) mrl = "dvb-s://"; else if( bdat->isChecked() ) mrl = "dvb-t://"; else if( bdac->isChecked() ) mrl = "dvb-c://"; + else if( bdaa->isChecked() ) mrl = "atsc://"; else return; - mrl += " :dvb-frequency=" + QString("%1").arg( bdaFreq->value() ); + mrl += "frequency=" + QString::number( bdaFreq->value() ); + if( bdac->isChecked() || bdat->isChecked() || bdaa->isChecked() ) + mrl +="000"; + fileList << mrl; mrl = ""; + if( bdas->isChecked() || bdac->isChecked() ) - mrl += " :dvb-srate=" + QString("%1").arg( bdaSrate->value() ); - else + mrl += " :dvb-srate=" + QString::number( bdaSrate->value() ); + else if( bdat->isChecked() || bdaa->isChecked() ) mrl += " :dvb-bandwidth=" + - QString("%1").arg( bdaBandBox->itemData( + QString::number( bdaBandBox->itemData( bdaBandBox->currentIndex() ).toInt() ); + emit methodChanged( "dvb-caching" ); break; case DSHOW_DEVICE: - mrl = "dshow://"; - mrl+= " :dshow-vdev=" + QString("\"%1\"").arg( vdevDshowW->getValue() ); - mrl+= " :dshow-adev=" + QString("\"%1\"").arg( adevDshowW->getValue() ); + fileList << "dshow://"; + mrl+= " :dshow-vdev=" + + colon_escape( QString("%1").arg( vdevDshowW->getValue() ) ); + mrl+= " :dshow-adev=" + + colon_escape( QString("%1").arg( adevDshowW->getValue() ) )+" "; if( dshowVSizeLine->isModified() ) - mrl += " :dshow-size=" + dshowVSizeLine->text(); + mrl += ":dshow-size=" + dshowVSizeLine->text(); + emit methodChanged( "dshow-caching" ); break; #else case V4L_DEVICE: - mrl = "v4l://"; - mrl += " :v4l-vdev=" + v4lVideoDevice->text(); - mrl += " :v4l-adev=" + v4lAudioDevice->text(); - mrl += " :v4l-norm=" + QString("%1").arg( v4lNormBox->currentIndex() ); - mrl += " :v4l-frequency=" + QString("%1").arg( v4lFreq->value() ); + fileList << "v4l://" + v4lVideoDevice->text(); + mrl += " :input-slave=alsa://" + v4lAudioDevice->text(); + mrl += " :v4l-norm=" + QString::number( v4lNormBox->currentIndex() ); + mrl += " :v4l-frequency=" + QString::number( v4lFreq->value() ); break; case V4L2_DEVICE: - mrl = "v4l2://"; - mrl += " :v4l2-dev=" + v4l2VideoDevice->text(); - mrl += " :v4l2-adev=" + v4l2AudioDevice->text(); - mrl += " :v4l2-standard=" + QString("%1").arg( v4l2StdBox->currentIndex() ); + fileList << "v4l2://" + v4l2VideoDevice->text(); + mrl += " :input-slave=alsa://" + v4l2AudioDevice->text(); + mrl += " :v4l2-standard=" + QString::number( v4l2StdBox->currentIndex() ); break; case JACK_DEVICE: mrl = "jack://"; - mrl += "channels=" + QString("%1").arg( jackChannels->value() ); + mrl += "channels=" + QString::number( jackChannels->value() ); mrl += ":ports=" + jackPortsSelected->text(); - mrl += " --jack-input-caching=" + QString("%1").arg( jackCaching->value() ); + fileList << mrl; mrl = ""; + + mrl += " :jack-input-caching=" + QString::number( jackCaching->value() ); if ( jackPace->isChecked() ) { - mrl += " --jack-input-use-vlc-pace"; + mrl += " :jack-input-use-vlc-pace"; } if ( jackConnect->isChecked() ) { - mrl += " --jack-input-auto-connect"; + mrl += " :jack-input-auto-connect"; } break; case PVR_DEVICE: - mrl = "pvr://"; + fileList << "pvr://"; mrl += " :pvr-device=" + pvrDevice->text(); mrl += " :pvr-radio-device=" + pvrRadioDevice->text(); - mrl += " :pvr-norm=" + QString("%1").arg( pvrNormBox->currentIndex() ); + mrl += " :pvr-norm=" + QString::number( pvrNormBox->currentIndex() ); if( pvrFreq->value() ) - mrl += " :pvr-frequency=" + QString("%1").arg( pvrFreq->value() ); + mrl += " :pvr-frequency=" + QString::number( pvrFreq->value() ); if( pvrBitr->value() ) - mrl += " :pvr-bitrate=" + QString("%1").arg( pvrBitr->value() ); + mrl += " :pvr-bitrate=" + QString::number( pvrBitr->value() ); break; case DVB_DEVICE: mrl = "dvb://"; - mrl += " :dvb-adapter=" + QString("%1").arg( dvbCard->value() ); - mrl += " :dvb-frequency=" + QString("%1").arg( dvbFreq->value() ); - mrl += " :dvb-srate=" + QString("%1").arg( dvbSrate->value() ); + mrl += "frequency=" + QString::number( dvbFreq->value() ); + if( dvbc->isChecked() || dvbt->isChecked() ) + mrl +="000"; + fileList << mrl; mrl= ""; + + mrl += " :dvb-adapter=" + QString::number( dvbCard->value() ); + if( dvbs->isChecked() || dvbc->isChecked() ) + mrl += " :dvb-srate=" + QString::number( dvbSrate->value() ); + else if( dvbt->isChecked() ) + mrl += " :dvb-bandwidth=" + + QString::number( dvbBandBox->itemData( + dvbBandBox->currentIndex() ).toInt() ); + break; #endif case SCREEN_DEVICE: - mrl = "screen://"; + fileList << "screen://"; + mrl = " :screen-fps=" + QString::number( screenFPS->value() ); + emit methodChanged( "screen-caching" ); updateButtons(); break; } if( !advMRL.isEmpty() ) mrl += advMRL; - emit mrlUpdated( mrl ); + emit mrlUpdated( fileList, mrl ); } /** @@ -1065,7 +1171,7 @@ void CaptureOpenPanel::updateButtons() bdaBandBox->hide(); bdaBandLabel->hide(); } - else + else if( bdat->isChecked() || bdaa->isChecked() ) { bdaSrate->hide(); bdaSrateLabel->hide(); @@ -1075,12 +1181,24 @@ void CaptureOpenPanel::updateButtons() break; #else case DVB_DEVICE: - if( dvbs->isChecked() ) dvbFreq->setSuffix(" kHz"); - if( dvbc->isChecked() || dvbt->isChecked() ) dvbFreq->setSuffix(" Hz"); + if( dvbs->isChecked() || dvbc->isChecked() ) + { + dvbSrate->show(); + dvbSrateLabel->show(); + dvbBandBox->hide(); + dvbBandLabel->hide(); + } + else if( dvbt->isChecked() ) + { + dvbSrate->hide(); + dvbSrateLabel->hide(); + dvbBandBox->show(); + dvbBandLabel->show(); + } break; #endif case SCREEN_DEVICE: - ui.optionsBox->hide(); + //ui.optionsBox->hide(); ui.advancedButton->hide(); break; } @@ -1096,7 +1214,7 @@ void CaptureOpenPanel::advancedDialog() /* Get the corresponding module */ module_t *p_module = - module_Find( VLC_OBJECT(p_intf), psz_devModule[i_devicetype] ); + module_find( psz_devModule[i_devicetype] ); if( NULL == p_module ) return; /* Init */ @@ -1105,33 +1223,33 @@ void CaptureOpenPanel::advancedDialog() /* Get the confsize */ unsigned int i_confsize; module_config_t *p_config; - p_config = module_GetConfig( p_module, &i_confsize ); + p_config = module_config_get( p_module, &i_confsize ); /* New Adv Prop dialog */ adv = new QDialog( this ); adv->setWindowTitle( qtr( "Advanced Options" ) ); + adv->setWindowRole( "vlc-advanced-options" ); /* A main Layout with a Frame */ QVBoxLayout *mainLayout = new QVBoxLayout( adv ); - QFrame *advFrame = new QFrame; QScrollArea *scroll = new QScrollArea; mainLayout->addWidget( scroll ); + QFrame *advFrame = new QFrame; /* GridLayout inside the Frame */ QGridLayout *gLayout = new QGridLayout( advFrame ); - gLayout->setSizeConstraint( QLayout::SetFixedSize ); - scroll->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); scroll->setWidgetResizable( true ); scroll->setWidget( advFrame ); /* Create the options inside the FrameLayout */ - for( int n = 0; n < i_confsize; n++ ) + for( int n = 0; n < (int)i_confsize; n++ ) { module_config_t *p_item = p_config + n; ConfigControl *config = ConfigControl::createControl( VLC_OBJECT( p_intf ), p_item, advFrame, gLayout, n ); - controls.append( config ); + if ( config ) + controls.append( config ); } /* Button stuffs */ @@ -1154,11 +1272,6 @@ void CaptureOpenPanel::advancedDialog() for( int i = 0; i < controls.size(); i++ ) { ConfigControl *control = controls[i]; - if( !control ) - { - msg_Dbg( p_intf, "This shouldn't happen, please report" ); - continue; - } tempMRL += (i ? " :" : ":"); @@ -1174,7 +1287,7 @@ void CaptureOpenPanel::advancedDialog() case CONFIG_ITEM_FILE: case CONFIG_ITEM_DIRECTORY: case CONFIG_ITEM_MODULE: - tempMRL += QString("=\"%1\"").arg( qobject_cast(control)->getValue() ); + tempMRL += colon_escape( QString("=%1").arg( qobject_cast(control)->getValue() ) ); break; case CONFIG_ITEM_INTEGER: tempMRL += QString("=%1").arg( qobject_cast(control)->getValue() ); @@ -1188,6 +1301,13 @@ void CaptureOpenPanel::advancedDialog() updateMRL(); msg_Dbg( p_intf, "%s", qtu( advMRL ) ); } + for( int i = 0; i < controls.size(); i++ ) + { + ConfigControl *control = controls[i]; + delete control ; + } delete adv; + module_config_free( p_config ); + module_release (p_module); }