1 /*****************************************************************************
2 * open.cpp : Panels for the open dialogs
3 ****************************************************************************
4 * Copyright (C) 2006-2007 the VideoLAN team
7 * Authors: Clément Stenac <zorglub@videolan.org>
8 * Jean-Baptiste Kempf <jb@videolan.org>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
27 #include "components/open.hpp"
28 #include "dialogs/open.hpp"
29 #include "dialogs_provider.hpp"
30 #include "util/customwidgets.hpp"
32 #include <QFileDialog>
33 #include <QDialogButtonBox>
35 #include <QStackedLayout>
42 /**************************************************************************
43 * Open Files and subtitles *
44 **************************************************************************/
45 FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
46 OpenPanel( _parent, _p_intf )
48 /* Classic UI Setup */
51 /* Use a QFileDialog and customize it because we don't want to
52 rewrite it all. Be careful to your eyes cause there are a few hacks.
53 Be very careful and test correctly when you modify this. */
55 /* Set Filters for file selection */
56 QString fileTypes = "";
57 ADD_FILTER_MEDIA( fileTypes );
58 ADD_FILTER_VIDEO( fileTypes );
59 ADD_FILTER_AUDIO( fileTypes );
60 ADD_FILTER_PLAYLIST( fileTypes );
61 ADD_FILTER_ALL( fileTypes );
62 fileTypes.replace( QString(";*"), QString(" *"));
64 // Make this QFileDialog a child of tempWidget from the ui.
65 dialogBox = new FileOpenBox( ui.tempWidget, NULL,
66 qfu( p_intf->p_libvlc->psz_homedir ), fileTypes );
67 /* dialogBox->setFileMode( QFileDialog::ExistingFiles );*/
68 /* dialogBox->setAcceptMode( QFileDialog::AcceptOpen );*/
70 /* retrieve last known path used in file browsing */
71 char *psz_filepath = config_GetPsz( p_intf, "qt-filedialog-path" );
74 dialogBox->setDirectory( QString::fromUtf8( psz_filepath ) );
78 /* We don't want to see a grip in the middle of the window, do we? */
79 dialogBox->setSizeGripEnabled( false );
82 dialogBox->setToolTip( qtr( "Select one or multiple files, or a folder" ) );
84 // Add it to the layout
85 ui.gridLayout->addWidget( dialogBox, 0, 0, 1, 3 );
87 // But hide the two OK/Cancel buttons. Enable them for debug.
88 QDialogButtonBox *fileDialogAcceptBox =
89 findChildren<QDialogButtonBox*>()[0];
90 fileDialogAcceptBox->hide();
92 /* Ugly hacks to get the good Widget */
93 //This lineEdit is the normal line in the fileDialog.
94 lineFileEdit = findChildren<QLineEdit*>()[3];
97 /* Make a list of QLabel inside the QFileDialog to access the good ones */
98 QList<QLabel *> listLabel = findChildren<QLabel*>();
100 /* Hide the FileNames one. Enable it for debug */
101 listLabel[4]->hide();
102 /* Change the text that was uncool in the usual box */
103 listLabel[5]->setText( qtr( "Filter:" ) );
106 /* QFileDialog is quite buggy make it brerable on win32 by tweaking
108 QListView *fileListView = findChildren<QListView*>().first();
109 fileListView->setLayoutMode(QListView::Batched);
110 fileListView->setViewMode(QListView::ListMode);
111 fileListView->setResizeMode(QListView::Adjust);
112 fileListView->setUniformItemSizes(false);
113 fileListView->setFlow(QListView::TopToBottom);
114 fileListView->setWrapping(true);
117 // Hide the subtitles control by default.
120 /* Build the subs size combo box */
121 setfillVLCConfigCombo( "freetype-rel-fontsize" , p_intf,
122 ui.sizeSubComboBox );
124 /* Build the subs align combo box */
125 setfillVLCConfigCombo( "subsdec-align", p_intf, ui.alignSubComboBox );
128 BUTTONACT( ui.subBrowseButton, browseFileSub() );
129 BUTTONACT( ui.subCheckBox, toggleSubtitleFrame());
131 CONNECT( ui.fileInput, editTextChanged( QString ), this, updateMRL() );
132 CONNECT( ui.subInput, editTextChanged( QString ), this, updateMRL() );
133 CONNECT( ui.alignSubComboBox, currentIndexChanged( int ), this,
135 CONNECT( ui.sizeSubComboBox, currentIndexChanged( int ), this,
138 /* CONNECT( lineFileEdit, textChanged( QString ), this, browseFile() );*/
141 FileOpenPanel::~FileOpenPanel()
144 QStringList FileOpenPanel::browse( QString help )
146 return THEDP->showSimpleOpen( help );
150 /* Unused. FIXME ? */
151 void FileOpenPanel::browseFile()
153 QString fileString = "";
154 foreach( QString file, dialogBox->selectedFiles() ) {
155 fileString += "\"" + file + "\" ";
157 ui.fileInput->setEditText( fileString );
162 void FileOpenPanel::browseFileSub()
164 // FIXME Handle selection of more than one subtitles file
165 QStringList files = THEDP->showSimpleOpen( qtr("Open subtitles file"),
167 dialogBox->directory().absolutePath() );
168 if( files.isEmpty() ) return;
169 ui.subInput->setEditText( files.join(" ") );
173 void FileOpenPanel::updateMRL()
175 QString mrl = ui.fileInput->currentText();
177 if( ui.subCheckBox->isChecked() ) {
178 mrl.append( " :sub-file=" + ui.subInput->currentText() );
179 int align = ui.alignSubComboBox->itemData(
180 ui.alignSubComboBox->currentIndex() ).toInt();
181 mrl.append( " :subsdec-align=" + QString().setNum( align ) );
182 int size = ui.sizeSubComboBox->itemData(
183 ui.sizeSubComboBox->currentIndex() ).toInt();
184 mrl.append( " :freetype-rel-fontsize=" + QString().setNum( size ) );
187 const char *psz_filepath = config_GetPsz( p_intf, "qt-filedialog-path" );
188 if( ( NULL == psz_filepath )
189 || strcmp( psz_filepath, qtu( dialogBox->directory().absolutePath() )) )
191 /* set dialog box current directory as last known path */
192 config_PutPsz( p_intf, "qt-filedialog-path",
193 qtu( dialogBox->directory().absolutePath() ) );
197 emit mrlUpdated( mrl );
198 emit methodChanged( "file-caching" );
202 /* Function called by Open Dialog when clicke on Play/Enqueue */
203 void FileOpenPanel::accept()
205 ui.fileInput->addItem( ui.fileInput->currentText());
206 if ( ui.fileInput->count() > 8 ) ui.fileInput->removeItem( 0 );
209 void FileOpenBox::accept()
211 OpenDialog::getInstance( NULL, NULL )->play();
214 /* Function called by Open Dialog when clicked on cancel */
215 void FileOpenPanel::clear()
217 ui.fileInput->setEditText( "" );
218 ui.subInput->setEditText( "" );
221 void FileOpenPanel::toggleSubtitleFrame()
223 if ( ui.subFrame->isVisible() )
238 /**************************************************************************
239 * Open Discs ( DVD, CD, VCD and similar devices ) *
240 **************************************************************************/
241 DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
242 OpenPanel( _parent, _p_intf )
246 /*Win 32 Probe as in WX ? */
249 BUTTONACT( ui.dvdRadioButton, updateButtons());
250 BUTTONACT( ui.vcdRadioButton, updateButtons());
251 BUTTONACT( ui.audioCDRadioButton, updateButtons());
252 BUTTONACT( ui.dvdsimple, updateButtons());
254 CONNECT( ui.deviceCombo, editTextChanged( QString ), this, updateMRL());
255 CONNECT( ui.titleSpin, valueChanged( int ), this, updateMRL());
256 CONNECT( ui.chapterSpin, valueChanged( int ), this, updateMRL());
257 CONNECT( ui.audioSpin, valueChanged( int ), this, updateMRL());
258 CONNECT( ui.subtitlesSpin, valueChanged( int ), this, updateMRL());
261 DiscOpenPanel::~DiscOpenPanel()
264 void DiscOpenPanel::clear()
266 ui.titleSpin->setValue( 0 );
267 ui.chapterSpin->setValue( 0 );
270 void DiscOpenPanel::updateButtons()
272 if ( ui.dvdRadioButton->isChecked() )
274 ui.titleLabel->setText( qtr("Title") );
275 ui.chapterLabel->show();
276 ui.chapterSpin->show();
277 ui.diskOptionBox_2->show();
279 else if ( ui.vcdRadioButton->isChecked() )
281 ui.titleLabel->setText( qtr("Entry") );
282 ui.chapterLabel->hide();
283 ui.chapterSpin->hide();
284 ui.diskOptionBox_2->show();
288 ui.titleLabel->setText( qtr("Track") );
289 ui.chapterLabel->hide();
290 ui.chapterSpin->hide();
291 ui.diskOptionBox_2->hide();
298 void DiscOpenPanel::updateMRL()
302 /* CDDAX and VCDX not implemented. FIXME ? */
304 if( ui.dvdRadioButton->isChecked() ) {
305 if( !ui.dvdsimple->isChecked() )
308 mrl = "dvdsimple://";
309 mrl += ui.deviceCombo->currentText();
310 emit methodChanged( "dvdnav-caching" );
312 if ( ui.titleSpin->value() > 0 ) {
313 mrl += QString("@%1").arg( ui.titleSpin->value() );
314 if ( ui.chapterSpin->value() > 0 ) {
315 mrl+= QString(":%1").arg( ui.chapterSpin->value() );
320 } else if ( ui.vcdRadioButton->isChecked() ) {
321 mrl = "vcd://" + ui.deviceCombo->currentText();
322 emit methodChanged( "vcd-caching" );
324 if( ui.titleSpin->value() > 0 ) {
325 mrl += QString("@E%1").arg( ui.titleSpin->value() );
330 mrl = "cdda://" + ui.deviceCombo->currentText();
331 if( ui.titleSpin->value() > 0 ) {
332 QString("@%1").arg( ui.titleSpin->value() );
336 if ( ui.dvdRadioButton->isChecked() || ui.vcdRadioButton->isChecked() )
338 if ( ui.audioSpin->value() >= 0 ) {
339 mrl += " :audio-track=" +
340 QString("%1").arg( ui.audioSpin->value() );
342 if ( ui.subtitlesSpin->value() >= 0 ) {
343 mrl += " :sub-track=" +
344 QString("%1").arg( ui.subtitlesSpin->value() );
347 emit mrlUpdated( mrl );
352 /**************************************************************************
353 * Open Network streams and URL pages *
354 **************************************************************************/
355 NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
356 OpenPanel( _parent, _p_intf )
361 CONNECT( ui.protocolCombo, currentIndexChanged( int ),
362 this, updateProtocol( int ) );
363 CONNECT( ui.portSpin, valueChanged( int ), this, updateMRL() );
364 CONNECT( ui.addressText, textChanged( QString ), this, updateAddress());
365 CONNECT( ui.timeShift, clicked(), this, updateMRL());
366 CONNECT( ui.ipv6, clicked(), this, updateMRL());
368 ui.protocolCombo->addItem("HTTP", QVariant("http"));
369 ui.protocolCombo->addItem("HTTPS", QVariant("https"));
370 ui.protocolCombo->addItem("FTP", QVariant("ftp"));
371 ui.protocolCombo->addItem("MMS", QVariant("mms"));
372 ui.protocolCombo->addItem("RTSP", QVariant("rtsp"));
373 ui.protocolCombo->addItem("UDP/RTP (unicast)", QVariant("udp"));
374 ui.protocolCombo->addItem("UDP/RTP (multicast)", QVariant("udp"));
377 NetOpenPanel::~NetOpenPanel()
380 void NetOpenPanel::clear()
383 void NetOpenPanel::updateProtocol( int idx ) {
384 QString addr = ui.addressText->text();
385 QString proto = ui.protocolCombo->itemData( idx ).toString();
387 ui.timeShift->setEnabled( idx >= 4 );
388 ui.ipv6->setEnabled( idx == 4 );
389 ui.addressText->setEnabled( idx != 4 );
390 ui.portSpin->setEnabled( idx >= 4 );
392 /* If we already have a protocol in the address, replace it */
393 if( addr.contains( "://")) {
394 msg_Err( p_intf, "replace");
395 addr.replace( QRegExp("^.*://"), proto + "://");
396 ui.addressText->setText( addr );
401 void NetOpenPanel::updateAddress() {
405 void NetOpenPanel::updateMRL() {
407 QString addr = ui.addressText->text();
408 int proto = ui.protocolCombo->currentIndex();
410 if( addr.contains( "://") && proto != 4 ) {
416 mrl = "http://" + addr;
417 emit methodChanged("http-caching");
420 mrl = "mms://" + addr;
421 emit methodChanged("mms-caching");
424 mrl = "ftp://" + addr;
425 emit methodChanged("ftp-caching");
428 mrl = "rtsp://" + addr;
429 emit methodChanged("rtsp-caching");
433 if( ui.ipv6->isEnabled() && ui.ipv6->isChecked() ) {
436 mrl += QString(":%1").arg( ui.portSpin->value() );
437 emit methodChanged("udp-caching");
439 case 6: /* UDP multicast */
442 if ( addr.contains(':') && !addr.contains('[') ) {
443 mrl += "[" + addr + "]";
445 mrl += QString(":%1").arg( ui.portSpin->value() );
446 emit methodChanged("udp-caching");
449 if( ui.timeShift->isEnabled() && ui.timeShift->isChecked() ) {
450 mrl += " :access-filter=timeshift";
452 emit mrlUpdated( mrl );
455 /**************************************************************************
456 * Open Capture device ( DVB, PVR, V4L, and similar ) *
457 **************************************************************************/
458 CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
459 OpenPanel( _parent, _p_intf )
463 /* Create two stacked layouts in the main comboBoxes */
464 QStackedLayout *stackedDevLayout = new QStackedLayout;
465 ui.cardBox->setLayout( stackedDevLayout );
467 QStackedLayout *stackedPropLayout = new QStackedLayout;
468 ui.optionsBox->setLayout( stackedPropLayout );
470 /* Creation and connections of the WIdgets in the stacked layout */
471 #define addModuleAndLayouts( number, name, label ) \
472 QWidget * name ## DevPage = new QWidget( this ); \
473 QWidget * name ## PropPage = new QWidget( this ); \
474 stackedDevLayout->addWidget( name ## DevPage ); \
475 stackedPropLayout->addWidget( name ## PropPage ); \
476 QGridLayout * name ## DevLayout = new QGridLayout; \
477 QGridLayout * name ## PropLayout = new QGridLayout; \
478 name ## DevPage->setLayout( name ## DevLayout ); \
479 name ## PropPage->setLayout( name ## PropLayout ); \
480 ui.deviceCombo->addItem( qtr( label ), QVariant( number ) );
482 #define CuMRL( widget, slot ) CONNECT( widget , slot , this, updateMRL() );
484 #define setMaxBound( spinbox ) spinbox->setRange ( 0, INT_MAX );
489 addModuleAndLayouts( V4L_DEVICE, v4l, "Video for Linux" );
492 QLabel *v4lVideoDeviceLabel = new QLabel( qtr( "Video device name" ) );
493 v4lDevLayout->addWidget( v4lVideoDeviceLabel, 0, 0 );
495 v4lVideoDevice = new QLineEdit;
496 v4lDevLayout->addWidget( v4lVideoDevice, 0, 1 );
498 QLabel *v4lAudioDeviceLabel = new QLabel( qtr( "Audio device name" ) );
499 v4lDevLayout->addWidget( v4lAudioDeviceLabel, 1, 0 );
501 v4lAudioDevice = new QLineEdit;
502 v4lDevLayout->addWidget( v4lAudioDevice, 1, 1 );
504 /* V4l Props panel */
505 v4lNormBox = new QComboBox;
506 setfillVLCConfigCombo( "v4l-norm", p_intf, v4lNormBox );
507 v4lPropLayout->addWidget( v4lNormBox, 0 , 1 );
509 v4lFreq = new QSpinBox;
510 v4lFreq->setAlignment( Qt::AlignRight );
511 v4lFreq->setSuffix(" kHz");
512 v4lPropLayout->addWidget( v4lFreq, 1 , 1 );
514 QLabel *v4lNormLabel = new QLabel( qtr( "Norm" ) );
515 v4lPropLayout->addWidget( v4lNormLabel, 0 , 0 );
517 QLabel *v4lFreqLabel = new QLabel( qtr( "Frequency" ) );
518 v4lPropLayout->addWidget( v4lFreqLabel, 1 , 0 );
521 CuMRL( v4lVideoDevice, textChanged( QString ) );
522 CuMRL( v4lAudioDevice, textChanged( QString ) );
523 CuMRL( v4lFreq, valueChanged ( int ) );
524 CuMRL( v4lNormBox, currentIndexChanged ( int ) );
529 addModuleAndLayouts( PVR_DEVICE, pvr, "PVR" );
532 QLabel *pvrDeviceLabel = new QLabel( qtr( "Device name" ) );
533 pvrDevLayout->addWidget( pvrDeviceLabel, 0, 0 );
535 pvrDevice = new QLineEdit;
536 pvrDevLayout->addWidget( pvrDevice, 0, 1 );
538 QLabel *pvrRadioDeviceLabel = new QLabel( qtr( "Radio device name" ) );
539 pvrDevLayout->addWidget( pvrRadioDeviceLabel, 1, 0 );
541 pvrRadioDevice = new QLineEdit;
542 pvrDevLayout->addWidget( pvrRadioDevice, 1, 1 );
544 /* PVR props panel */
545 pvrNormBox = new QComboBox;
546 setfillVLCConfigCombo( "pvr-norm", p_intf, pvrNormBox );
547 pvrPropLayout->addWidget( pvrNormBox, 0, 1 );
549 QLabel *pvrNormLabel = new QLabel( qtr( "Norm" ) );
550 pvrPropLayout->addWidget( pvrNormLabel, 0, 0 );
552 pvrFreq = new QSpinBox;
553 pvrFreq->setAlignment( Qt::AlignRight );
554 pvrFreq->setSuffix(" kHz");
555 setMaxBound( pvrFreq );
556 pvrPropLayout->addWidget( pvrFreq, 1, 1 );
558 pvrBitr = new QSpinBox;
559 pvrBitr->setAlignment( Qt::AlignRight );
560 pvrBitr->setSuffix(" kHz");
561 setMaxBound( pvrBitr );
562 pvrPropLayout->addWidget( pvrBitr, 2, 1 );
564 QLabel *pvrFreqLabel = new QLabel( qtr( "Frequency" ) );
565 pvrPropLayout->addWidget( pvrFreqLabel, 1, 0 );
567 QLabel *pvrBitrLabel = new QLabel( qtr( "Bitrate" ) );
568 pvrPropLayout->addWidget( pvrBitrLabel, 2, 0 );
571 CuMRL( pvrDevice, textChanged( QString ) );
572 CuMRL( pvrRadioDevice, textChanged( QString ) );
574 CuMRL( pvrFreq, valueChanged ( int ) );
575 CuMRL( pvrBitr, valueChanged ( int ) );
576 CuMRL( pvrNormBox, currentIndexChanged ( int ) );
578 /*********************
579 * DirectShow Stuffs *
580 *********************/
581 addModuleAndLayouts( DSHOW_DEVICE, dshow, "DirectShow" );
586 addModuleAndLayouts( BDA_DEVICE, bda, "DVB DirectShow" );
589 QLabel *bdaTypeLabel = new QLabel( qtr( "DVB Type:" ) );
591 bdas = new QRadioButton( "DVB-S" );
592 bdas->setChecked( true );
593 bdac = new QRadioButton( "DVB-C" );
594 bdat = new QRadioButton( "DVB-T" );
596 bdaDevLayout->addWidget( bdaTypeLabel, 1, 0 );
597 bdaDevLayout->addWidget( bdas, 1, 1 );
598 bdaDevLayout->addWidget( bdac, 1, 2 );
599 bdaDevLayout->addWidget( bdat, 1, 3 );
602 QLabel *bdaFreqLabel =
603 new QLabel( qtr( "Transponder/multiplex frequency" ) );
604 bdaPropLayout->addWidget( bdaFreqLabel, 0, 0 );
606 bdaFreq = new QSpinBox;
607 bdaFreq->setAlignment( Qt::AlignRight );
608 bdaFreq->setSuffix(" kHz");
609 bdaFreq->setSingleStep( 1000 );
610 setMaxBound( bdaFreq )
611 bdaPropLayout->addWidget( bdaFreq, 0, 1 );
613 bdaSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
614 bdaPropLayout->addWidget( bdaSrateLabel, 1, 0 );
616 bdaSrate = new QSpinBox;
617 bdaSrate->setAlignment( Qt::AlignRight );
618 bdaSrate->setSuffix(" kHz");
619 setMaxBound( bdaSrate );
620 bdaPropLayout->addWidget( bdaSrate, 1, 1 );
622 bdaBandLabel = new QLabel( qtr( "Bandwidth" ) );
623 bdaPropLayout->addWidget( bdaBandLabel, 2, 0 );
625 bdaBandBox = new QComboBox;
626 setfillVLCConfigCombo( "dvb-bandwidth", p_intf, bdaBandBox );
627 bdaPropLayout->addWidget( bdaBandBox, 2, 1 );
629 bdaBandLabel->hide();
633 CuMRL( bdaFreq, valueChanged ( int ) );
634 CuMRL( bdaSrate, valueChanged ( int ) );
635 CuMRL( bdaBandBox, currentIndexChanged ( int ) );
636 BUTTONACT( bdas, updateButtons() );
637 BUTTONACT( bdat, updateButtons() );
638 BUTTONACT( bdac, updateButtons() );
639 BUTTONACT( bdas, updateMRL() );
640 BUTTONACT( bdat, updateMRL() );
641 BUTTONACT( bdac, updateMRL() );
646 addModuleAndLayouts( DVB_DEVICE, dvb, "DVB" );
649 QLabel *dvbDeviceLabel = new QLabel( qtr( "Adapter card to tune" ) );
650 QLabel *dvbTypeLabel = new QLabel( qtr( "DVB Type:" ) );
652 dvbCard = new QSpinBox;
653 dvbCard->setAlignment( Qt::AlignRight );
654 dvbCard->setPrefix( "/dev/dvb/adapter" );
656 dvbDevLayout->addWidget( dvbDeviceLabel, 0, 0 );
657 dvbDevLayout->addWidget( dvbCard, 0, 2, 1, 2 );
659 dvbs = new QRadioButton( "DVB-S" );
660 dvbs->setChecked( true );
661 dvbc = new QRadioButton( "DVB-C" );
662 dvbt = new QRadioButton( "DVB-T" );
664 dvbDevLayout->addWidget( dvbTypeLabel, 1, 0 );
665 dvbDevLayout->addWidget( dvbs, 1, 1 );
666 dvbDevLayout->addWidget( dvbc, 1, 2 );
667 dvbDevLayout->addWidget( dvbt, 1, 3 );
669 /* DVB Props panel */
670 QLabel *dvbFreqLabel =
671 new QLabel( qtr( "Transponder/multiplex frequency" ) );
672 dvbPropLayout->addWidget( dvbFreqLabel, 0, 0 );
674 dvbFreq = new QSpinBox;
675 dvbFreq->setAlignment( Qt::AlignRight );
676 dvbFreq->setSuffix(" kHz");
677 setMaxBound( dvbFreq );
678 dvbPropLayout->addWidget( dvbFreq, 0, 1 );
680 QLabel *dvbSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
681 dvbPropLayout->addWidget( dvbSrateLabel, 1, 0 );
683 dvbSrate = new QSpinBox;
684 dvbSrate->setAlignment( Qt::AlignRight );
685 dvbSrate->setSuffix(" kHz");
686 setMaxBound( dvbSrate );
687 dvbPropLayout->addWidget( dvbSrate, 1, 1 );
690 CuMRL( dvbCard, valueChanged ( int ) );
691 CuMRL( dvbFreq, valueChanged ( int ) );
692 CuMRL( dvbSrate, valueChanged ( int ) );
694 BUTTONACT( dvbs, updateButtons() );
695 BUTTONACT( dvbt, updateButtons() );
696 BUTTONACT( dvbc, updateButtons() );
698 /* General connects */
699 connect( ui.deviceCombo, SIGNAL( activated( int ) ),
700 stackedDevLayout, SLOT( setCurrentIndex( int ) ) );
701 connect( ui.deviceCombo, SIGNAL( activated( int ) ),
702 stackedPropLayout, SLOT( setCurrentIndex( int ) ) );
703 CONNECT( ui.deviceCombo, activated( int ), this, updateMRL() );
708 CaptureOpenPanel::~CaptureOpenPanel()
711 void CaptureOpenPanel::clear()
714 void CaptureOpenPanel::updateMRL()
717 int i_devicetype = ui.deviceCombo->itemData(
718 ui.deviceCombo->currentIndex() ).toInt();
719 msg_Dbg( p_intf, "Capture Type: %i", i_devicetype );
720 switch( i_devicetype )
724 mrl += " :v4l-vdev=" + v4lVideoDevice->text();
725 mrl += " :v4l-adev=" + v4lAudioDevice->text();
726 mrl += " :v4l-norm=" + QString("%1").arg( v4lNormBox->currentIndex() );
727 mrl += " :v4l-frequency=" + QString("%1").arg( v4lFreq->value() );
731 mrl += " :pvr-device=" + pvrDevice->text();
732 mrl += " :pvr-radio-device=" + pvrRadioDevice->text();
733 mrl += " :pvr-norm=" + QString("%1").arg( pvrNormBox->currentIndex() );
734 if( pvrFreq->value() )
735 mrl += " :pvr-frequency=" + QString("%1").arg( pvrFreq->value() );
736 if( pvrBitr->value() )
737 mrl += " :pvr-bitrate=" + QString("%1").arg( pvrBitr->value() );
741 mrl += " :dvb-adapter=" + QString("%1").arg( dvbCard->value() );
742 mrl += " :dvb-frequency=" + QString("%1").arg( dvbFreq->value() );
743 mrl += " :dvb-srate=" + QString("%1").arg( dvbSrate->value() );
746 if( bdas->isChecked() ) mrl = "dvb-s://";
747 else if( bdat->isChecked() ) mrl = "dvb-t://";
748 else if( bdac->isChecked() ) mrl = "dvb-c://";
750 mrl += " :dvb-frequency=" + QString("%1").arg( bdaFreq->value() );
751 if( bdas->isChecked() || bdac->isChecked() )
752 mrl += " :dvb-srate=" + QString("%1").arg( bdaSrate->value() );
754 mrl += " :dvb-bandwidth=" +
755 QString("%1").arg( bdaBandBox->itemData(
756 bdaBandBox->currentIndex() ).toInt() );
761 emit mrlUpdated( mrl );
764 void CaptureOpenPanel::updateButtons()
766 int i_devicetype = ui.deviceCombo->itemData(
767 ui.deviceCombo->currentIndex() ).toInt();
768 msg_Dbg( p_intf, "Capture Type: %i", i_devicetype );
769 switch( i_devicetype )
772 if( dvbs->isChecked() ) dvbFreq->setSuffix(" kHz");
773 if( dvbc->isChecked() || dvbt->isChecked() ) dvbFreq->setSuffix(" Hz");
776 if( bdas->isChecked() || bdac->isChecked() )
779 bdaSrateLabel->show();
781 bdaBandLabel->hide();
786 bdaSrateLabel->hide();
788 bdaBandLabel->show();