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>
41 /**************************************************************************
43 **************************************************************************/
44 FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
45 OpenPanel( _parent, _p_intf )
47 /* Classic UI Setup */
50 /* Use a QFileDialog and customize it because we don't want to
51 rewrite it all. Be careful to your eyes cause there are a few hacks.
52 Be very careful and test correctly when you modify this. */
54 /* Set Filters for file selection */
55 QString fileTypes = "";
56 ADD_FILTER_MEDIA( fileTypes );
57 ADD_FILTER_VIDEO( fileTypes );
58 ADD_FILTER_AUDIO( fileTypes );
59 ADD_FILTER_PLAYLIST( fileTypes );
60 ADD_FILTER_ALL( fileTypes );
61 fileTypes.replace( QString(";*"), QString(" *"));
63 // Make this QFileDialog a child of tempWidget from the ui.
64 dialogBox = new FileOpenBox( ui.tempWidget, NULL,
65 qfu( p_intf->p_libvlc->psz_homedir ), fileTypes );
66 /* dialogBox->setFileMode( QFileDialog::ExistingFiles );*/
67 dialogBox->setAcceptMode( QFileDialog::AcceptOpen );
69 /* retrieve last known path used in file browsing */
70 char *psz_filepath = config_GetPsz( p_intf, "qt-filedialog-path" );
73 dialogBox->setDirectory( QString::fromUtf8( psz_filepath ) );
77 /* We don't want to see a grip in the middle of the window, do we? */
78 dialogBox->setSizeGripEnabled( false );
79 dialogBox->setToolTip( qtr( "Select one or multiple files, or a folder" ));
81 // Add it to the layout
82 ui.gridLayout->addWidget( dialogBox, 0, 0, 1, 3 );
84 // But hide the two OK/Cancel buttons. Enable them for debug.
85 QDialogButtonBox *fileDialogAcceptBox =
86 findChildren<QDialogButtonBox*>()[0];
87 fileDialogAcceptBox->hide();
89 /* Ugly hacks to get the good Widget */
90 //This lineEdit is the normal line in the fileDialog.
91 lineFileEdit = findChildren<QLineEdit*>()[3];
94 /* Make a list of QLabel inside the QFileDialog to access the good ones */
95 QList<QLabel *> listLabel = findChildren<QLabel*>();
97 /* Hide the FileNames one. Enable it for debug */
99 /* Change the text that was uncool in the usual box */
100 listLabel[5]->setText( qtr( "Filter:" ) );
102 // Hide the subtitles control by default.
105 /* Build the subs size combo box */
106 module_config_t *p_item =
107 config_FindConfig( VLC_OBJECT(p_intf), "freetype-rel-fontsize" );
110 for( int i_index = 0; i_index < p_item->i_list; i_index++ )
112 ui.sizeSubComboBox->addItem(
113 qfu( p_item->ppsz_list_text[i_index] ),
114 QVariant( p_item->pi_list[i_index] ) );
115 if( p_item->value.i == p_item->pi_list[i_index] )
117 ui.sizeSubComboBox->setCurrentIndex( i_index );
122 /* Build the subs align combo box */
123 p_item = config_FindConfig( VLC_OBJECT(p_intf), "subsdec-align" );
126 for( int i_index = 0; i_index < p_item->i_list; i_index++ )
128 ui.alignSubComboBox->addItem(
129 qfu( p_item->ppsz_list_text[i_index] ),
130 QVariant( p_item->pi_list[i_index] ) );
131 if( p_item->value.i == p_item->pi_list[i_index] )
133 ui.alignSubComboBox->setCurrentIndex( i_index );
139 BUTTONACT( ui.subBrowseButton, browseFileSub() );
140 BUTTONACT( ui.subCheckBox, toggleSubtitleFrame());
142 CONNECT( ui.fileInput, editTextChanged( QString ), this, updateMRL());
143 CONNECT( ui.subInput, editTextChanged( QString ), this, updateMRL());
144 CONNECT( ui.alignSubComboBox, currentIndexChanged( int ), this, updateMRL());
145 CONNECT( ui.sizeSubComboBox, currentIndexChanged( int ), this, updateMRL());
146 CONNECT( lineFileEdit, textChanged( QString ), this, browseFile());
149 FileOpenPanel::~FileOpenPanel()
152 QStringList FileOpenPanel::browse( QString help )
154 return THEDP->showSimpleOpen( help );
157 /* Unused. FIXME ? */
158 void FileOpenPanel::browseFile()
160 QString fileString = "";
161 foreach( QString file, dialogBox->selectedFiles() ) {
162 fileString += "\"" + file + "\" ";
164 ui.fileInput->setEditText( fileString );
168 void FileOpenPanel::browseFileSub()
170 // FIXME Handle selection of more than one subtitles file
171 QStringList files = THEDP->showSimpleOpen( qtr("Open subtitles file"),
173 dialogBox->directory().absolutePath() );
174 if( files.isEmpty() ) return;
175 ui.subInput->setEditText( files.join(" ") );
179 void FileOpenPanel::updateMRL()
181 QString mrl = ui.fileInput->currentText();
183 if( ui.subCheckBox->isChecked() ) {
184 mrl.append( " :sub-file=" + ui.subInput->currentText() );
185 int align = ui.alignSubComboBox->itemData(
186 ui.alignSubComboBox->currentIndex() ).toInt();
187 mrl.append( " :subsdec-align=" + QString().setNum( align ) );
188 int size = ui.sizeSubComboBox->itemData(
189 ui.sizeSubComboBox->currentIndex() ).toInt();
190 mrl.append( " :freetype-rel-fontsize=" + QString().setNum( size ) );
193 const char *psz_filepath = config_GetPsz( p_intf, "qt-filedialog-path" );
194 if( ( NULL == psz_filepath )
195 || strcmp( psz_filepath,dialogBox->directory().absolutePath().toUtf8()) )
197 /* set dialog box current directory as last known path */
198 config_PutPsz( p_intf, "qt-filedialog-path",
199 dialogBox->directory().absolutePath().toUtf8() );
203 emit mrlUpdated( mrl );
204 emit methodChanged( "file-caching" );
208 /* Function called by Open Dialog when clicke on Play/Enqueue */
209 void FileOpenPanel::accept()
211 ui.fileInput->addItem( ui.fileInput->currentText());
212 if ( ui.fileInput->count() > 8 ) ui.fileInput->removeItem( 0 );
215 void FileOpenBox::accept()
217 OpenDialog::getInstance( NULL, NULL )->play();
220 /* Function called by Open Dialog when clicked on cancel */
221 void FileOpenPanel::clear()
223 ui.fileInput->setEditText( "" );
224 ui.subInput->setEditText( "" );
227 void FileOpenPanel::toggleSubtitleFrame()
229 if ( ui.subFrame->isVisible() )
244 /**************************************************************************
246 **************************************************************************/
247 DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
248 OpenPanel( _parent, _p_intf )
252 BUTTONACT( ui.dvdRadioButton, updateButtons());
253 BUTTONACT( ui.vcdRadioButton, updateButtons());
254 BUTTONACT( ui.audioCDRadioButton, updateButtons());
255 BUTTONACT( ui.dvdsimple, updateButtons());
257 CONNECT( ui.deviceCombo, editTextChanged( QString ), this, updateMRL());
258 CONNECT( ui.titleSpin, valueChanged( int ), this, updateMRL());
259 CONNECT( ui.chapterSpin, valueChanged( int ), this, updateMRL());
260 CONNECT( ui.audioSpin, valueChanged( int ), this, updateMRL());
261 CONNECT( ui.subtitlesSpin, valueChanged( int ), this, updateMRL());
264 DiscOpenPanel::~DiscOpenPanel()
267 void DiscOpenPanel::clear()
269 ui.titleSpin->setValue( 0 );
270 ui.chapterSpin->setValue( 0 );
273 void DiscOpenPanel::updateButtons()
275 if ( ui.dvdRadioButton->isChecked() )
277 ui.titleLabel->setText( qtr("Title") );
278 ui.chapterLabel->show();
279 ui.chapterSpin->show();
280 ui.diskOptionBox_2->show();
282 else if ( ui.vcdRadioButton->isChecked() )
284 ui.titleLabel->setText( qtr("Entry") );
285 ui.chapterLabel->hide();
286 ui.chapterSpin->hide();
287 ui.diskOptionBox_2->show();
291 ui.titleLabel->setText( qtr("Track") );
292 ui.chapterLabel->hide();
293 ui.chapterSpin->hide();
294 ui.diskOptionBox_2->hide();
301 void DiscOpenPanel::updateMRL()
305 if( ui.dvdRadioButton->isChecked() ) {
306 if( !ui.dvdsimple->isChecked() )
309 mrl = "dvdsimple://";
310 mrl += ui.deviceCombo->currentText();
311 emit methodChanged( "dvdnav-caching" );
313 if ( ui.titleSpin->value() > 0 ) {
314 mrl += QString("@%1").arg( ui.titleSpin->value() );
315 if ( ui.chapterSpin->value() > 0 ) {
316 mrl+= QString(":%1").arg( ui.chapterSpin->value() );
321 } else if ( ui.vcdRadioButton->isChecked() ) {
322 mrl = "vcd://" + ui.deviceCombo->currentText();
323 emit methodChanged( "vcd-caching" );
325 if( ui.titleSpin->value() > 0 ) {
326 mrl += QString("@E%1").arg( ui.titleSpin->value() );
331 mrl = "cdda://" + ui.deviceCombo->currentText();
332 if( ui.titleSpin->value() > 0 ) {
333 QString("@%1").arg( ui.titleSpin->value() );
337 if ( ui.dvdRadioButton->isChecked() || ui.vcdRadioButton->isChecked() )
339 if ( ui.audioSpin->value() >= 0 ) {
340 mrl += " :audio-track=" +
341 QString("%1").arg( ui.audioSpin->value() );
343 if ( ui.subtitlesSpin->value() >= 0 ) {
344 mrl += " :sub-track=" +
345 QString("%1").arg( ui.subtitlesSpin->value() );
349 emit mrlUpdated( mrl );
354 /**************************************************************************
356 **************************************************************************/
357 NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
358 OpenPanel( _parent, _p_intf )
362 CONNECT( ui.protocolCombo, currentIndexChanged( int ),
363 this, updateProtocol( int ) );
364 CONNECT( ui.portSpin, valueChanged( int ), this, updateMRL() );
365 CONNECT( ui.addressText, textChanged( QString ), this, updateAddress());
366 CONNECT( ui.timeShift, clicked(), this, updateMRL());
367 CONNECT( ui.ipv6, clicked(), this, updateMRL());
369 ui.protocolCombo->addItem("HTTP", QVariant("http"));
370 ui.protocolCombo->addItem("HTTPS", QVariant("https"));
371 ui.protocolCombo->addItem("FTP", QVariant("ftp"));
372 ui.protocolCombo->addItem("MMS", QVariant("mms"));
373 ui.protocolCombo->addItem("RTSP", QVariant("rtsp"));
374 ui.protocolCombo->addItem("UDP/RTP (unicast)", QVariant("udp"));
375 ui.protocolCombo->addItem("UDP/RTP (multicast)", QVariant("udp"));
378 NetOpenPanel::~NetOpenPanel()
381 void NetOpenPanel::clear()
384 void NetOpenPanel::updateProtocol( int idx ) {
385 QString addr = ui.addressText->text();
386 QString proto = ui.protocolCombo->itemData( idx ).toString();
388 ui.timeShift->setEnabled( idx >= 4 );
389 ui.ipv6->setEnabled( idx == 4 );
390 ui.addressText->setEnabled( idx != 4 );
391 ui.portSpin->setEnabled( idx >= 4 );
393 /* If we already have a protocol in the address, replace it */
394 if( addr.contains( "://")) {
395 msg_Err( p_intf, "replace");
396 addr.replace( QRegExp("^.*://"), proto + "://");
397 ui.addressText->setText( addr );
403 void NetOpenPanel::updateAddress() {
407 void NetOpenPanel::updateMRL() {
409 QString addr = ui.addressText->text();
410 int proto = ui.protocolCombo->currentIndex();
412 if( addr.contains( "://") && proto != 4 ) {
418 mrl = "http://" + addr;
419 emit methodChanged("http-caching");
422 mrl = "mms://" + addr;
423 emit methodChanged("mms-caching");
426 mrl = "ftp://" + addr;
427 emit methodChanged("ftp-caching");
430 mrl = "rtsp://" + addr;
431 emit methodChanged("rtsp-caching");
435 if( ui.ipv6->isEnabled() && ui.ipv6->isChecked() ) {
438 mrl += QString(":%1").arg( ui.portSpin->value() );
439 emit methodChanged("udp-caching");
441 case 6: /* UDP multicast */
444 if ( addr.contains(':') && !addr.contains('[') ) {
445 mrl += "[" + addr + "]";
447 mrl += QString(":%1").arg( ui.portSpin->value() );
448 emit methodChanged("udp-caching");
451 if( ui.timeShift->isEnabled() && ui.timeShift->isChecked() ) {
452 mrl += " :access-filter=timeshift";
454 emit mrlUpdated( mrl );
457 /**************************************************************************
459 **************************************************************************/
460 CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
461 OpenPanel( _parent, _p_intf )
465 QStackedLayout *stackedDevLayout = new QStackedLayout;
466 ui.cardBox->setLayout( stackedDevLayout );
468 QStackedLayout *stackedPropLayout = new QStackedLayout;
469 ui.optionsBox->setLayout( stackedPropLayout );
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 );
490 addModuleAndLayouts( V4L_DEVICE, v4l, "Video for Linux" );
491 QLabel *v4lVideoDeviceLabel = new QLabel( qtr( "Video device name" ) );
492 v4lDevLayout->addWidget( v4lVideoDeviceLabel, 0, 0 );
493 v4lVideoDevice = new QLineEdit;
494 v4lDevLayout->addWidget( v4lVideoDevice, 0, 1 );
495 QLabel *v4lAudioDeviceLabel = new QLabel( qtr( "Audio device name" ) );
496 v4lDevLayout->addWidget( v4lAudioDeviceLabel, 1, 0 );
497 v4lAudioDevice = new QLineEdit;
498 v4lDevLayout->addWidget( v4lAudioDevice, 1, 1 );
501 v4lNormBox = new QComboBox;
502 v4lNormBox->insertItem( 3, qtr( "Automatic" ) );
503 v4lNormBox->insertItem( 0, "SECAM" );
504 v4lNormBox->insertItem( 1, "NTSC" );
505 v4lNormBox->insertItem( 2, "PAL" );
507 v4lFreq = new QSpinBox;
508 v4lFreq->setAlignment( Qt::AlignRight );
509 v4lFreq->setSuffix(" kHz");
511 QLabel *v4lNormLabel = new QLabel( qtr( "Norm" ) );
512 QLabel *v4lFreqLabel = new QLabel( qtr( "Frequency" ) );
514 v4lPropLayout->addWidget( v4lNormLabel, 0 , 0 );
515 v4lPropLayout->addWidget( v4lNormBox, 0 , 1 );
517 v4lPropLayout->addWidget( v4lFreqLabel, 1 , 0 );
518 v4lPropLayout->addWidget( v4lFreq, 1 , 1 );
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 );
534 pvrDevice = new QLineEdit;
535 pvrDevLayout->addWidget( pvrDevice, 0, 1 );
536 QLabel *pvrRadioDeviceLabel = new QLabel( qtr( "Radio device name" ) );
537 pvrDevLayout->addWidget( pvrRadioDeviceLabel, 1, 0 );
538 pvrRadioDevice = new QLineEdit;
539 pvrDevLayout->addWidget( pvrRadioDevice, 1, 1 );
542 pvrNormBox = new QComboBox;
543 pvrNormBox->insertItem( 3, qtr( "Automatic" ) );
544 pvrNormBox->insertItem( 0, "SECAM" );
545 pvrNormBox->insertItem( 1, "NTSC" );
546 pvrNormBox->insertItem( 2, "PAL" );
548 pvrFreq = new QSpinBox;
549 pvrFreq->setAlignment( Qt::AlignRight );
550 pvrFreq->setSuffix(" kHz");
551 setMaxBound( pvrFreq );
552 pvrBitr = new QSpinBox;
553 pvrBitr->setAlignment( Qt::AlignRight );
554 pvrBitr->setSuffix(" kHz");
555 setMaxBound( pvrBitr );
556 QLabel *pvrNormLabel = new QLabel( qtr( "Norm" ) );
557 QLabel *pvrFreqLabel = new QLabel( qtr( "Frequency" ) );
558 QLabel *pvrBitrLabel = new QLabel( qtr( "Bitrate" ) );
560 pvrPropLayout->addWidget( pvrNormLabel, 0, 0 );
561 pvrPropLayout->addWidget( pvrNormBox, 0, 1 );
563 pvrPropLayout->addWidget( pvrFreqLabel, 1, 0 );
564 pvrPropLayout->addWidget( pvrFreq, 1, 1 );
566 pvrPropLayout->addWidget( pvrBitrLabel, 2, 0 );
567 pvrPropLayout->addWidget( pvrBitr, 2, 1 );
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" );
586 addModuleAndLayouts( BDA_DEVICE, bda, "DVB DirectShow" );
589 QLabel *bdaDeviceLabel = new QLabel( qtr( "Adapter card to tune" ) );
590 QLabel *bdaTypeLabel = new QLabel( qtr( "DVB Type:" ) );
592 bdaCard = new QSpinBox;
593 bdaCard->setAlignment( Qt::AlignRight );
595 bdaDevLayout->addWidget( bdaDeviceLabel, 0, 0 );
596 bdaDevLayout->addWidget( bdaCard, 0, 2, 1, 2 );
598 bdas = new QRadioButton( "DVB-S" );
599 bdas->setChecked( true );
600 bdac = new QRadioButton( "DVB-C" );
601 bdat = new QRadioButton( "DVB-T" );
603 bdaDevLayout->addWidget( bdaTypeLabel, 1, 0 );
604 bdaDevLayout->addWidget( bdas, 1, 1 );
605 bdaDevLayout->addWidget( bdac, 1, 2 );
606 bdaDevLayout->addWidget( bdat, 1, 3 );
609 QLabel *bdaFreqLabel =
610 new QLabel( qtr( "Transponder/multiplex frequency" ) );
611 bdaFreq = new QSpinBox;
612 bdaFreq->setAlignment( Qt::AlignRight );
613 bdaFreq->setSuffix(" kHz");
614 setMaxBound( bdaFreq )
615 bdaPropLayout->addWidget( bdaFreqLabel, 0, 0 );
616 bdaPropLayout->addWidget( bdaFreq, 0, 1 );
618 bdaSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
619 bdaSrate = new QSpinBox;
620 bdaSrate->setAlignment( Qt::AlignRight );
621 bdaSrate->setSuffix(" kHz");
622 setMaxBound( bdaSrate );
623 bdaPropLayout->addWidget( bdaSrateLabel, 1, 0 );
624 bdaPropLayout->addWidget( bdaSrate, 1, 1 );
627 CuMRL( bdaCard, valueChanged ( int ) );
628 CuMRL( bdaFreq, valueChanged ( int ) );
629 CuMRL( bdaSrate, valueChanged ( int ) );
630 BUTTONACT( bdas, updateButtons() );
631 BUTTONACT( bdat, updateButtons() );
632 BUTTONACT( bdac, updateButtons() );
633 BUTTONACT( bdas, updateMRL() );
634 BUTTONACT( bdat, updateMRL() );
635 BUTTONACT( bdac, updateMRL() );
640 addModuleAndLayouts( DVB_DEVICE, dvb, "DVB" );
643 QLabel *dvbDeviceLabel = new QLabel( qtr( "Adapter card to tune" ) );
644 QLabel *dvbTypeLabel = new QLabel( qtr( "DVB Type:" ) );
646 dvbCard = new QSpinBox;
647 dvbCard->setAlignment( Qt::AlignRight );
648 dvbCard->setPrefix( "/dev/dvb/adapter" );
650 dvbDevLayout->addWidget( dvbDeviceLabel, 0, 0 );
651 dvbDevLayout->addWidget( dvbCard, 0, 2, 1, 2 );
653 dvbs = new QRadioButton( "DVB-S" );
654 dvbs->setChecked( true );
655 dvbc = new QRadioButton( "DVB-C" );
656 dvbt = new QRadioButton( "DVB-T" );
658 dvbDevLayout->addWidget( dvbTypeLabel, 1, 0 );
659 dvbDevLayout->addWidget( dvbs, 1, 1 );
660 dvbDevLayout->addWidget( dvbc, 1, 2 );
661 dvbDevLayout->addWidget( dvbt, 1, 3 );
664 QLabel *dvbFreqLabel =
665 new QLabel( qtr( "Transponder/multiplex frequency" ) );
666 dvbFreq = new QSpinBox;
667 dvbFreq->setAlignment( Qt::AlignRight );
668 dvbFreq->setSuffix(" kHz");
669 setMaxBound( dvbFreq );
670 dvbPropLayout->addWidget( dvbFreqLabel, 0, 0 );
671 dvbPropLayout->addWidget( dvbFreq, 0, 1 );
673 QLabel *dvbSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
674 dvbSrate = new QSpinBox;
675 dvbSrate->setAlignment( Qt::AlignRight );
676 dvbSrate->setSuffix(" kHz");
677 setMaxBound( dvbSrate );
678 dvbPropLayout->addWidget( dvbSrateLabel, 1, 0 );
679 dvbPropLayout->addWidget( dvbSrate, 1, 1 );
682 CuMRL( dvbCard, valueChanged ( int ) );
683 CuMRL( dvbFreq, valueChanged ( int ) );
684 CuMRL( dvbSrate, valueChanged ( int ) );
685 BUTTONACT( dvbs, updateButtons() );
686 BUTTONACT( dvbt, updateButtons() );
687 BUTTONACT( dvbc, updateButtons() );
689 /* General connects */
690 connect( ui.deviceCombo, SIGNAL( activated( int ) ),
691 stackedDevLayout, SLOT( setCurrentIndex( int ) ) );
692 connect( ui.deviceCombo, SIGNAL( activated( int ) ),
693 stackedPropLayout, SLOT( setCurrentIndex( int ) ) );
694 CONNECT( ui.deviceCombo, activated( int ), this, updateMRL() );
699 CaptureOpenPanel::~CaptureOpenPanel()
702 void CaptureOpenPanel::clear()
705 void CaptureOpenPanel::updateMRL()
708 int i_devicetype = ui.deviceCombo->itemData(
709 ui.deviceCombo->currentIndex() ).toInt();
710 msg_Dbg( p_intf, "Capture Type: %i", i_devicetype );
711 switch( i_devicetype )
715 mrl += " :v4l-vdev=" + v4lVideoDevice->text();
716 mrl += " :v4l-adev=" + v4lAudioDevice->text();
717 mrl += " :v4l-norm=" + QString("%1").arg( v4lNormBox->currentIndex() );
718 mrl += " :v4l-frequency=" + QString("%1").arg( v4lFreq->value() );
722 mrl += " :pvr-device=" + pvrDevice->text();
723 mrl += " :pvr-radio-device=" + pvrRadioDevice->text();
724 mrl += " :pvr-norm=" + QString("%1").arg( pvrNormBox->currentIndex() );
725 if( pvrFreq->value() )
726 mrl += " :pvr-frequency=" + QString("%1").arg( pvrFreq->value() );
727 if( pvrBitr->value() )
728 mrl += " :pvr-bitrate=" + QString("%1").arg( pvrBitr->value() );
732 mrl += " :dvb-adapter=" + QString("%1").arg( dvbCard->value() );
733 mrl += " :dvb-frequency=" + QString("%1").arg( dvbFreq->value() );
734 mrl += " :dvb-srate=" + QString("%1").arg( dvbSrate->value() );
737 if( bdas->isChecked() ) mrl = "dvb-s://";
738 else if( bdat->isChecked() ) mrl = "dvb-t://";
739 else if( bdac->isChecked() ) mrl = "dvb-c://";
741 mrl += " :dvb-adapter=" + QString("%1").arg( bdaCard->value() );
742 mrl += " :dvb-frequency=" + QString("%1").arg( bdaFreq->value() );
743 mrl += " :dvb-srate=" + QString("%1").arg( bdaSrate->value() );
749 emit mrlUpdated( mrl );
752 void CaptureOpenPanel::updateButtons()
754 int i_devicetype = ui.deviceCombo->itemData(
755 ui.deviceCombo->currentIndex() ).toInt();
756 msg_Dbg( p_intf, "Capture Type: %i", i_devicetype );
757 switch( i_devicetype )
760 if( dvbs->isChecked() ) dvbFreq->setSuffix(" kHz");
761 if( dvbc->isChecked() || dvbt->isChecked() ) dvbFreq->setSuffix(" Hz");
764 if( bdas->isChecked() ) bdaFreq->setSuffix(" kHz");
765 if( bdac->isChecked() || bdat->isChecked() ) bdaFreq->setSuffix(" Hz");
766 if( bdas->isChecked() || bdac->isChecked() )
769 bdaSrateLabel->show();
774 bdaSrateLabel->hide();