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 /**************************************************************************
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 );
80 dialogBox->setToolTip( qtr( "Select one or multiple files, or a folder" ));
82 // Add it to the layout
83 ui.gridLayout->addWidget( dialogBox, 0, 0, 1, 3 );
85 // But hide the two OK/Cancel buttons. Enable them for debug.
86 QDialogButtonBox *fileDialogAcceptBox =
87 findChildren<QDialogButtonBox*>()[0];
88 fileDialogAcceptBox->hide();
90 /* Ugly hacks to get the good Widget */
91 //This lineEdit is the normal line in the fileDialog.
92 lineFileEdit = findChildren<QLineEdit*>()[3];
95 /* Make a list of QLabel inside the QFileDialog to access the good ones */
96 QList<QLabel *> listLabel = findChildren<QLabel*>();
98 /* Hide the FileNames one. Enable it for debug */
100 /* Change the text that was uncool in the usual box */
101 listLabel[5]->setText( qtr( "Filter:" ) );
103 QListView *fileListView = findChildren<QListView*>().first();
104 fileListView->setViewMode(QListView::ListMode);
105 fileListView->setResizeMode(QListView::Adjust);
106 fileListView->setWrapping(true);
107 fileListView->setFlow(QListView::TopToBottom);
108 fileListView->setUniformItemSizes(false);
109 fileListView->setLayoutMode(QListView::Batched);
111 // Hide the subtitles control by default.
114 /* Build the subs size combo box */
115 module_config_t *p_item =
116 config_FindConfig( VLC_OBJECT(p_intf), "freetype-rel-fontsize" );
119 for( int i_index = 0; i_index < p_item->i_list; i_index++ )
121 ui.sizeSubComboBox->addItem(
122 qfu( p_item->ppsz_list_text[i_index] ),
123 QVariant( p_item->pi_list[i_index] ) );
124 if( p_item->value.i == p_item->pi_list[i_index] )
126 ui.sizeSubComboBox->setCurrentIndex( i_index );
131 /* Build the subs align combo box */
132 p_item = config_FindConfig( VLC_OBJECT(p_intf), "subsdec-align" );
135 for( int i_index = 0; i_index < p_item->i_list; i_index++ )
137 ui.alignSubComboBox->addItem(
138 qfu( p_item->ppsz_list_text[i_index] ),
139 QVariant( p_item->pi_list[i_index] ) );
140 if( p_item->value.i == p_item->pi_list[i_index] )
142 ui.alignSubComboBox->setCurrentIndex( i_index );
148 BUTTONACT( ui.subBrowseButton, browseFileSub() );
149 BUTTONACT( ui.subCheckBox, toggleSubtitleFrame());
151 CONNECT( ui.fileInput, editTextChanged( QString ), this, updateMRL());
152 CONNECT( ui.subInput, editTextChanged( QString ), this, updateMRL());
153 CONNECT( ui.alignSubComboBox, currentIndexChanged( int ), this, updateMRL());
154 CONNECT( ui.sizeSubComboBox, currentIndexChanged( int ), this, updateMRL());
155 CONNECT( lineFileEdit, textChanged( QString ), this, browseFile());
158 FileOpenPanel::~FileOpenPanel()
161 QStringList FileOpenPanel::browse( QString help )
163 return THEDP->showSimpleOpen( help );
166 /* Unused. FIXME ? */
167 void FileOpenPanel::browseFile()
169 QString fileString = "";
170 foreach( QString file, dialogBox->selectedFiles() ) {
171 fileString += "\"" + file + "\" ";
173 ui.fileInput->setEditText( fileString );
177 void FileOpenPanel::browseFileSub()
179 // FIXME Handle selection of more than one subtitles file
180 QStringList files = THEDP->showSimpleOpen( qtr("Open subtitles file"),
182 dialogBox->directory().absolutePath() );
183 if( files.isEmpty() ) return;
184 ui.subInput->setEditText( files.join(" ") );
188 void FileOpenPanel::updateMRL()
190 QString mrl = ui.fileInput->currentText();
192 if( ui.subCheckBox->isChecked() ) {
193 mrl.append( " :sub-file=" + ui.subInput->currentText() );
194 int align = ui.alignSubComboBox->itemData(
195 ui.alignSubComboBox->currentIndex() ).toInt();
196 mrl.append( " :subsdec-align=" + QString().setNum( align ) );
197 int size = ui.sizeSubComboBox->itemData(
198 ui.sizeSubComboBox->currentIndex() ).toInt();
199 mrl.append( " :freetype-rel-fontsize=" + QString().setNum( size ) );
202 const char *psz_filepath = config_GetPsz( p_intf, "qt-filedialog-path" );
203 if( ( NULL == psz_filepath )
204 || strcmp( psz_filepath,dialogBox->directory().absolutePath().toUtf8()) )
206 /* set dialog box current directory as last known path */
207 config_PutPsz( p_intf, "qt-filedialog-path",
208 dialogBox->directory().absolutePath().toUtf8() );
212 emit mrlUpdated( mrl );
213 emit methodChanged( "file-caching" );
217 /* Function called by Open Dialog when clicke on Play/Enqueue */
218 void FileOpenPanel::accept()
220 ui.fileInput->addItem( ui.fileInput->currentText());
221 if ( ui.fileInput->count() > 8 ) ui.fileInput->removeItem( 0 );
224 void FileOpenBox::accept()
226 OpenDialog::getInstance( NULL, NULL )->play();
229 /* Function called by Open Dialog when clicked on cancel */
230 void FileOpenPanel::clear()
232 ui.fileInput->setEditText( "" );
233 ui.subInput->setEditText( "" );
236 void FileOpenPanel::toggleSubtitleFrame()
238 if ( ui.subFrame->isVisible() )
253 /**************************************************************************
255 **************************************************************************/
256 DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
257 OpenPanel( _parent, _p_intf )
261 BUTTONACT( ui.dvdRadioButton, updateButtons());
262 BUTTONACT( ui.vcdRadioButton, updateButtons());
263 BUTTONACT( ui.audioCDRadioButton, updateButtons());
264 BUTTONACT( ui.dvdsimple, updateButtons());
266 CONNECT( ui.deviceCombo, editTextChanged( QString ), this, updateMRL());
267 CONNECT( ui.titleSpin, valueChanged( int ), this, updateMRL());
268 CONNECT( ui.chapterSpin, valueChanged( int ), this, updateMRL());
269 CONNECT( ui.audioSpin, valueChanged( int ), this, updateMRL());
270 CONNECT( ui.subtitlesSpin, valueChanged( int ), this, updateMRL());
273 DiscOpenPanel::~DiscOpenPanel()
276 void DiscOpenPanel::clear()
278 ui.titleSpin->setValue( 0 );
279 ui.chapterSpin->setValue( 0 );
282 void DiscOpenPanel::updateButtons()
284 if ( ui.dvdRadioButton->isChecked() )
286 ui.titleLabel->setText( qtr("Title") );
287 ui.chapterLabel->show();
288 ui.chapterSpin->show();
289 ui.diskOptionBox_2->show();
291 else if ( ui.vcdRadioButton->isChecked() )
293 ui.titleLabel->setText( qtr("Entry") );
294 ui.chapterLabel->hide();
295 ui.chapterSpin->hide();
296 ui.diskOptionBox_2->show();
300 ui.titleLabel->setText( qtr("Track") );
301 ui.chapterLabel->hide();
302 ui.chapterSpin->hide();
303 ui.diskOptionBox_2->hide();
310 void DiscOpenPanel::updateMRL()
314 if( ui.dvdRadioButton->isChecked() ) {
315 if( !ui.dvdsimple->isChecked() )
318 mrl = "dvdsimple://";
319 mrl += ui.deviceCombo->currentText();
320 emit methodChanged( "dvdnav-caching" );
322 if ( ui.titleSpin->value() > 0 ) {
323 mrl += QString("@%1").arg( ui.titleSpin->value() );
324 if ( ui.chapterSpin->value() > 0 ) {
325 mrl+= QString(":%1").arg( ui.chapterSpin->value() );
330 } else if ( ui.vcdRadioButton->isChecked() ) {
331 mrl = "vcd://" + ui.deviceCombo->currentText();
332 emit methodChanged( "vcd-caching" );
334 if( ui.titleSpin->value() > 0 ) {
335 mrl += QString("@E%1").arg( ui.titleSpin->value() );
340 mrl = "cdda://" + ui.deviceCombo->currentText();
341 if( ui.titleSpin->value() > 0 ) {
342 QString("@%1").arg( ui.titleSpin->value() );
346 if ( ui.dvdRadioButton->isChecked() || ui.vcdRadioButton->isChecked() )
348 if ( ui.audioSpin->value() >= 0 ) {
349 mrl += " :audio-track=" +
350 QString("%1").arg( ui.audioSpin->value() );
352 if ( ui.subtitlesSpin->value() >= 0 ) {
353 mrl += " :sub-track=" +
354 QString("%1").arg( ui.subtitlesSpin->value() );
358 emit mrlUpdated( mrl );
363 /**************************************************************************
365 **************************************************************************/
366 NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
367 OpenPanel( _parent, _p_intf )
371 CONNECT( ui.protocolCombo, currentIndexChanged( int ),
372 this, updateProtocol( int ) );
373 CONNECT( ui.portSpin, valueChanged( int ), this, updateMRL() );
374 CONNECT( ui.addressText, textChanged( QString ), this, updateAddress());
375 CONNECT( ui.timeShift, clicked(), this, updateMRL());
376 CONNECT( ui.ipv6, clicked(), this, updateMRL());
378 ui.protocolCombo->addItem("HTTP", QVariant("http"));
379 ui.protocolCombo->addItem("HTTPS", QVariant("https"));
380 ui.protocolCombo->addItem("FTP", QVariant("ftp"));
381 ui.protocolCombo->addItem("MMS", QVariant("mms"));
382 ui.protocolCombo->addItem("RTSP", QVariant("rtsp"));
383 ui.protocolCombo->addItem("UDP/RTP (unicast)", QVariant("udp"));
384 ui.protocolCombo->addItem("UDP/RTP (multicast)", QVariant("udp"));
387 NetOpenPanel::~NetOpenPanel()
390 void NetOpenPanel::clear()
393 void NetOpenPanel::updateProtocol( int idx ) {
394 QString addr = ui.addressText->text();
395 QString proto = ui.protocolCombo->itemData( idx ).toString();
397 ui.timeShift->setEnabled( idx >= 4 );
398 ui.ipv6->setEnabled( idx == 4 );
399 ui.addressText->setEnabled( idx != 4 );
400 ui.portSpin->setEnabled( idx >= 4 );
402 /* If we already have a protocol in the address, replace it */
403 if( addr.contains( "://")) {
404 msg_Err( p_intf, "replace");
405 addr.replace( QRegExp("^.*://"), proto + "://");
406 ui.addressText->setText( addr );
412 void NetOpenPanel::updateAddress() {
416 void NetOpenPanel::updateMRL() {
418 QString addr = ui.addressText->text();
419 int proto = ui.protocolCombo->currentIndex();
421 if( addr.contains( "://") && proto != 4 ) {
427 mrl = "http://" + addr;
428 emit methodChanged("http-caching");
431 mrl = "mms://" + addr;
432 emit methodChanged("mms-caching");
435 mrl = "ftp://" + addr;
436 emit methodChanged("ftp-caching");
439 mrl = "rtsp://" + addr;
440 emit methodChanged("rtsp-caching");
444 if( ui.ipv6->isEnabled() && ui.ipv6->isChecked() ) {
447 mrl += QString(":%1").arg( ui.portSpin->value() );
448 emit methodChanged("udp-caching");
450 case 6: /* UDP multicast */
453 if ( addr.contains(':') && !addr.contains('[') ) {
454 mrl += "[" + addr + "]";
456 mrl += QString(":%1").arg( ui.portSpin->value() );
457 emit methodChanged("udp-caching");
460 if( ui.timeShift->isEnabled() && ui.timeShift->isChecked() ) {
461 mrl += " :access-filter=timeshift";
463 emit mrlUpdated( mrl );
466 /**************************************************************************
468 **************************************************************************/
469 CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
470 OpenPanel( _parent, _p_intf )
474 QStackedLayout *stackedDevLayout = new QStackedLayout;
475 ui.cardBox->setLayout( stackedDevLayout );
477 QStackedLayout *stackedPropLayout = new QStackedLayout;
478 ui.optionsBox->setLayout( stackedPropLayout );
480 #define addModuleAndLayouts( number, name, label ) \
481 QWidget * name ## DevPage = new QWidget( this ); \
482 QWidget * name ## PropPage = new QWidget( this ); \
483 stackedDevLayout->addWidget( name ## DevPage ); \
484 stackedPropLayout->addWidget( name ## PropPage ); \
485 QGridLayout * name ## DevLayout = new QGridLayout; \
486 QGridLayout * name ## PropLayout = new QGridLayout; \
487 name ## DevPage->setLayout( name ## DevLayout ); \
488 name ## PropPage->setLayout( name ## PropLayout ); \
489 ui.deviceCombo->addItem( qtr( label ), QVariant( number ) );
491 #define CuMRL( widget, slot ) CONNECT( widget , slot , this, updateMRL() );
493 #define setMaxBound( spinbox ) spinbox->setRange ( 0, INT_MAX );
499 addModuleAndLayouts( V4L_DEVICE, v4l, "Video for Linux" );
500 QLabel *v4lVideoDeviceLabel = new QLabel( qtr( "Video device name" ) );
501 v4lDevLayout->addWidget( v4lVideoDeviceLabel, 0, 0 );
502 v4lVideoDevice = new QLineEdit;
503 v4lDevLayout->addWidget( v4lVideoDevice, 0, 1 );
504 QLabel *v4lAudioDeviceLabel = new QLabel( qtr( "Audio device name" ) );
505 v4lDevLayout->addWidget( v4lAudioDeviceLabel, 1, 0 );
506 v4lAudioDevice = new QLineEdit;
507 v4lDevLayout->addWidget( v4lAudioDevice, 1, 1 );
510 v4lNormBox = new QComboBox;
511 v4lNormBox->insertItem( 3, qtr( "Automatic" ) );
512 v4lNormBox->insertItem( 0, "SECAM" );
513 v4lNormBox->insertItem( 1, "NTSC" );
514 v4lNormBox->insertItem( 2, "PAL" );
516 v4lFreq = new QSpinBox;
517 v4lFreq->setAlignment( Qt::AlignRight );
518 v4lFreq->setSuffix(" kHz");
520 QLabel *v4lNormLabel = new QLabel( qtr( "Norm" ) );
521 QLabel *v4lFreqLabel = new QLabel( qtr( "Frequency" ) );
523 v4lPropLayout->addWidget( v4lNormLabel, 0 , 0 );
524 v4lPropLayout->addWidget( v4lNormBox, 0 , 1 );
526 v4lPropLayout->addWidget( v4lFreqLabel, 1 , 0 );
527 v4lPropLayout->addWidget( v4lFreq, 1 , 1 );
530 CuMRL( v4lVideoDevice, textChanged( QString ) );
531 CuMRL( v4lAudioDevice, textChanged( QString ) );
532 CuMRL( v4lFreq, valueChanged ( int ) );
533 CuMRL( v4lNormBox, currentIndexChanged ( int ) );
538 addModuleAndLayouts( PVR_DEVICE, pvr, "PVR" );
541 QLabel *pvrDeviceLabel = new QLabel( qtr( "Device name" ) );
542 pvrDevLayout->addWidget( pvrDeviceLabel, 0, 0 );
543 pvrDevice = new QLineEdit;
544 pvrDevLayout->addWidget( pvrDevice, 0, 1 );
545 QLabel *pvrRadioDeviceLabel = new QLabel( qtr( "Radio device name" ) );
546 pvrDevLayout->addWidget( pvrRadioDeviceLabel, 1, 0 );
547 pvrRadioDevice = new QLineEdit;
548 pvrDevLayout->addWidget( pvrRadioDevice, 1, 1 );
551 pvrNormBox = new QComboBox;
552 pvrNormBox->insertItem( 3, qtr( "Automatic" ) );
553 pvrNormBox->insertItem( 0, "SECAM" );
554 pvrNormBox->insertItem( 1, "NTSC" );
555 pvrNormBox->insertItem( 2, "PAL" );
557 pvrFreq = new QSpinBox;
558 pvrFreq->setAlignment( Qt::AlignRight );
559 pvrFreq->setSuffix(" kHz");
560 setMaxBound( pvrFreq );
561 pvrBitr = new QSpinBox;
562 pvrBitr->setAlignment( Qt::AlignRight );
563 pvrBitr->setSuffix(" kHz");
564 setMaxBound( pvrBitr );
565 QLabel *pvrNormLabel = new QLabel( qtr( "Norm" ) );
566 QLabel *pvrFreqLabel = new QLabel( qtr( "Frequency" ) );
567 QLabel *pvrBitrLabel = new QLabel( qtr( "Bitrate" ) );
569 pvrPropLayout->addWidget( pvrNormLabel, 0, 0 );
570 pvrPropLayout->addWidget( pvrNormBox, 0, 1 );
572 pvrPropLayout->addWidget( pvrFreqLabel, 1, 0 );
573 pvrPropLayout->addWidget( pvrFreq, 1, 1 );
575 pvrPropLayout->addWidget( pvrBitrLabel, 2, 0 );
576 pvrPropLayout->addWidget( pvrBitr, 2, 1 );
579 CuMRL( pvrDevice, textChanged( QString ) );
580 CuMRL( pvrRadioDevice, textChanged( QString ) );
582 CuMRL( pvrFreq, valueChanged ( int ) );
583 CuMRL( pvrBitr, valueChanged ( int ) );
584 CuMRL( pvrNormBox, currentIndexChanged ( int ) );
586 /*********************
587 * DirectShow Stuffs *
588 *********************/
589 addModuleAndLayouts( DSHOW_DEVICE, dshow, "DirectShow" );
595 addModuleAndLayouts( BDA_DEVICE, bda, "DVB DirectShow" );
598 QLabel *bdaDeviceLabel = new QLabel( qtr( "Adapter card to tune" ) );
599 QLabel *bdaTypeLabel = new QLabel( qtr( "DVB Type:" ) );
601 bdaCard = new QSpinBox;
602 bdaCard->setAlignment( Qt::AlignRight );
604 bdaDevLayout->addWidget( bdaDeviceLabel, 0, 0 );
605 bdaDevLayout->addWidget( bdaCard, 0, 2, 1, 2 );
607 bdas = new QRadioButton( "DVB-S" );
608 bdas->setChecked( true );
609 bdac = new QRadioButton( "DVB-C" );
610 bdat = new QRadioButton( "DVB-T" );
612 bdaDevLayout->addWidget( bdaTypeLabel, 1, 0 );
613 bdaDevLayout->addWidget( bdas, 1, 1 );
614 bdaDevLayout->addWidget( bdac, 1, 2 );
615 bdaDevLayout->addWidget( bdat, 1, 3 );
618 QLabel *bdaFreqLabel =
619 new QLabel( qtr( "Transponder/multiplex frequency" ) );
620 bdaFreq = new QSpinBox;
621 bdaFreq->setAlignment( Qt::AlignRight );
622 bdaFreq->setSuffix(" kHz");
623 setMaxBound( bdaFreq )
624 bdaPropLayout->addWidget( bdaFreqLabel, 0, 0 );
625 bdaPropLayout->addWidget( bdaFreq, 0, 1 );
627 bdaSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
628 bdaSrate = new QSpinBox;
629 bdaSrate->setAlignment( Qt::AlignRight );
630 bdaSrate->setSuffix(" kHz");
631 setMaxBound( bdaSrate );
632 bdaPropLayout->addWidget( bdaSrateLabel, 1, 0 );
633 bdaPropLayout->addWidget( bdaSrate, 1, 1 );
636 CuMRL( bdaCard, valueChanged ( int ) );
637 CuMRL( bdaFreq, valueChanged ( int ) );
638 CuMRL( bdaSrate, valueChanged ( int ) );
639 BUTTONACT( bdas, updateButtons() );
640 BUTTONACT( bdat, updateButtons() );
641 BUTTONACT( bdac, updateButtons() );
642 BUTTONACT( bdas, updateMRL() );
643 BUTTONACT( bdat, updateMRL() );
644 BUTTONACT( bdac, updateMRL() );
649 addModuleAndLayouts( DVB_DEVICE, dvb, "DVB" );
652 QLabel *dvbDeviceLabel = new QLabel( qtr( "Adapter card to tune" ) );
653 QLabel *dvbTypeLabel = new QLabel( qtr( "DVB Type:" ) );
655 dvbCard = new QSpinBox;
656 dvbCard->setAlignment( Qt::AlignRight );
657 dvbCard->setPrefix( "/dev/dvb/adapter" );
659 dvbDevLayout->addWidget( dvbDeviceLabel, 0, 0 );
660 dvbDevLayout->addWidget( dvbCard, 0, 2, 1, 2 );
662 dvbs = new QRadioButton( "DVB-S" );
663 dvbs->setChecked( true );
664 dvbc = new QRadioButton( "DVB-C" );
665 dvbt = new QRadioButton( "DVB-T" );
667 dvbDevLayout->addWidget( dvbTypeLabel, 1, 0 );
668 dvbDevLayout->addWidget( dvbs, 1, 1 );
669 dvbDevLayout->addWidget( dvbc, 1, 2 );
670 dvbDevLayout->addWidget( dvbt, 1, 3 );
673 QLabel *dvbFreqLabel =
674 new QLabel( qtr( "Transponder/multiplex frequency" ) );
675 dvbFreq = new QSpinBox;
676 dvbFreq->setAlignment( Qt::AlignRight );
677 dvbFreq->setSuffix(" kHz");
678 setMaxBound( dvbFreq );
679 dvbPropLayout->addWidget( dvbFreqLabel, 0, 0 );
680 dvbPropLayout->addWidget( dvbFreq, 0, 1 );
682 QLabel *dvbSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
683 dvbSrate = new QSpinBox;
684 dvbSrate->setAlignment( Qt::AlignRight );
685 dvbSrate->setSuffix(" kHz");
686 setMaxBound( dvbSrate );
687 dvbPropLayout->addWidget( dvbSrateLabel, 1, 0 );
688 dvbPropLayout->addWidget( dvbSrate, 1, 1 );
691 CuMRL( dvbCard, valueChanged ( int ) );
692 CuMRL( dvbFreq, valueChanged ( int ) );
693 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-adapter=" + QString("%1").arg( bdaCard->value() );
751 mrl += " :dvb-frequency=" + QString("%1").arg( bdaFreq->value() );
752 mrl += " :dvb-srate=" + QString("%1").arg( bdaSrate->value() );
758 emit mrlUpdated( mrl );
761 void CaptureOpenPanel::updateButtons()
763 int i_devicetype = ui.deviceCombo->itemData(
764 ui.deviceCombo->currentIndex() ).toInt();
765 msg_Dbg( p_intf, "Capture Type: %i", i_devicetype );
766 switch( i_devicetype )
769 if( dvbs->isChecked() ) dvbFreq->setSuffix(" kHz");
770 if( dvbc->isChecked() || dvbt->isChecked() ) dvbFreq->setSuffix(" Hz");
773 if( bdas->isChecked() ) bdaFreq->setSuffix(" kHz");
774 if( bdac->isChecked() || bdat->isChecked() ) bdaFreq->setSuffix(" Hz");
775 if( bdas->isChecked() || bdac->isChecked() )
778 bdaSrateLabel->show();
783 bdaSrateLabel->hide();