📄 open_panels.cpp
字号:
QString dir = QFileDialog::getExistingDirectory( 0, qtr( I_DEVICE_TOOLTIP ) ); if (!dir.isEmpty()) { ui.deviceCombo->setEditText( dir ); } updateMRL();}void DiscOpenPanel::eject(){ intf_Eject( p_intf, qtu( ui.deviceCombo->currentText() ) );}void DiscOpenPanel::accept(){}/************************************************************************** * Open Network streams and URL pages * **************************************************************************/NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : OpenPanel( _parent, _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() );}NetOpenPanel::~NetOpenPanel(){}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.timeShift->setEnabled( idx_proto == UDP_PROTO ); 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 addr.replace( QRegExp("^.*://"), proto + "://@"); ui.addressText->setText( addr ); } updateMRL();}void NetOpenPanel::updateMRL() { QString mrl = ""; QString addr = ui.addressText->text(); addr = QUrl::toPercentEncoding( addr, ":/?#@!$&'()*+,;=" ); int idx_proto = ui.protocolCombo->currentIndex(); if( addr.contains( "://")) { /* Match the correct item in the comboBox */ ui.protocolCombo->setCurrentIndex( ui.protocolCombo->findData( addr.section( ':', 0, 0 ) ) ); if( idx_proto != UDP_PROTO || idx_proto != RTP_PROTO ) mrl = addr; } else { 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 if( ui.timeShift->isEnabled() && ui.timeShift->isChecked() ) { mrl += " :access-filter=timeshift"; } emit mrlUpdated( mrl );}/************************************************************************** * Open Capture device ( DVB, PVR, V4L, and similar ) * **************************************************************************/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() ); /* Create two stacked layouts in the main comboBoxes */ QStackedLayout *stackedDevLayout = new QStackedLayout; ui.cardBox->setLayout( stackedDevLayout ); QStackedLayout *stackedPropLayout = new QStackedLayout; ui.optionsBox->setLayout( stackedPropLayout ); /* Creation and connections of the WIdgets in the stacked layout */#define addModuleAndLayouts( number, name, label ) \ 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; \ name ## DevPage->setLayout( name ## DevLayout ); \ name ## PropPage->setLayout( name ## PropLayout ); \ ui.deviceCombo->addItem( qtr( label ), QVariant( number ) );#define CuMRL( widget, slot ) CONNECT( widget , slot , this, updateMRL() );#ifdef WIN32 /********************* * DirectShow Stuffs * *********************/ if( module_Exists( p_intf, "dshow" ) ){ addModuleAndLayouts( DSHOW_DEVICE, dshow, "DirectShow" ); /* dshow Main */ int line = 0; module_config_t *p_config = config_FindConfig( VLC_OBJECT(p_intf), "dshow-vdev" ); vdevDshowW = new StringListConfigControl( VLC_OBJECT(p_intf), p_config, this, false, dshowDevLayout, line ); line++; p_config = config_FindConfig( VLC_OBJECT(p_intf), "dshow-adev" ); adevDshowW = new StringListConfigControl( VLC_OBJECT(p_intf), p_config, this, false, dshowDevLayout, line ); line++; /* dshow Properties */ QLabel *dshowVSizeLabel = new QLabel( qtr( "Video size" ) ); dshowPropLayout->addWidget( dshowVSizeLabel, 0, 0 ); dshowVSizeLine = new QLineEdit; dshowPropLayout->addWidget( dshowVSizeLine, 0, 1); dshowPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ), 1, 0, 3, 1 ); /* dshow CONNECTs */ CuMRL( vdevDshowW->combo, currentIndexChanged ( int ) ); CuMRL( adevDshowW->combo, currentIndexChanged ( int ) ); CuMRL( dshowVSizeLine, textChanged( QString ) ); } /************** * BDA Stuffs * **************/ if( module_Exists( p_intf, "bda" ) ){ addModuleAndLayouts( BDA_DEVICE, bda, "DVB DirectShow" ); /* bda Main */ QLabel *bdaTypeLabel = new QLabel( qtr( "DVB Type:" ) ); bdas = new QRadioButton( "DVB-S" ); bdas->setChecked( true ); bdac = new QRadioButton( "DVB-C" ); bdat = new QRadioButton( "DVB-T" ); bdaDevLayout->addWidget( bdaTypeLabel, 0, 0 ); bdaDevLayout->addWidget( bdas, 0, 1 ); bdaDevLayout->addWidget( bdac, 0, 2 ); bdaDevLayout->addWidget( bdat, 0, 3 ); /* bda Props */ QLabel *bdaFreqLabel = new QLabel( qtr( "Transponder/multiplex frequency" ) ); bdaPropLayout->addWidget( bdaFreqLabel, 0, 0 ); bdaFreq = new QSpinBox; bdaFreq->setAlignment( Qt::AlignRight ); bdaFreq->setSuffix(" kHz"); bdaFreq->setSingleStep( 1000 ); setSpinBoxFreq( bdaFreq ) bdaPropLayout->addWidget( bdaFreq, 0, 1 ); bdaSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) ); bdaPropLayout->addWidget( bdaSrateLabel, 1, 0 ); bdaSrate = new QSpinBox; bdaSrate->setAlignment( Qt::AlignRight ); bdaSrate->setSuffix(" kHz"); setSpinBoxFreq( bdaSrate ); bdaPropLayout->addWidget( bdaSrate, 1, 1 ); bdaBandLabel = new QLabel( qtr( "Bandwidth" ) ); bdaPropLayout->addWidget( bdaBandLabel, 2, 0 ); bdaBandBox = new QComboBox; setfillVLCConfigCombo( "dvb-bandwidth", p_intf, bdaBandBox ); bdaPropLayout->addWidget( bdaBandBox, 2, 1 ); bdaBandLabel->hide(); bdaBandBox->hide(); bdaPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ), 2, 0, 2, 1 ); /* bda CONNECTs */ CuMRL( bdaFreq, valueChanged ( int ) ); CuMRL( bdaSrate, valueChanged ( int ) ); CuMRL( bdaBandBox, currentIndexChanged ( int ) ); BUTTONACT( bdas, updateButtons() ); BUTTONACT( bdat, updateButtons() ); BUTTONACT( bdac, updateButtons() ); BUTTONACT( bdas, updateMRL() ); BUTTONACT( bdat, updateMRL() ); BUTTONACT( bdac, updateMRL() ); }#else /* WIN32 */ /******* * V4L2* *******/ if( module_Exists( p_intf, "v4l2" ) ){ addModuleAndLayouts( V4L2_DEVICE, v4l2, "Video for Linux 2" ); /* V4l Main panel */ QLabel *v4l2VideoDeviceLabel = new QLabel( qtr( "Video device name" ) ); v4l2DevLayout->addWidget( v4l2VideoDeviceLabel, 0, 0 ); v4l2VideoDevice = new QLineEdit; v4l2DevLayout->addWidget( v4l2VideoDevice, 0, 1 ); QLabel *v4l2AudioDeviceLabel = new QLabel( qtr( "Audio device name" ) ); v4l2DevLayout->addWidget( v4l2AudioDeviceLabel, 1, 0 ); v4l2AudioDevice = new QLineEdit; v4l2DevLayout->addWidget( v4l2AudioDevice, 1, 1 ); /* v4l2 Props panel */ QLabel *v4l2StdLabel = new QLabel( qtr( "Standard" ) ); v4l2PropLayout->addWidget( v4l2StdLabel, 0 , 0 ); v4l2StdBox = new QComboBox; setfillVLCConfigCombo( "v4l2-standard", p_intf, v4l2StdBox ); v4l2PropLayout->addWidget( v4l2StdBox, 0 , 1 ); v4l2PropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ), 1, 0, 3, 1 ); /* v4l2 CONNECTs */ CuMRL( v4l2VideoDevice, textChanged( QString ) ); CuMRL( v4l2AudioDevice, textChanged( QString ) ); CuMRL( v4l2StdBox, currentIndexChanged ( int ) ); } /******* * V4L * *******/ if( module_Exists( p_intf, "v4l" ) ){ addModuleAndLayouts( V4L_DEVICE, v4l, "Video for Linux" ); /* V4l Main panel */ QLabel *v4lVideoDeviceLabel = new QLabel( qtr( "Video device name" ) ); v4lDevLayout->addWidget( v4lVideoDeviceLabel, 0, 0 ); v4lVideoDevice = new QLineEdit; v4lDevLayout->addWidget( v4lVideoDevice, 0, 1 ); QLabel *v4lAudioDeviceLabel = new QLabel( qtr( "Audio device name" ) ); v4lDevLayout->addWidget( v4lAudioDeviceLabel, 1, 0 ); v4lAudioDevice = new QLineEdit; v4lDevLayout->addWidget( v4lAudioDevice, 1, 1 ); /* V4l Props panel */ QLabel *v4lNormLabel = new QLabel( qtr( "Norm" ) ); v4lPropLayout->addWidget( v4lNormLabel, 0 , 0 ); v4lNormBox = new QComboBox; setfillVLCConfigCombo( "v4l-norm", p_intf, v4lNormBox ); v4lPropLayout->addWidget( v4lNormBox, 0 , 1 ); QLabel *v4lFreqLabel = new QLabel( qtr( "Frequency" ) ); v4lPropLayout->addWidget( v4lFreqLabel, 1 , 0 ); v4lFreq = new QSpinBox; v4lFreq->setAlignment( Qt::AlignRight ); v4lFreq->setSuffix(" kHz"); setSpinBoxFreq( v4lFreq ); v4lPropLayout->addWidget( v4lFreq, 1 , 1 ); v4lPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ), 2, 0, 2, 1 ); /* v4l CONNECTs */ CuMRL( v4lVideoDevice, textChanged( QString ) ); CuMRL( v4lAudioDevice, textChanged( QString ) ); CuMRL( v4lFreq, valueChanged ( int ) ); CuMRL( v4lNormBox, currentIndexChanged ( int ) ); } /******* * JACK * *******/ if( module_Exists( p_intf, "jack" ) ){ addModuleAndLayouts( JACK_DEVICE, jack, "JACK Audio Connection Kit" ); /* Jack Main panel */ /* Channels */ QLabel *jackChannelsLabel = new QLabel( qtr( "Channels:" ) ); jackDevLayout->addWidget( jackChannelsLabel, 1, 0 ); jackChannels = new QSpinBox; setSpinBoxFreq( jackChannels ); jackChannels->setMaximum(255); jackChannels->setValue(2); 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 ); jackPortsSelected = new QLineEdit( qtr( ".*") ); jackPortsSelected->setAlignment( Qt::AlignRight ); jackPropLayout->addWidget( jackPortsSelected, 0, 1 ); /* Caching */ QLabel *jackCachingLabel = new QLabel( qtr( "Input caching:" ) ); jackPropLayout->addWidget( jackCachingLabel, 1 , 0 ); jackCaching = new QSpinBox; setSpinBoxFreq( jackCaching ); jackCaching->setSuffix( " ms" ); jackCaching->setValue(1000); jackCaching->setAlignment( Qt::AlignRight ); jackPropLayout->addWidget( jackCaching, 1 , 1 ); /* Pace */ jackPace = new QCheckBox(qtr( "Use VLC pace" ));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -