QCompleter *fileCompleter = new QCompleter( fileCompleteList, this );
fileCompleter->setModel( new QDirModel( fileCompleter ) );
lineFileEdit->setCompleter( fileCompleter );*/
- if( config_GetInt( p_intf, "qt-embedded-open" ) )
+ if( var_InheritBool( p_intf, "qt-embedded-open" ) )
{
ui.tempWidget->hide();
BuildOldPanel();
/* Connects */
BUTTONACT( ui.fileBrowseButton, browseFile() );
- BUTTONACT( ui.delFileButton, deleteFile() );
+ BUTTONACT( ui.removeFileButton, removeFile() );
BUTTONACT( ui.subBrowseButton, browseFileSub() );
CONNECT( ui.subCheckBox, toggled( bool ), this, toggleSubtitleFrame( bool ) );
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()
void FileOpenPanel::browseFile()
{
- QStringList files = QFileDialog::getOpenFileNames( this );
- foreach( const QString &file, files)
+ 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( file, ui.fileListWidg );
+ QListWidgetItem *item =
+ new QListWidgetItem( toNativeSeparators( file ), ui.fileListWidg );
item->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled );
ui.fileListWidg->addItem( item );
+ savedirpathFromFile( file );
}
+ updateButtons();
updateMRL();
}
-void FileOpenPanel::deleteFile()
+void FileOpenPanel::removeFile()
{
int i = ui.fileListWidg->currentRow();
if( i != -1 )
}
updateMRL();
+ updateButtons();
}
/* Show a fileBrowser to select a subtitle */
EXT_FILTER_SUBTITLE, p_intf->p_sys->filepath );
if( files.isEmpty() ) return;
- ui.subInput->setText( files.join(" ") );
+ ui.subInput->setText( toNativeSeparators( files.join(" ") ) );
updateMRL();
}
/* Function called by Open Dialog when clicke on Play/Enqueue */
void FileOpenPanel::accept()
{
- p_intf->p_sys->filepath = dialogBox->directory().absolutePath();
+ if( dialogBox )
+ p_intf->p_sys->filepath = dialogBox->directory().absolutePath();
ui.fileListWidg->clear();
}
ui.subInput->clear();
}
+/* Update buttons depending on current selection */
+void FileOpenPanel::updateButtons()
+{
+ bool b_has_files = ( ui.fileListWidg->count() > 0 );
+ ui.removeFileButton->setEnabled( b_has_files );
+ ui.subCheckBox->setEnabled( b_has_files );
+}
+
/**************************************************************************
* Open Discs ( DVD, CD, VCD and similar devices ) *
**************************************************************************/
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;
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());
else
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() );
/* CDDA */
} else {
mrl = "cdda://" + ui.deviceCombo->currentText();
+ emit methodChanged( "cdda-caching" );
}
fileList << mrl; mrl = "";
ui.setupUi( this );
/* CONNECTs */
- CONNECT( ui.protocolCombo, activated( int ),
- this, updateProtocol( int ) );
- CONNECT( ui.portSpin, valueChanged( int ), this, updateMRL() );
- CONNECT( ui.addressText, textChanged( const QString& ), 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() );
-
- if( config_GetInt( p_intf, "qt-recentplay" ) )
+ CONNECT( ui.urlText, textChanged( const QString& ), this, updateMRL());
+
+ if( var_InheritBool( p_intf, "qt-recentplay" ) )
{
mrlList = new QStringListModel(
getSettings()->value( "Open/netMRL" ).toStringList() );
QCompleter *completer = new QCompleter( mrlList, this );
- ui.addressText->setCompleter( completer );
+ ui.urlText->setCompleter( completer );
- CONNECT( ui.addressText, editingFinished(), this, updateCompleter() );
+ CONNECT( ui.urlText, editingFinished(), this, updateCompleter() );
}
else
mrlList = NULL;
void NetOpenPanel::clear()
{}
-/* 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();
-
- ui.portSpin->setEnabled( idx_proto == UDP_PROTO ||
- idx_proto == RTP_PROTO );
-
- if( idx_proto == NO_PROTO ) return;
-
- /* 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 if ( ( addr.contains(QRegExp("://((22[4-9])|(23\\d)|(\\[?[fF]{2}[0-9a-fA-F]{2}:))"))) ||
- ( !addr.contains(QRegExp("^\\d{1,3}[.]\\d{1,3}[.]\\d{1,3}[.]\\d{1,3}")) &&
- !addr.contains(QRegExp(":[a-fA-F0-9]{1,4}:")) ) )
- addr.replace( QRegExp("^.*://"), proto + "://@");
- else
- addr.replace( QRegExp("^.*://"), proto + "://");
- addr.replace( QRegExp("@+"), "@");
- ui.addressText->setText( addr );
- }
- updateMRL();
+static int strcmp_void( const void *k, const void *e )
+{
+ return strcmp( (const char *)k, (const char *)e );
}
-void NetOpenPanel::updateMRL() {
- QString mrl = "";
- QString addr = ui.addressText->text();
- addr = QUrl::toPercentEncoding( addr, ":/?#@!$&'()*+,;=" );
- int idx_proto = ui.protocolCombo->currentIndex();
- int addr_is_multicast = addr.contains(QRegExp("^(22[4-9])|(23\\d)|(\\[?[fF]{2}[0-9a-fA-F]{2}:)"))?1:0;
- int addr_is_ipv4 = addr.contains(QRegExp("^\\d{1,3}[.]\\d{1,3}[.]\\d{1,3}[.]\\d{1,3}"))?1:0;
- int addr_is_ipv6 = addr.contains(QRegExp(":[a-fA-F0-9]{1,4}:"))?1:0;
- int addr_has_port = addr.contains(QRegExp("[^:]{5}:\\d{1,5}$"))?1:0;
- if( addr.contains( "://"))
- {
- /* Match the correct item in the comboBox */
- ui.protocolCombo->setCurrentIndex(
- ui.protocolCombo->findData( addr.section( ':', 0, 0 ) ) );
- 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:
- if(( addr_is_multicast ) || ( !addr_is_ipv4 && !addr_is_ipv6 ))
- mrl = "udp://@";
- else
- mrl = "udp://";
- /* Add [] to IPv6 */
- if ( addr_is_ipv6 && !addr.contains('[') )
- {
- mrl += "[" + addr + "]";
- }
- else mrl += addr;
- if(!addr_has_port)
- mrl += QString(":%1").arg( ui.portSpin->value() );
- emit methodChanged("udp-caching");
- break;
- case RTP_PROTO:
- if(( addr_is_multicast ) || ( !addr_is_ipv4 && !addr_is_ipv6 ))
- mrl = "rtp://@";
- else
- mrl = "rtp://";
- if ( addr_is_ipv6 && !addr.contains('[') )
- mrl += "[" + addr + "]"; /* Add [] to IPv6 */
- else
- mrl += addr;
- if(!addr_has_port)
- mrl += QString(":%1").arg( ui.portSpin->value() );
- emit methodChanged("rtp-caching");
- break;
- case RTMP_PROTO:
- mrl = "rtmp://" + addr;
- emit methodChanged("rtmp-caching");
- break;
- }
- }
-
- QStringList qsl; qsl<< mrl;
+ 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, "" );
}
{
assert( mrlList );
QStringList tempL = mrlList->stringList();
- if( !tempL.contains( ui.addressText->text() ) )
- tempL.append( ui.addressText->text() );
+ if( !tempL.contains( ui.urlText->text() ) )
+ tempL.append( ui.urlText->text() );
mrlList->setStringList( tempL );
}
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 ) );
* DirectShow Stuffs *
*********************/
if( module_exists( "dshow" ) ){
- addModuleAndLayouts( DSHOW_DEVICE, dshow, "DirectShow" );
+ addModuleAndLayouts( DSHOW_DEVICE, dshow, "DirectShow", QGridLayout );
/* dshow Main */
int line = 0;
* BDA Stuffs *
**************/
if( module_exists( "bda" ) ){
- addModuleAndLayouts( BDA_DEVICE, bda, "DVB DirectShow" );
+ addModuleAndLayouts( BDA_DEVICE, bda, "DVB DirectShow", QGridLayout );
/* bda Main */
QLabel *bdaTypeLabel = new QLabel( qtr( "DVB Type:" ) );
* V4L2*
*******/
if( module_exists( "v4l2" ) ){
- addModuleAndLayouts( V4L2_DEVICE, v4l2, "Video for Linux 2" );
+ addModuleAndLayouts( V4L2_DEVICE, v4l2, "Video for Linux 2", QGridLayout );
/* V4l Main panel */
QLabel *v4l2VideoDeviceLabel = new QLabel( qtr( "Video device name" ) );
* V4L *
*******/
if( module_exists( "v4l" ) ){
- addModuleAndLayouts( V4L_DEVICE, v4l, "Video for Linux" );
+ addModuleAndLayouts( V4L_DEVICE, v4l, "Video for Linux", QGridLayout );
/* V4l Main panel */
QLabel *v4lVideoDeviceLabel = new QLabel( qtr( "Video device name" ) );
* JACK *
*******/
if( module_exists( "jack" ) ){
- addModuleAndLayouts( JACK_DEVICE, jack, "JACK Audio Connection Kit" );
+ addModuleAndLayouts( JACK_DEVICE, jack, "JACK Audio Connection Kit",
+ QGridLayout);
/* Jack Main panel */
/* Channels */
* PVR *
************/
if( module_exists( "pvr" ) ){
- addModuleAndLayouts( PVR_DEVICE, pvr, "PVR" );
+ addModuleAndLayouts( PVR_DEVICE, pvr, "PVR", QGridLayout );
/* PVR Main panel */
QLabel *pvrDeviceLabel = new QLabel( qtr( "Device name" ) );
* DVB Stuffs *
**************/
if( module_exists( "dvb" ) ){
- addModuleAndLayouts( DVB_DEVICE, dvb, "DVB" );
+ addModuleAndLayouts( DVB_DEVICE, dvb, "DVB", QGridLayout );
/* DVB Main */
QLabel *dvbDeviceLabel = new QLabel( qtr( "Adapter card to tune" ) );
CuMRL( dvbCard, valueChanged ( int ) );
CuMRL( dvbFreq, valueChanged ( int ) );
CuMRL( dvbSrate, valueChanged ( int ) );
- CuMRL( dvbBandBox, activated ( int ) );
+ CuMRL( dvbBandBox, currentIndexChanged ( int ) );
BUTTONACT( dvbs, updateButtons() );
BUTTONACT( dvbt, updateButtons() );
/**********
* Screen *
**********/
- addModuleAndLayouts( SCREEN_DEVICE, screen, "Desktop" );
+ 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 );
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 ) );
mrl += " :dvb-bandwidth=" +
QString::number( bdaBandBox->itemData(
bdaBandBox->currentIndex() ).toInt() );
+ emit methodChanged( "dvb-caching" );
break;
case DSHOW_DEVICE:
fileList << "dshow://";
mrl+= " :dshow-vdev=" +
colon_escape( QString("%1").arg( vdevDshowW->getValue() ) );
mrl+= " :dshow-adev=" +
- colon_escape( QString("%1").arg( adevDshowW->getValue() ) );
+ 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:
- fileList << "v4l://";
- mrl += " :v4l-vdev=" + v4lVideoDevice->text();
- mrl += " :v4l-adev=" + v4lAudioDevice->text();
+ 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:
- fileList << "v4l2://";
- mrl += " :v4l2-dev=" + v4l2VideoDevice->text();
- mrl += " :v4l2-adev=" + v4l2AudioDevice->text();
+ fileList << "v4l2://" + v4l2VideoDevice->text();
+ mrl += " :input-slave=alsa://" + v4l2AudioDevice->text();
mrl += " :v4l2-standard=" + QString::number( v4l2StdBox->currentIndex() );
break;
case JACK_DEVICE:
case SCREEN_DEVICE:
fileList << "screen://";
mrl = " :screen-fps=" + QString::number( screenFPS->value() );
+ emit methodChanged( "screen-caching" );
updateButtons();
break;
}
/* 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 );