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,
137 CONNECT( lineFileEdit, textChanged( QString ), this, browseFile() );
140 FileOpenPanel::~FileOpenPanel()
143 QStringList FileOpenPanel::browse( QString help )
145 return THEDP->showSimpleOpen( help );
149 /* Unused. FIXME ? */
150 void FileOpenPanel::browseFile()
152 QString fileString = "";
153 foreach( QString file, dialogBox->selectedFiles() ) {
154 fileString += "\"" + file + "\" ";
156 ui.fileInput->setEditText( fileString );
161 void FileOpenPanel::browseFileSub()
163 // FIXME Handle selection of more than one subtitles file
164 QStringList files = THEDP->showSimpleOpen( qtr("Open subtitles file"),
166 dialogBox->directory().absolutePath() );
167 if( files.isEmpty() ) return;
168 ui.subInput->setEditText( files.join(" ") );
172 void FileOpenPanel::updateMRL()
174 QString mrl = ui.fileInput->currentText();
176 if( ui.subCheckBox->isChecked() ) {
177 mrl.append( " :sub-file=" + ui.subInput->currentText() );
178 int align = ui.alignSubComboBox->itemData(
179 ui.alignSubComboBox->currentIndex() ).toInt();
180 mrl.append( " :subsdec-align=" + QString().setNum( align ) );
181 int size = ui.sizeSubComboBox->itemData(
182 ui.sizeSubComboBox->currentIndex() ).toInt();
183 mrl.append( " :freetype-rel-fontsize=" + QString().setNum( size ) );
186 const char *psz_filepath = config_GetPsz( p_intf, "qt-filedialog-path" );
187 if( ( NULL == psz_filepath )
188 || strcmp( psz_filepath, qtu( dialogBox->directory().absolutePath() )) )
190 /* set dialog box current directory as last known path */
191 config_PutPsz( p_intf, "qt-filedialog-path",
192 qtu( dialogBox->directory().absolutePath() ) );
196 emit mrlUpdated( mrl );
197 emit methodChanged( "file-caching" );
201 /* Function called by Open Dialog when clicke on Play/Enqueue */
202 void FileOpenPanel::accept()
204 ui.fileInput->addItem( ui.fileInput->currentText());
205 if ( ui.fileInput->count() > 8 ) ui.fileInput->removeItem( 0 );
208 void FileOpenBox::accept()
210 OpenDialog::getInstance( NULL, NULL )->play();
213 /* Function called by Open Dialog when clicked on cancel */
214 void FileOpenPanel::clear()
216 ui.fileInput->setEditText( "" );
217 ui.subInput->setEditText( "" );
220 void FileOpenPanel::toggleSubtitleFrame()
222 if ( ui.subFrame->isVisible() )
237 /**************************************************************************
238 * Open Discs ( DVD, CD, VCD and similar devices ) *
239 **************************************************************************/
240 DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
241 OpenPanel( _parent, _p_intf )
245 /*Win 32 Probe as in WX ? */
248 BUTTONACT( ui.dvdRadioButton, updateButtons());
249 BUTTONACT( ui.vcdRadioButton, updateButtons());
250 BUTTONACT( ui.audioCDRadioButton, updateButtons());
251 BUTTONACT( ui.dvdsimple, updateButtons());
253 CONNECT( ui.deviceCombo, editTextChanged( QString ), this, updateMRL());
254 CONNECT( ui.titleSpin, valueChanged( int ), this, updateMRL());
255 CONNECT( ui.chapterSpin, valueChanged( int ), this, updateMRL());
256 CONNECT( ui.audioSpin, valueChanged( int ), this, updateMRL());
257 CONNECT( ui.subtitlesSpin, valueChanged( int ), this, updateMRL());
260 DiscOpenPanel::~DiscOpenPanel()
263 void DiscOpenPanel::clear()
265 ui.titleSpin->setValue( 0 );
266 ui.chapterSpin->setValue( 0 );
269 void DiscOpenPanel::updateButtons()
271 if ( ui.dvdRadioButton->isChecked() )
273 ui.titleLabel->setText( qtr("Title") );
274 ui.chapterLabel->show();
275 ui.chapterSpin->show();
276 ui.diskOptionBox_2->show();
278 else if ( ui.vcdRadioButton->isChecked() )
280 ui.titleLabel->setText( qtr("Entry") );
281 ui.chapterLabel->hide();
282 ui.chapterSpin->hide();
283 ui.diskOptionBox_2->show();
287 ui.titleLabel->setText( qtr("Track") );
288 ui.chapterLabel->hide();
289 ui.chapterSpin->hide();
290 ui.diskOptionBox_2->hide();
297 void DiscOpenPanel::updateMRL()
301 /* CDDAX and VCDX not implemented. FIXME ? */
303 if( ui.dvdRadioButton->isChecked() ) {
304 if( !ui.dvdsimple->isChecked() )
307 mrl = "dvdsimple://";
308 mrl += ui.deviceCombo->currentText();
309 emit methodChanged( "dvdnav-caching" );
311 if ( ui.titleSpin->value() > 0 ) {
312 mrl += QString("@%1").arg( ui.titleSpin->value() );
313 if ( ui.chapterSpin->value() > 0 ) {
314 mrl+= QString(":%1").arg( ui.chapterSpin->value() );
319 } else if ( ui.vcdRadioButton->isChecked() ) {
320 mrl = "vcd://" + ui.deviceCombo->currentText();
321 emit methodChanged( "vcd-caching" );
323 if( ui.titleSpin->value() > 0 ) {
324 mrl += QString("@E%1").arg( ui.titleSpin->value() );
329 mrl = "cdda://" + ui.deviceCombo->currentText();
330 if( ui.titleSpin->value() > 0 ) {
331 QString("@%1").arg( ui.titleSpin->value() );
335 if ( ui.dvdRadioButton->isChecked() || ui.vcdRadioButton->isChecked() )
337 if ( ui.audioSpin->value() >= 0 ) {
338 mrl += " :audio-track=" +
339 QString("%1").arg( ui.audioSpin->value() );
341 if ( ui.subtitlesSpin->value() >= 0 ) {
342 mrl += " :sub-track=" +
343 QString("%1").arg( ui.subtitlesSpin->value() );
346 emit mrlUpdated( mrl );
351 /**************************************************************************
352 * Open Network streams and URL pages *
353 **************************************************************************/
354 NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
355 OpenPanel( _parent, _p_intf )
360 CONNECT( ui.protocolCombo, currentIndexChanged( int ),
361 this, updateProtocol( int ) );
362 CONNECT( ui.portSpin, valueChanged( int ), this, updateMRL() );
363 CONNECT( ui.addressText, textChanged( QString ), this, updateAddress());
364 CONNECT( ui.timeShift, clicked(), this, updateMRL());
365 CONNECT( ui.ipv6, clicked(), this, updateMRL());
367 ui.protocolCombo->addItem("HTTP", QVariant("http"));
368 ui.protocolCombo->addItem("HTTPS", QVariant("https"));
369 ui.protocolCombo->addItem("FTP", QVariant("ftp"));
370 ui.protocolCombo->addItem("MMS", QVariant("mms"));
371 ui.protocolCombo->addItem("RTSP", QVariant("rtsp"));
372 ui.protocolCombo->addItem("UDP/RTP (unicast)", QVariant("udp"));
373 ui.protocolCombo->addItem("UDP/RTP (multicast)", QVariant("udp"));
376 NetOpenPanel::~NetOpenPanel()
379 void NetOpenPanel::clear()
382 void NetOpenPanel::updateProtocol( int idx ) {
383 QString addr = ui.addressText->text();
384 QString proto = ui.protocolCombo->itemData( idx ).toString();
386 ui.timeShift->setEnabled( idx >= 4 );
387 ui.ipv6->setEnabled( idx == 4 );
388 ui.addressText->setEnabled( idx != 4 );
389 ui.portSpin->setEnabled( idx >= 4 );
391 /* If we already have a protocol in the address, replace it */
392 if( addr.contains( "://")) {
393 msg_Err( p_intf, "replace");
394 addr.replace( QRegExp("^.*://"), proto + "://");
395 ui.addressText->setText( addr );
400 void NetOpenPanel::updateAddress() {
404 void NetOpenPanel::updateMRL() {
406 QString addr = ui.addressText->text();
407 int proto = ui.protocolCombo->currentIndex();
409 if( addr.contains( "://") && proto != 4 ) {
415 mrl = "http://" + addr;
416 emit methodChanged("http-caching");
419 mrl = "mms://" + addr;
420 emit methodChanged("mms-caching");
423 mrl = "ftp://" + addr;
424 emit methodChanged("ftp-caching");
427 mrl = "rtsp://" + addr;
428 emit methodChanged("rtsp-caching");
432 if( ui.ipv6->isEnabled() && ui.ipv6->isChecked() ) {
435 mrl += QString(":%1").arg( ui.portSpin->value() );
436 emit methodChanged("udp-caching");
438 case 6: /* UDP multicast */
441 if ( addr.contains(':') && !addr.contains('[') ) {
442 mrl += "[" + addr + "]";
444 mrl += QString(":%1").arg( ui.portSpin->value() );
445 emit methodChanged("udp-caching");
448 if( ui.timeShift->isEnabled() && ui.timeShift->isChecked() ) {
449 mrl += " :access-filter=timeshift";
451 emit mrlUpdated( mrl );
454 /**************************************************************************
455 * Open Capture device ( DVB, PVR, V4L, and similar ) *
456 **************************************************************************/
457 CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
458 OpenPanel( _parent, _p_intf )
462 /* Create two stacked layouts in the main comboBoxes */
463 QStackedLayout *stackedDevLayout = new QStackedLayout;
464 ui.cardBox->setLayout( stackedDevLayout );
466 QStackedLayout *stackedPropLayout = new QStackedLayout;
467 ui.optionsBox->setLayout( stackedPropLayout );
469 /* Creation and connections of the WIdgets in the stacked layout */
470 #define addModuleAndLayouts( number, name, label ) \
471 QWidget * name ## DevPage = new QWidget( this ); \
472 QWidget * name ## PropPage = new QWidget( this ); \
473 stackedDevLayout->addWidget( name ## DevPage ); \
474 stackedPropLayout->addWidget( name ## PropPage ); \
475 QGridLayout * name ## DevLayout = new QGridLayout; \
476 QGridLayout * name ## PropLayout = new QGridLayout; \
477 name ## DevPage->setLayout( name ## DevLayout ); \
478 name ## PropPage->setLayout( name ## PropLayout ); \
479 ui.deviceCombo->addItem( qtr( label ), QVariant( number ) );
481 #define CuMRL( widget, slot ) CONNECT( widget , slot , this, updateMRL() );
483 #define setMaxBound( spinbox ) spinbox->setRange ( 0, INT_MAX );
488 addModuleAndLayouts( V4L_DEVICE, v4l, "Video for Linux" );
491 QLabel *v4lVideoDeviceLabel = new QLabel( qtr( "Video device name" ) );
492 v4lDevLayout->addWidget( v4lVideoDeviceLabel, 0, 0 );
494 v4lVideoDevice = new QLineEdit;
495 v4lDevLayout->addWidget( v4lVideoDevice, 0, 1 );
497 QLabel *v4lAudioDeviceLabel = new QLabel( qtr( "Audio device name" ) );
498 v4lDevLayout->addWidget( v4lAudioDeviceLabel, 1, 0 );
500 v4lAudioDevice = new QLineEdit;
501 v4lDevLayout->addWidget( v4lAudioDevice, 1, 1 );
503 /* V4l Props panel */
504 v4lNormBox = new QComboBox;
505 setfillVLCConfigCombo( "v4l-norm", p_intf, v4lNormBox );
506 v4lPropLayout->addWidget( v4lNormBox, 0 , 1 );
508 v4lFreq = new QSpinBox;
509 v4lFreq->setAlignment( Qt::AlignRight );
510 v4lFreq->setSuffix(" kHz");
511 v4lPropLayout->addWidget( v4lFreq, 1 , 1 );
513 QLabel *v4lNormLabel = new QLabel( qtr( "Norm" ) );
514 v4lPropLayout->addWidget( v4lNormLabel, 0 , 0 );
516 QLabel *v4lFreqLabel = new QLabel( qtr( "Frequency" ) );
517 v4lPropLayout->addWidget( v4lFreqLabel, 1 , 0 );
520 CuMRL( v4lVideoDevice, textChanged( QString ) );
521 CuMRL( v4lAudioDevice, textChanged( QString ) );
522 CuMRL( v4lFreq, valueChanged ( int ) );
523 CuMRL( v4lNormBox, currentIndexChanged ( int ) );
528 addModuleAndLayouts( PVR_DEVICE, pvr, "PVR" );
531 QLabel *pvrDeviceLabel = new QLabel( qtr( "Device name" ) );
532 pvrDevLayout->addWidget( pvrDeviceLabel, 0, 0 );
534 pvrDevice = new QLineEdit;
535 pvrDevLayout->addWidget( pvrDevice, 0, 1 );
537 QLabel *pvrRadioDeviceLabel = new QLabel( qtr( "Radio device name" ) );
538 pvrDevLayout->addWidget( pvrRadioDeviceLabel, 1, 0 );
540 pvrRadioDevice = new QLineEdit;
541 pvrDevLayout->addWidget( pvrRadioDevice, 1, 1 );
543 /* PVR props panel */
544 pvrNormBox = new QComboBox;
545 setfillVLCConfigCombo( "pvr-norm", p_intf, pvrNormBox );
546 pvrPropLayout->addWidget( pvrNormBox, 0, 1 );
548 QLabel *pvrNormLabel = new QLabel( qtr( "Norm" ) );
549 pvrPropLayout->addWidget( pvrNormLabel, 0, 0 );
551 pvrFreq = new QSpinBox;
552 pvrFreq->setAlignment( Qt::AlignRight );
553 pvrFreq->setSuffix(" kHz");
554 setMaxBound( pvrFreq );
555 pvrPropLayout->addWidget( pvrFreq, 1, 1 );
557 pvrBitr = new QSpinBox;
558 pvrBitr->setAlignment( Qt::AlignRight );
559 pvrBitr->setSuffix(" kHz");
560 setMaxBound( pvrBitr );
561 pvrPropLayout->addWidget( pvrBitr, 2, 1 );
563 QLabel *pvrFreqLabel = new QLabel( qtr( "Frequency" ) );
564 pvrPropLayout->addWidget( pvrFreqLabel, 1, 0 );
566 QLabel *pvrBitrLabel = new QLabel( qtr( "Bitrate" ) );
567 pvrPropLayout->addWidget( pvrBitrLabel, 2, 0 );
570 CuMRL( pvrDevice, textChanged( QString ) );
571 CuMRL( pvrRadioDevice, textChanged( QString ) );
573 CuMRL( pvrFreq, valueChanged ( int ) );
574 CuMRL( pvrBitr, valueChanged ( int ) );
575 CuMRL( pvrNormBox, currentIndexChanged ( int ) );
577 /*********************
578 * DirectShow Stuffs *
579 *********************/
580 addModuleAndLayouts( DSHOW_DEVICE, dshow, "DirectShow" );
585 addModuleAndLayouts( BDA_DEVICE, bda, "DVB DirectShow" );
588 QLabel *bdaTypeLabel = new QLabel( qtr( "DVB Type:" ) );
590 bdas = new QRadioButton( "DVB-S" );
591 bdas->setChecked( true );
592 bdac = new QRadioButton( "DVB-C" );
593 bdat = new QRadioButton( "DVB-T" );
595 bdaDevLayout->addWidget( bdaTypeLabel, 1, 0 );
596 bdaDevLayout->addWidget( bdas, 1, 1 );
597 bdaDevLayout->addWidget( bdac, 1, 2 );
598 bdaDevLayout->addWidget( bdat, 1, 3 );
601 QLabel *bdaFreqLabel =
602 new QLabel( qtr( "Transponder/multiplex frequency" ) );
603 bdaPropLayout->addWidget( bdaFreqLabel, 0, 0 );
605 bdaFreq = new QSpinBox;
606 bdaFreq->setAlignment( Qt::AlignRight );
607 bdaFreq->setSuffix(" kHz");
608 bdaFreq->setSingleStep( 1000 );
609 setMaxBound( bdaFreq )
610 bdaPropLayout->addWidget( bdaFreq, 0, 1 );
612 bdaSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
613 bdaPropLayout->addWidget( bdaSrateLabel, 1, 0 );
615 bdaSrate = new QSpinBox;
616 bdaSrate->setAlignment( Qt::AlignRight );
617 bdaSrate->setSuffix(" kHz");
618 setMaxBound( bdaSrate );
619 bdaPropLayout->addWidget( bdaSrate, 1, 1 );
621 bdaBandLabel = new QLabel( qtr( "Bandwidth" ) );
622 bdaPropLayout->addWidget( bdaBandLabel, 2, 0 );
624 bdaBandBox = new QComboBox;
625 setfillVLCConfigCombo( "dvb-bandwidth", p_intf, bdaBandBox );
626 bdaPropLayout->addWidget( bdaBandBox, 2, 1 );
628 bdaBandLabel->hide();
632 CuMRL( bdaFreq, valueChanged ( int ) );
633 CuMRL( bdaSrate, valueChanged ( int ) );
634 CuMRL( bdaBandBox, currentIndexChanged ( int ) );
635 BUTTONACT( bdas, updateButtons() );
636 BUTTONACT( bdat, updateButtons() );
637 BUTTONACT( bdac, updateButtons() );
638 BUTTONACT( bdas, updateMRL() );
639 BUTTONACT( bdat, updateMRL() );
640 BUTTONACT( bdac, updateMRL() );
645 addModuleAndLayouts( DVB_DEVICE, dvb, "DVB" );
648 QLabel *dvbDeviceLabel = new QLabel( qtr( "Adapter card to tune" ) );
649 QLabel *dvbTypeLabel = new QLabel( qtr( "DVB Type:" ) );
651 dvbCard = new QSpinBox;
652 dvbCard->setAlignment( Qt::AlignRight );
653 dvbCard->setPrefix( "/dev/dvb/adapter" );
655 dvbDevLayout->addWidget( dvbDeviceLabel, 0, 0 );
656 dvbDevLayout->addWidget( dvbCard, 0, 2, 1, 2 );
658 dvbs = new QRadioButton( "DVB-S" );
659 dvbs->setChecked( true );
660 dvbc = new QRadioButton( "DVB-C" );
661 dvbt = new QRadioButton( "DVB-T" );
663 dvbDevLayout->addWidget( dvbTypeLabel, 1, 0 );
664 dvbDevLayout->addWidget( dvbs, 1, 1 );
665 dvbDevLayout->addWidget( dvbc, 1, 2 );
666 dvbDevLayout->addWidget( dvbt, 1, 3 );
668 /* DVB Props panel */
669 QLabel *dvbFreqLabel =
670 new QLabel( qtr( "Transponder/multiplex frequency" ) );
671 dvbPropLayout->addWidget( dvbFreqLabel, 0, 0 );
673 dvbFreq = new QSpinBox;
674 dvbFreq->setAlignment( Qt::AlignRight );
675 dvbFreq->setSuffix(" kHz");
676 setMaxBound( dvbFreq );
677 dvbPropLayout->addWidget( dvbFreq, 0, 1 );
679 QLabel *dvbSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
680 dvbPropLayout->addWidget( dvbSrateLabel, 1, 0 );
682 dvbSrate = new QSpinBox;
683 dvbSrate->setAlignment( Qt::AlignRight );
684 dvbSrate->setSuffix(" kHz");
685 setMaxBound( dvbSrate );
686 dvbPropLayout->addWidget( dvbSrate, 1, 1 );
689 CuMRL( dvbCard, valueChanged ( int ) );
690 CuMRL( dvbFreq, valueChanged ( int ) );
691 CuMRL( dvbSrate, valueChanged ( int ) );
693 BUTTONACT( dvbs, updateButtons() );
694 BUTTONACT( dvbt, updateButtons() );
695 BUTTONACT( dvbc, updateButtons() );
697 /* General connects */
698 connect( ui.deviceCombo, SIGNAL( activated( int ) ),
699 stackedDevLayout, SLOT( setCurrentIndex( int ) ) );
700 connect( ui.deviceCombo, SIGNAL( activated( int ) ),
701 stackedPropLayout, SLOT( setCurrentIndex( int ) ) );
702 CONNECT( ui.deviceCombo, activated( int ), this, updateMRL() );
707 CaptureOpenPanel::~CaptureOpenPanel()
710 void CaptureOpenPanel::clear()
713 void CaptureOpenPanel::updateMRL()
716 int i_devicetype = ui.deviceCombo->itemData(
717 ui.deviceCombo->currentIndex() ).toInt();
718 msg_Dbg( p_intf, "Capture Type: %i", i_devicetype );
719 switch( i_devicetype )
723 mrl += " :v4l-vdev=" + v4lVideoDevice->text();
724 mrl += " :v4l-adev=" + v4lAudioDevice->text();
725 mrl += " :v4l-norm=" + QString("%1").arg( v4lNormBox->currentIndex() );
726 mrl += " :v4l-frequency=" + QString("%1").arg( v4lFreq->value() );
730 mrl += " :pvr-device=" + pvrDevice->text();
731 mrl += " :pvr-radio-device=" + pvrRadioDevice->text();
732 mrl += " :pvr-norm=" + QString("%1").arg( pvrNormBox->currentIndex() );
733 if( pvrFreq->value() )
734 mrl += " :pvr-frequency=" + QString("%1").arg( pvrFreq->value() );
735 if( pvrBitr->value() )
736 mrl += " :pvr-bitrate=" + QString("%1").arg( pvrBitr->value() );
740 mrl += " :dvb-adapter=" + QString("%1").arg( dvbCard->value() );
741 mrl += " :dvb-frequency=" + QString("%1").arg( dvbFreq->value() );
742 mrl += " :dvb-srate=" + QString("%1").arg( dvbSrate->value() );
745 if( bdas->isChecked() ) mrl = "dvb-s://";
746 else if( bdat->isChecked() ) mrl = "dvb-t://";
747 else if( bdac->isChecked() ) mrl = "dvb-c://";
749 mrl += " :dvb-frequency=" + QString("%1").arg( bdaFreq->value() );
750 if( bdas->isChecked() || bdac->isChecked() )
751 mrl += " :dvb-srate=" + QString("%1").arg( bdaSrate->value() );
753 mrl += " :dvb-bandwidth=" +
754 QString("%1").arg( bdaBandBox->itemData(
755 bdaBandBox->currentIndex() ).toInt() );
760 emit mrlUpdated( mrl );
763 void CaptureOpenPanel::updateButtons()
765 int i_devicetype = ui.deviceCombo->itemData(
766 ui.deviceCombo->currentIndex() ).toInt();
767 msg_Dbg( p_intf, "Capture Type: %i", i_devicetype );
768 switch( i_devicetype )
771 if( dvbs->isChecked() ) dvbFreq->setSuffix(" kHz");
772 if( dvbc->isChecked() || dvbt->isChecked() ) dvbFreq->setSuffix(" Hz");
775 if( bdas->isChecked() || bdac->isChecked() )
778 bdaSrateLabel->show();
780 bdaBandLabel->hide();
785 bdaSrateLabel->hide();
787 bdaBandLabel->show();