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 );
148 /* Unused. FIXME ? */
149 void FileOpenPanel::browseFile()
151 QString fileString = "";
152 foreach( QString file, dialogBox->selectedFiles() ) {
153 fileString += "\"" + file + "\" ";
155 ui.fileInput->setEditText( fileString );
159 void FileOpenPanel::browseFileSub()
161 // FIXME Handle selection of more than one subtitles file
162 QStringList files = THEDP->showSimpleOpen( qtr("Open subtitles file"),
164 dialogBox->directory().absolutePath() );
165 if( files.isEmpty() ) return;
166 ui.subInput->setEditText( files.join(" ") );
170 void FileOpenPanel::updateMRL()
172 QString mrl = ui.fileInput->currentText();
174 if( ui.subCheckBox->isChecked() ) {
175 mrl.append( " :sub-file=" + ui.subInput->currentText() );
176 int align = ui.alignSubComboBox->itemData(
177 ui.alignSubComboBox->currentIndex() ).toInt();
178 mrl.append( " :subsdec-align=" + QString().setNum( align ) );
179 int size = ui.sizeSubComboBox->itemData(
180 ui.sizeSubComboBox->currentIndex() ).toInt();
181 mrl.append( " :freetype-rel-fontsize=" + QString().setNum( size ) );
184 const char *psz_filepath = config_GetPsz( p_intf, "qt-filedialog-path" );
185 if( ( NULL == psz_filepath )
186 || strcmp( psz_filepath,dialogBox->directory().absolutePath().toUtf8()) )
188 /* set dialog box current directory as last known path */
189 config_PutPsz( p_intf, "qt-filedialog-path",
190 dialogBox->directory().absolutePath().toUtf8() );
194 emit mrlUpdated( mrl );
195 emit methodChanged( "file-caching" );
199 /* Function called by Open Dialog when clicke on Play/Enqueue */
200 void FileOpenPanel::accept()
202 ui.fileInput->addItem( ui.fileInput->currentText());
203 if ( ui.fileInput->count() > 8 ) ui.fileInput->removeItem( 0 );
206 void FileOpenBox::accept()
208 OpenDialog::getInstance( NULL, NULL )->play();
211 /* Function called by Open Dialog when clicked on cancel */
212 void FileOpenPanel::clear()
214 ui.fileInput->setEditText( "" );
215 ui.subInput->setEditText( "" );
218 void FileOpenPanel::toggleSubtitleFrame()
220 if ( ui.subFrame->isVisible() )
235 /**************************************************************************
236 * Open Discs ( DVD, CD, VCD and similar devices ) *
237 **************************************************************************/
238 DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
239 OpenPanel( _parent, _p_intf )
244 BUTTONACT( ui.dvdRadioButton, updateButtons());
245 BUTTONACT( ui.vcdRadioButton, updateButtons());
246 BUTTONACT( ui.audioCDRadioButton, updateButtons());
247 BUTTONACT( ui.dvdsimple, updateButtons());
249 CONNECT( ui.deviceCombo, editTextChanged( QString ), this, updateMRL());
250 CONNECT( ui.titleSpin, valueChanged( int ), this, updateMRL());
251 CONNECT( ui.chapterSpin, valueChanged( int ), this, updateMRL());
252 CONNECT( ui.audioSpin, valueChanged( int ), this, updateMRL());
253 CONNECT( ui.subtitlesSpin, valueChanged( int ), this, updateMRL());
256 DiscOpenPanel::~DiscOpenPanel()
259 void DiscOpenPanel::clear()
261 ui.titleSpin->setValue( 0 );
262 ui.chapterSpin->setValue( 0 );
265 void DiscOpenPanel::updateButtons()
267 if ( ui.dvdRadioButton->isChecked() )
269 ui.titleLabel->setText( qtr("Title") );
270 ui.chapterLabel->show();
271 ui.chapterSpin->show();
272 ui.diskOptionBox_2->show();
274 else if ( ui.vcdRadioButton->isChecked() )
276 ui.titleLabel->setText( qtr("Entry") );
277 ui.chapterLabel->hide();
278 ui.chapterSpin->hide();
279 ui.diskOptionBox_2->show();
283 ui.titleLabel->setText( qtr("Track") );
284 ui.chapterLabel->hide();
285 ui.chapterSpin->hide();
286 ui.diskOptionBox_2->hide();
293 void DiscOpenPanel::updateMRL()
297 if( ui.dvdRadioButton->isChecked() ) {
298 if( !ui.dvdsimple->isChecked() )
301 mrl = "dvdsimple://";
302 mrl += ui.deviceCombo->currentText();
303 emit methodChanged( "dvdnav-caching" );
305 if ( ui.titleSpin->value() > 0 ) {
306 mrl += QString("@%1").arg( ui.titleSpin->value() );
307 if ( ui.chapterSpin->value() > 0 ) {
308 mrl+= QString(":%1").arg( ui.chapterSpin->value() );
313 } else if ( ui.vcdRadioButton->isChecked() ) {
314 mrl = "vcd://" + ui.deviceCombo->currentText();
315 emit methodChanged( "vcd-caching" );
317 if( ui.titleSpin->value() > 0 ) {
318 mrl += QString("@E%1").arg( ui.titleSpin->value() );
323 mrl = "cdda://" + ui.deviceCombo->currentText();
324 if( ui.titleSpin->value() > 0 ) {
325 QString("@%1").arg( ui.titleSpin->value() );
329 if ( ui.dvdRadioButton->isChecked() || ui.vcdRadioButton->isChecked() )
331 if ( ui.audioSpin->value() >= 0 ) {
332 mrl += " :audio-track=" +
333 QString("%1").arg( ui.audioSpin->value() );
335 if ( ui.subtitlesSpin->value() >= 0 ) {
336 mrl += " :sub-track=" +
337 QString("%1").arg( ui.subtitlesSpin->value() );
340 emit mrlUpdated( mrl );
345 /**************************************************************************
346 * Open Network streams and URL pages *
347 **************************************************************************/
348 NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
349 OpenPanel( _parent, _p_intf )
354 CONNECT( ui.protocolCombo, currentIndexChanged( int ),
355 this, updateProtocol( int ) );
356 CONNECT( ui.portSpin, valueChanged( int ), this, updateMRL() );
357 CONNECT( ui.addressText, textChanged( QString ), this, updateAddress());
358 CONNECT( ui.timeShift, clicked(), this, updateMRL());
359 CONNECT( ui.ipv6, clicked(), this, updateMRL());
361 ui.protocolCombo->addItem("HTTP", QVariant("http"));
362 ui.protocolCombo->addItem("HTTPS", QVariant("https"));
363 ui.protocolCombo->addItem("FTP", QVariant("ftp"));
364 ui.protocolCombo->addItem("MMS", QVariant("mms"));
365 ui.protocolCombo->addItem("RTSP", QVariant("rtsp"));
366 ui.protocolCombo->addItem("UDP/RTP (unicast)", QVariant("udp"));
367 ui.protocolCombo->addItem("UDP/RTP (multicast)", QVariant("udp"));
370 NetOpenPanel::~NetOpenPanel()
373 void NetOpenPanel::clear()
376 void NetOpenPanel::updateProtocol( int idx ) {
377 QString addr = ui.addressText->text();
378 QString proto = ui.protocolCombo->itemData( idx ).toString();
380 ui.timeShift->setEnabled( idx >= 4 );
381 ui.ipv6->setEnabled( idx == 4 );
382 ui.addressText->setEnabled( idx != 4 );
383 ui.portSpin->setEnabled( idx >= 4 );
385 /* If we already have a protocol in the address, replace it */
386 if( addr.contains( "://")) {
387 msg_Err( p_intf, "replace");
388 addr.replace( QRegExp("^.*://"), proto + "://");
389 ui.addressText->setText( addr );
394 void NetOpenPanel::updateAddress() {
398 void NetOpenPanel::updateMRL() {
400 QString addr = ui.addressText->text();
401 int proto = ui.protocolCombo->currentIndex();
403 if( addr.contains( "://") && proto != 4 ) {
409 mrl = "http://" + addr;
410 emit methodChanged("http-caching");
413 mrl = "mms://" + addr;
414 emit methodChanged("mms-caching");
417 mrl = "ftp://" + addr;
418 emit methodChanged("ftp-caching");
421 mrl = "rtsp://" + addr;
422 emit methodChanged("rtsp-caching");
426 if( ui.ipv6->isEnabled() && ui.ipv6->isChecked() ) {
429 mrl += QString(":%1").arg( ui.portSpin->value() );
430 emit methodChanged("udp-caching");
432 case 6: /* UDP multicast */
435 if ( addr.contains(':') && !addr.contains('[') ) {
436 mrl += "[" + addr + "]";
438 mrl += QString(":%1").arg( ui.portSpin->value() );
439 emit methodChanged("udp-caching");
442 if( ui.timeShift->isEnabled() && ui.timeShift->isChecked() ) {
443 mrl += " :access-filter=timeshift";
445 emit mrlUpdated( mrl );
448 /**************************************************************************
449 * Open Capture device ( DVB, PVR, V4L, and similar ) *
450 **************************************************************************/
451 CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
452 OpenPanel( _parent, _p_intf )
456 /* Create two stacked layouts in the main comboBoxes */
457 QStackedLayout *stackedDevLayout = new QStackedLayout;
458 ui.cardBox->setLayout( stackedDevLayout );
460 QStackedLayout *stackedPropLayout = new QStackedLayout;
461 ui.optionsBox->setLayout( stackedPropLayout );
463 /* Creation and connections of the WIdgets in the stacked layout */
464 #define addModuleAndLayouts( number, name, label ) \
465 QWidget * name ## DevPage = new QWidget( this ); \
466 QWidget * name ## PropPage = new QWidget( this ); \
467 stackedDevLayout->addWidget( name ## DevPage ); \
468 stackedPropLayout->addWidget( name ## PropPage ); \
469 QGridLayout * name ## DevLayout = new QGridLayout; \
470 QGridLayout * name ## PropLayout = new QGridLayout; \
471 name ## DevPage->setLayout( name ## DevLayout ); \
472 name ## PropPage->setLayout( name ## PropLayout ); \
473 ui.deviceCombo->addItem( qtr( label ), QVariant( number ) );
475 #define CuMRL( widget, slot ) CONNECT( widget , slot , this, updateMRL() );
477 #define setMaxBound( spinbox ) spinbox->setRange ( 0, INT_MAX );
482 addModuleAndLayouts( V4L_DEVICE, v4l, "Video for Linux" );
485 QLabel *v4lVideoDeviceLabel = new QLabel( qtr( "Video device name" ) );
486 v4lDevLayout->addWidget( v4lVideoDeviceLabel, 0, 0 );
488 v4lVideoDevice = new QLineEdit;
489 v4lDevLayout->addWidget( v4lVideoDevice, 0, 1 );
491 QLabel *v4lAudioDeviceLabel = new QLabel( qtr( "Audio device name" ) );
492 v4lDevLayout->addWidget( v4lAudioDeviceLabel, 1, 0 );
494 v4lAudioDevice = new QLineEdit;
495 v4lDevLayout->addWidget( v4lAudioDevice, 1, 1 );
497 /* V4l Props panel */
498 v4lNormBox = new QComboBox;
499 setfillVLCConfigCombo( "v4l-norm", p_intf, v4lNormBox );
500 v4lPropLayout->addWidget( v4lNormBox, 0 , 1 );
502 v4lFreq = new QSpinBox;
503 v4lFreq->setAlignment( Qt::AlignRight );
504 v4lFreq->setSuffix(" kHz");
505 v4lPropLayout->addWidget( v4lFreq, 1 , 1 );
507 QLabel *v4lNormLabel = new QLabel( qtr( "Norm" ) );
508 v4lPropLayout->addWidget( v4lNormLabel, 0 , 0 );
510 QLabel *v4lFreqLabel = new QLabel( qtr( "Frequency" ) );
511 v4lPropLayout->addWidget( v4lFreqLabel, 1 , 0 );
514 CuMRL( v4lVideoDevice, textChanged( QString ) );
515 CuMRL( v4lAudioDevice, textChanged( QString ) );
516 CuMRL( v4lFreq, valueChanged ( int ) );
517 CuMRL( v4lNormBox, currentIndexChanged ( int ) );
522 addModuleAndLayouts( PVR_DEVICE, pvr, "PVR" );
525 QLabel *pvrDeviceLabel = new QLabel( qtr( "Device name" ) );
526 pvrDevLayout->addWidget( pvrDeviceLabel, 0, 0 );
528 pvrDevice = new QLineEdit;
529 pvrDevLayout->addWidget( pvrDevice, 0, 1 );
531 QLabel *pvrRadioDeviceLabel = new QLabel( qtr( "Radio device name" ) );
532 pvrDevLayout->addWidget( pvrRadioDeviceLabel, 1, 0 );
534 pvrRadioDevice = new QLineEdit;
535 pvrDevLayout->addWidget( pvrRadioDevice, 1, 1 );
537 /* PVR props panel */
538 pvrNormBox = new QComboBox;
539 setfillVLCConfigCombo( "pvr-norm", p_intf, pvrNormBox );
540 pvrPropLayout->addWidget( pvrNormBox, 0, 1 );
542 QLabel *pvrNormLabel = new QLabel( qtr( "Norm" ) );
543 pvrPropLayout->addWidget( pvrNormLabel, 0, 0 );
545 pvrFreq = new QSpinBox;
546 pvrFreq->setAlignment( Qt::AlignRight );
547 pvrFreq->setSuffix(" kHz");
548 setMaxBound( pvrFreq );
549 pvrPropLayout->addWidget( pvrFreq, 1, 1 );
551 pvrBitr = new QSpinBox;
552 pvrBitr->setAlignment( Qt::AlignRight );
553 pvrBitr->setSuffix(" kHz");
554 setMaxBound( pvrBitr );
555 pvrPropLayout->addWidget( pvrBitr, 2, 1 );
557 QLabel *pvrFreqLabel = new QLabel( qtr( "Frequency" ) );
558 pvrPropLayout->addWidget( pvrFreqLabel, 1, 0 );
560 QLabel *pvrBitrLabel = new QLabel( qtr( "Bitrate" ) );
561 pvrPropLayout->addWidget( pvrBitrLabel, 2, 0 );
564 CuMRL( pvrDevice, textChanged( QString ) );
565 CuMRL( pvrRadioDevice, textChanged( QString ) );
567 CuMRL( pvrFreq, valueChanged ( int ) );
568 CuMRL( pvrBitr, valueChanged ( int ) );
569 CuMRL( pvrNormBox, currentIndexChanged ( int ) );
571 /*********************
572 * DirectShow Stuffs *
573 *********************/
574 addModuleAndLayouts( DSHOW_DEVICE, dshow, "DirectShow" );
579 addModuleAndLayouts( BDA_DEVICE, bda, "DVB DirectShow" );
582 QLabel *bdaTypeLabel = new QLabel( qtr( "DVB Type:" ) );
584 bdas = new QRadioButton( "DVB-S" );
585 bdas->setChecked( true );
586 bdac = new QRadioButton( "DVB-C" );
587 bdat = new QRadioButton( "DVB-T" );
589 bdaDevLayout->addWidget( bdaTypeLabel, 1, 0 );
590 bdaDevLayout->addWidget( bdas, 1, 1 );
591 bdaDevLayout->addWidget( bdac, 1, 2 );
592 bdaDevLayout->addWidget( bdat, 1, 3 );
595 QLabel *bdaFreqLabel =
596 new QLabel( qtr( "Transponder/multiplex frequency" ) );
597 bdaPropLayout->addWidget( bdaFreqLabel, 0, 0 );
599 bdaFreq = new QSpinBox;
600 bdaFreq->setAlignment( Qt::AlignRight );
601 bdaFreq->setSuffix(" kHz");
602 bdaFreq->setSingleStep( 1000 );
603 setMaxBound( bdaFreq )
604 bdaPropLayout->addWidget( bdaFreq, 0, 1 );
606 bdaSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
607 bdaPropLayout->addWidget( bdaSrateLabel, 1, 0 );
609 bdaSrate = new QSpinBox;
610 bdaSrate->setAlignment( Qt::AlignRight );
611 bdaSrate->setSuffix(" kHz");
612 setMaxBound( bdaSrate );
613 bdaPropLayout->addWidget( bdaSrate, 1, 1 );
615 bdaBandLabel = new QLabel( qtr( "Bandwidth" ) );
616 bdaPropLayout->addWidget( bdaBandLabel, 2, 0 );
618 bdaBandBox = new QComboBox;
619 setfillVLCConfigCombo( "dvb-bandwidth", p_intf, bdaBandBox );
620 bdaPropLayout->addWidget( bdaBandBox, 2, 1 );
622 bdaBandLabel->hide();
626 CuMRL( bdaFreq, valueChanged ( int ) );
627 CuMRL( bdaSrate, valueChanged ( int ) );
628 CuMRL( bdaBandBox, currentIndexChanged ( int ) );
629 BUTTONACT( bdas, updateButtons() );
630 BUTTONACT( bdat, updateButtons() );
631 BUTTONACT( bdac, updateButtons() );
632 BUTTONACT( bdas, updateMRL() );
633 BUTTONACT( bdat, updateMRL() );
634 BUTTONACT( bdac, updateMRL() );
639 addModuleAndLayouts( DVB_DEVICE, dvb, "DVB" );
642 QLabel *dvbDeviceLabel = new QLabel( qtr( "Adapter card to tune" ) );
643 QLabel *dvbTypeLabel = new QLabel( qtr( "DVB Type:" ) );
645 dvbCard = new QSpinBox;
646 dvbCard->setAlignment( Qt::AlignRight );
647 dvbCard->setPrefix( "/dev/dvb/adapter" );
649 dvbDevLayout->addWidget( dvbDeviceLabel, 0, 0 );
650 dvbDevLayout->addWidget( dvbCard, 0, 2, 1, 2 );
652 dvbs = new QRadioButton( "DVB-S" );
653 dvbs->setChecked( true );
654 dvbc = new QRadioButton( "DVB-C" );
655 dvbt = new QRadioButton( "DVB-T" );
657 dvbDevLayout->addWidget( dvbTypeLabel, 1, 0 );
658 dvbDevLayout->addWidget( dvbs, 1, 1 );
659 dvbDevLayout->addWidget( dvbc, 1, 2 );
660 dvbDevLayout->addWidget( dvbt, 1, 3 );
662 /* DVB Props panel */
663 QLabel *dvbFreqLabel =
664 new QLabel( qtr( "Transponder/multiplex frequency" ) );
665 dvbPropLayout->addWidget( dvbFreqLabel, 0, 0 );
667 dvbFreq = new QSpinBox;
668 dvbFreq->setAlignment( Qt::AlignRight );
669 dvbFreq->setSuffix(" kHz");
670 setMaxBound( dvbFreq );
671 dvbPropLayout->addWidget( dvbFreq, 0, 1 );
673 QLabel *dvbSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
674 dvbPropLayout->addWidget( dvbSrateLabel, 1, 0 );
676 dvbSrate = new QSpinBox;
677 dvbSrate->setAlignment( Qt::AlignRight );
678 dvbSrate->setSuffix(" kHz");
679 setMaxBound( dvbSrate );
680 dvbPropLayout->addWidget( dvbSrate, 1, 1 );
683 CuMRL( dvbCard, valueChanged ( int ) );
684 CuMRL( dvbFreq, valueChanged ( int ) );
685 CuMRL( dvbSrate, valueChanged ( int ) );
687 BUTTONACT( dvbs, updateButtons() );
688 BUTTONACT( dvbt, updateButtons() );
689 BUTTONACT( dvbc, updateButtons() );
691 /* General connects */
692 connect( ui.deviceCombo, SIGNAL( activated( int ) ),
693 stackedDevLayout, SLOT( setCurrentIndex( int ) ) );
694 connect( ui.deviceCombo, SIGNAL( activated( int ) ),
695 stackedPropLayout, SLOT( setCurrentIndex( int ) ) );
696 CONNECT( ui.deviceCombo, activated( int ), this, updateMRL() );
701 CaptureOpenPanel::~CaptureOpenPanel()
704 void CaptureOpenPanel::clear()
707 void CaptureOpenPanel::updateMRL()
710 int i_devicetype = ui.deviceCombo->itemData(
711 ui.deviceCombo->currentIndex() ).toInt();
712 msg_Dbg( p_intf, "Capture Type: %i", i_devicetype );
713 switch( i_devicetype )
717 mrl += " :v4l-vdev=" + v4lVideoDevice->text();
718 mrl += " :v4l-adev=" + v4lAudioDevice->text();
719 mrl += " :v4l-norm=" + QString("%1").arg( v4lNormBox->currentIndex() );
720 mrl += " :v4l-frequency=" + QString("%1").arg( v4lFreq->value() );
724 mrl += " :pvr-device=" + pvrDevice->text();
725 mrl += " :pvr-radio-device=" + pvrRadioDevice->text();
726 mrl += " :pvr-norm=" + QString("%1").arg( pvrNormBox->currentIndex() );
727 if( pvrFreq->value() )
728 mrl += " :pvr-frequency=" + QString("%1").arg( pvrFreq->value() );
729 if( pvrBitr->value() )
730 mrl += " :pvr-bitrate=" + QString("%1").arg( pvrBitr->value() );
734 mrl += " :dvb-adapter=" + QString("%1").arg( dvbCard->value() );
735 mrl += " :dvb-frequency=" + QString("%1").arg( dvbFreq->value() );
736 mrl += " :dvb-srate=" + QString("%1").arg( dvbSrate->value() );
739 if( bdas->isChecked() ) mrl = "dvb-s://";
740 else if( bdat->isChecked() ) mrl = "dvb-t://";
741 else if( bdac->isChecked() ) mrl = "dvb-c://";
743 mrl += " :dvb-frequency=" + QString("%1").arg( bdaFreq->value() );
744 if( bdas->isChecked() || bdac->isChecked() )
745 mrl += " :dvb-srate=" + QString("%1").arg( bdaSrate->value() );
747 mrl += " :dvb-bandwidth=" +
748 QString("%1").arg( bdaBandBox->itemData(
749 bdaBandBox->currentIndex() ).toInt() );
754 emit mrlUpdated( mrl );
757 void CaptureOpenPanel::updateButtons()
759 int i_devicetype = ui.deviceCombo->itemData(
760 ui.deviceCombo->currentIndex() ).toInt();
761 msg_Dbg( p_intf, "Capture Type: %i", i_devicetype );
762 switch( i_devicetype )
765 if( dvbs->isChecked() ) dvbFreq->setSuffix(" kHz");
766 if( dvbc->isChecked() || dvbt->isChecked() ) dvbFreq->setSuffix(" Hz");
769 if( bdas->isChecked() || bdac->isChecked() )
772 bdaSrateLabel->show();
774 bdaBandLabel->hide();
779 bdaSrateLabel->hide();
781 bdaBandLabel->show();