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:" ) );
104 /* QFileDialog is quite buggy make it brerable on win32 by tweaking
106 QListView *fileListView = findChildren<QListView*>().first();
107 fileListView->setLayoutMode(QListView::Batched);
108 fileListView->setViewMode(QListView::ListMode);
109 fileListView->setResizeMode(QListView::Adjust);
110 fileListView->setUniformItemSizes(false);
111 fileListView->setFlow(QListView::TopToBottom);
112 fileListView->setWrapping(true);
115 // Hide the subtitles control by default.
118 /* Build the subs size combo box */
119 module_config_t *p_item =
120 config_FindConfig( VLC_OBJECT(p_intf), "freetype-rel-fontsize" );
123 for( int i_index = 0; i_index < p_item->i_list; i_index++ )
125 ui.sizeSubComboBox->addItem(
126 qfu( p_item->ppsz_list_text[i_index] ),
127 QVariant( p_item->pi_list[i_index] ) );
128 if( p_item->value.i == p_item->pi_list[i_index] )
130 ui.sizeSubComboBox->setCurrentIndex( i_index );
135 /* Build the subs align combo box */
136 p_item = config_FindConfig( VLC_OBJECT(p_intf), "subsdec-align" );
139 for( int i_index = 0; i_index < p_item->i_list; i_index++ )
141 ui.alignSubComboBox->addItem(
142 qfu( p_item->ppsz_list_text[i_index] ),
143 QVariant( p_item->pi_list[i_index] ) );
144 if( p_item->value.i == p_item->pi_list[i_index] )
146 ui.alignSubComboBox->setCurrentIndex( i_index );
152 BUTTONACT( ui.subBrowseButton, browseFileSub() );
153 BUTTONACT( ui.subCheckBox, toggleSubtitleFrame());
155 CONNECT( ui.fileInput, editTextChanged( QString ), this, updateMRL());
156 CONNECT( ui.subInput, editTextChanged( QString ), this, updateMRL());
157 CONNECT( ui.alignSubComboBox, currentIndexChanged( int ), this, updateMRL());
158 CONNECT( ui.sizeSubComboBox, currentIndexChanged( int ), this, updateMRL());
159 CONNECT( lineFileEdit, textChanged( QString ), this, browseFile());
162 FileOpenPanel::~FileOpenPanel()
165 QStringList FileOpenPanel::browse( QString help )
167 return THEDP->showSimpleOpen( help );
170 /* Unused. FIXME ? */
171 void FileOpenPanel::browseFile()
173 QString fileString = "";
174 foreach( QString file, dialogBox->selectedFiles() ) {
175 fileString += "\"" + file + "\" ";
177 ui.fileInput->setEditText( fileString );
181 void FileOpenPanel::browseFileSub()
183 // FIXME Handle selection of more than one subtitles file
184 QStringList files = THEDP->showSimpleOpen( qtr("Open subtitles file"),
186 dialogBox->directory().absolutePath() );
187 if( files.isEmpty() ) return;
188 ui.subInput->setEditText( files.join(" ") );
192 void FileOpenPanel::updateMRL()
194 QString mrl = ui.fileInput->currentText();
196 if( ui.subCheckBox->isChecked() ) {
197 mrl.append( " :sub-file=" + ui.subInput->currentText() );
198 int align = ui.alignSubComboBox->itemData(
199 ui.alignSubComboBox->currentIndex() ).toInt();
200 mrl.append( " :subsdec-align=" + QString().setNum( align ) );
201 int size = ui.sizeSubComboBox->itemData(
202 ui.sizeSubComboBox->currentIndex() ).toInt();
203 mrl.append( " :freetype-rel-fontsize=" + QString().setNum( size ) );
206 const char *psz_filepath = config_GetPsz( p_intf, "qt-filedialog-path" );
207 if( ( NULL == psz_filepath )
208 || strcmp( psz_filepath,dialogBox->directory().absolutePath().toUtf8()) )
210 /* set dialog box current directory as last known path */
211 config_PutPsz( p_intf, "qt-filedialog-path",
212 dialogBox->directory().absolutePath().toUtf8() );
216 emit mrlUpdated( mrl );
217 emit methodChanged( "file-caching" );
221 /* Function called by Open Dialog when clicke on Play/Enqueue */
222 void FileOpenPanel::accept()
224 ui.fileInput->addItem( ui.fileInput->currentText());
225 if ( ui.fileInput->count() > 8 ) ui.fileInput->removeItem( 0 );
228 void FileOpenBox::accept()
230 OpenDialog::getInstance( NULL, NULL )->play();
233 /* Function called by Open Dialog when clicked on cancel */
234 void FileOpenPanel::clear()
236 ui.fileInput->setEditText( "" );
237 ui.subInput->setEditText( "" );
240 void FileOpenPanel::toggleSubtitleFrame()
242 if ( ui.subFrame->isVisible() )
257 /**************************************************************************
259 **************************************************************************/
260 DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
261 OpenPanel( _parent, _p_intf )
265 BUTTONACT( ui.dvdRadioButton, updateButtons());
266 BUTTONACT( ui.vcdRadioButton, updateButtons());
267 BUTTONACT( ui.audioCDRadioButton, updateButtons());
268 BUTTONACT( ui.dvdsimple, updateButtons());
270 CONNECT( ui.deviceCombo, editTextChanged( QString ), this, updateMRL());
271 CONNECT( ui.titleSpin, valueChanged( int ), this, updateMRL());
272 CONNECT( ui.chapterSpin, valueChanged( int ), this, updateMRL());
273 CONNECT( ui.audioSpin, valueChanged( int ), this, updateMRL());
274 CONNECT( ui.subtitlesSpin, valueChanged( int ), this, updateMRL());
277 DiscOpenPanel::~DiscOpenPanel()
280 void DiscOpenPanel::clear()
282 ui.titleSpin->setValue( 0 );
283 ui.chapterSpin->setValue( 0 );
286 void DiscOpenPanel::updateButtons()
288 if ( ui.dvdRadioButton->isChecked() )
290 ui.titleLabel->setText( qtr("Title") );
291 ui.chapterLabel->show();
292 ui.chapterSpin->show();
293 ui.diskOptionBox_2->show();
295 else if ( ui.vcdRadioButton->isChecked() )
297 ui.titleLabel->setText( qtr("Entry") );
298 ui.chapterLabel->hide();
299 ui.chapterSpin->hide();
300 ui.diskOptionBox_2->show();
304 ui.titleLabel->setText( qtr("Track") );
305 ui.chapterLabel->hide();
306 ui.chapterSpin->hide();
307 ui.diskOptionBox_2->hide();
314 void DiscOpenPanel::updateMRL()
318 if( ui.dvdRadioButton->isChecked() ) {
319 if( !ui.dvdsimple->isChecked() )
322 mrl = "dvdsimple://";
323 mrl += ui.deviceCombo->currentText();
324 emit methodChanged( "dvdnav-caching" );
326 if ( ui.titleSpin->value() > 0 ) {
327 mrl += QString("@%1").arg( ui.titleSpin->value() );
328 if ( ui.chapterSpin->value() > 0 ) {
329 mrl+= QString(":%1").arg( ui.chapterSpin->value() );
334 } else if ( ui.vcdRadioButton->isChecked() ) {
335 mrl = "vcd://" + ui.deviceCombo->currentText();
336 emit methodChanged( "vcd-caching" );
338 if( ui.titleSpin->value() > 0 ) {
339 mrl += QString("@E%1").arg( ui.titleSpin->value() );
344 mrl = "cdda://" + ui.deviceCombo->currentText();
345 if( ui.titleSpin->value() > 0 ) {
346 QString("@%1").arg( ui.titleSpin->value() );
350 if ( ui.dvdRadioButton->isChecked() || ui.vcdRadioButton->isChecked() )
352 if ( ui.audioSpin->value() >= 0 ) {
353 mrl += " :audio-track=" +
354 QString("%1").arg( ui.audioSpin->value() );
356 if ( ui.subtitlesSpin->value() >= 0 ) {
357 mrl += " :sub-track=" +
358 QString("%1").arg( ui.subtitlesSpin->value() );
362 emit mrlUpdated( mrl );
367 /**************************************************************************
369 **************************************************************************/
370 NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
371 OpenPanel( _parent, _p_intf )
375 CONNECT( ui.protocolCombo, currentIndexChanged( int ),
376 this, updateProtocol( int ) );
377 CONNECT( ui.portSpin, valueChanged( int ), this, updateMRL() );
378 CONNECT( ui.addressText, textChanged( QString ), this, updateAddress());
379 CONNECT( ui.timeShift, clicked(), this, updateMRL());
380 CONNECT( ui.ipv6, clicked(), this, updateMRL());
382 ui.protocolCombo->addItem("HTTP", QVariant("http"));
383 ui.protocolCombo->addItem("HTTPS", QVariant("https"));
384 ui.protocolCombo->addItem("FTP", QVariant("ftp"));
385 ui.protocolCombo->addItem("MMS", QVariant("mms"));
386 ui.protocolCombo->addItem("RTSP", QVariant("rtsp"));
387 ui.protocolCombo->addItem("UDP/RTP (unicast)", QVariant("udp"));
388 ui.protocolCombo->addItem("UDP/RTP (multicast)", QVariant("udp"));
391 NetOpenPanel::~NetOpenPanel()
394 void NetOpenPanel::clear()
397 void NetOpenPanel::updateProtocol( int idx ) {
398 QString addr = ui.addressText->text();
399 QString proto = ui.protocolCombo->itemData( idx ).toString();
401 ui.timeShift->setEnabled( idx >= 4 );
402 ui.ipv6->setEnabled( idx == 4 );
403 ui.addressText->setEnabled( idx != 4 );
404 ui.portSpin->setEnabled( idx >= 4 );
406 /* If we already have a protocol in the address, replace it */
407 if( addr.contains( "://")) {
408 msg_Err( p_intf, "replace");
409 addr.replace( QRegExp("^.*://"), proto + "://");
410 ui.addressText->setText( addr );
416 void NetOpenPanel::updateAddress() {
420 void NetOpenPanel::updateMRL() {
422 QString addr = ui.addressText->text();
423 int proto = ui.protocolCombo->currentIndex();
425 if( addr.contains( "://") && proto != 4 ) {
431 mrl = "http://" + addr;
432 emit methodChanged("http-caching");
435 mrl = "mms://" + addr;
436 emit methodChanged("mms-caching");
439 mrl = "ftp://" + addr;
440 emit methodChanged("ftp-caching");
443 mrl = "rtsp://" + addr;
444 emit methodChanged("rtsp-caching");
448 if( ui.ipv6->isEnabled() && ui.ipv6->isChecked() ) {
451 mrl += QString(":%1").arg( ui.portSpin->value() );
452 emit methodChanged("udp-caching");
454 case 6: /* UDP multicast */
457 if ( addr.contains(':') && !addr.contains('[') ) {
458 mrl += "[" + addr + "]";
460 mrl += QString(":%1").arg( ui.portSpin->value() );
461 emit methodChanged("udp-caching");
464 if( ui.timeShift->isEnabled() && ui.timeShift->isChecked() ) {
465 mrl += " :access-filter=timeshift";
467 emit mrlUpdated( mrl );
470 /**************************************************************************
472 **************************************************************************/
473 CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
474 OpenPanel( _parent, _p_intf )
478 QStackedLayout *stackedDevLayout = new QStackedLayout;
479 ui.cardBox->setLayout( stackedDevLayout );
481 QStackedLayout *stackedPropLayout = new QStackedLayout;
482 ui.optionsBox->setLayout( stackedPropLayout );
484 #define addModuleAndLayouts( number, name, label ) \
485 QWidget * name ## DevPage = new QWidget( this ); \
486 QWidget * name ## PropPage = new QWidget( this ); \
487 stackedDevLayout->addWidget( name ## DevPage ); \
488 stackedPropLayout->addWidget( name ## PropPage ); \
489 QGridLayout * name ## DevLayout = new QGridLayout; \
490 QGridLayout * name ## PropLayout = new QGridLayout; \
491 name ## DevPage->setLayout( name ## DevLayout ); \
492 name ## PropPage->setLayout( name ## PropLayout ); \
493 ui.deviceCombo->addItem( qtr( label ), QVariant( number ) );
495 #define CuMRL( widget, slot ) CONNECT( widget , slot , this, updateMRL() );
497 #define setMaxBound( spinbox ) spinbox->setRange ( 0, INT_MAX );
503 addModuleAndLayouts( V4L_DEVICE, v4l, "Video for Linux" );
504 QLabel *v4lVideoDeviceLabel = new QLabel( qtr( "Video device name" ) );
505 v4lDevLayout->addWidget( v4lVideoDeviceLabel, 0, 0 );
506 v4lVideoDevice = new QLineEdit;
507 v4lDevLayout->addWidget( v4lVideoDevice, 0, 1 );
508 QLabel *v4lAudioDeviceLabel = new QLabel( qtr( "Audio device name" ) );
509 v4lDevLayout->addWidget( v4lAudioDeviceLabel, 1, 0 );
510 v4lAudioDevice = new QLineEdit;
511 v4lDevLayout->addWidget( v4lAudioDevice, 1, 1 );
514 v4lNormBox = new QComboBox;
515 v4lNormBox->insertItem( 3, qtr( "Automatic" ) );
516 v4lNormBox->insertItem( 0, "SECAM" );
517 v4lNormBox->insertItem( 1, "NTSC" );
518 v4lNormBox->insertItem( 2, "PAL" );
520 v4lFreq = new QSpinBox;
521 v4lFreq->setAlignment( Qt::AlignRight );
522 v4lFreq->setSuffix(" kHz");
524 QLabel *v4lNormLabel = new QLabel( qtr( "Norm" ) );
525 QLabel *v4lFreqLabel = new QLabel( qtr( "Frequency" ) );
527 v4lPropLayout->addWidget( v4lNormLabel, 0 , 0 );
528 v4lPropLayout->addWidget( v4lNormBox, 0 , 1 );
530 v4lPropLayout->addWidget( v4lFreqLabel, 1 , 0 );
531 v4lPropLayout->addWidget( v4lFreq, 1 , 1 );
534 CuMRL( v4lVideoDevice, textChanged( QString ) );
535 CuMRL( v4lAudioDevice, textChanged( QString ) );
536 CuMRL( v4lFreq, valueChanged ( int ) );
537 CuMRL( v4lNormBox, currentIndexChanged ( int ) );
542 addModuleAndLayouts( PVR_DEVICE, pvr, "PVR" );
545 QLabel *pvrDeviceLabel = new QLabel( qtr( "Device name" ) );
546 pvrDevLayout->addWidget( pvrDeviceLabel, 0, 0 );
547 pvrDevice = new QLineEdit;
548 pvrDevLayout->addWidget( pvrDevice, 0, 1 );
549 QLabel *pvrRadioDeviceLabel = new QLabel( qtr( "Radio device name" ) );
550 pvrDevLayout->addWidget( pvrRadioDeviceLabel, 1, 0 );
551 pvrRadioDevice = new QLineEdit;
552 pvrDevLayout->addWidget( pvrRadioDevice, 1, 1 );
555 pvrNormBox = new QComboBox;
556 pvrNormBox->insertItem( 3, qtr( "Automatic" ) );
557 pvrNormBox->insertItem( 0, "SECAM" );
558 pvrNormBox->insertItem( 1, "NTSC" );
559 pvrNormBox->insertItem( 2, "PAL" );
561 pvrFreq = new QSpinBox;
562 pvrFreq->setAlignment( Qt::AlignRight );
563 pvrFreq->setSuffix(" kHz");
564 setMaxBound( pvrFreq );
565 pvrBitr = new QSpinBox;
566 pvrBitr->setAlignment( Qt::AlignRight );
567 pvrBitr->setSuffix(" kHz");
568 setMaxBound( pvrBitr );
569 QLabel *pvrNormLabel = new QLabel( qtr( "Norm" ) );
570 QLabel *pvrFreqLabel = new QLabel( qtr( "Frequency" ) );
571 QLabel *pvrBitrLabel = new QLabel( qtr( "Bitrate" ) );
573 pvrPropLayout->addWidget( pvrNormLabel, 0, 0 );
574 pvrPropLayout->addWidget( pvrNormBox, 0, 1 );
576 pvrPropLayout->addWidget( pvrFreqLabel, 1, 0 );
577 pvrPropLayout->addWidget( pvrFreq, 1, 1 );
579 pvrPropLayout->addWidget( pvrBitrLabel, 2, 0 );
580 pvrPropLayout->addWidget( pvrBitr, 2, 1 );
583 CuMRL( pvrDevice, textChanged( QString ) );
584 CuMRL( pvrRadioDevice, textChanged( QString ) );
586 CuMRL( pvrFreq, valueChanged ( int ) );
587 CuMRL( pvrBitr, valueChanged ( int ) );
588 CuMRL( pvrNormBox, currentIndexChanged ( int ) );
590 /*********************
591 * DirectShow Stuffs *
592 *********************/
593 addModuleAndLayouts( DSHOW_DEVICE, dshow, "DirectShow" );
599 addModuleAndLayouts( BDA_DEVICE, bda, "DVB DirectShow" );
602 QLabel *bdaDeviceLabel = new QLabel( qtr( "Adapter card to tune" ) );
603 QLabel *bdaTypeLabel = new QLabel( qtr( "DVB Type:" ) );
605 bdaCard = new QSpinBox;
606 bdaCard->setAlignment( Qt::AlignRight );
608 bdaDevLayout->addWidget( bdaDeviceLabel, 0, 0 );
609 bdaDevLayout->addWidget( bdaCard, 0, 2, 1, 2 );
611 bdas = new QRadioButton( "DVB-S" );
612 bdas->setChecked( true );
613 bdac = new QRadioButton( "DVB-C" );
614 bdat = new QRadioButton( "DVB-T" );
616 bdaDevLayout->addWidget( bdaTypeLabel, 1, 0 );
617 bdaDevLayout->addWidget( bdas, 1, 1 );
618 bdaDevLayout->addWidget( bdac, 1, 2 );
619 bdaDevLayout->addWidget( bdat, 1, 3 );
622 QLabel *bdaFreqLabel =
623 new QLabel( qtr( "Transponder/multiplex frequency" ) );
624 bdaFreq = new QSpinBox;
625 bdaFreq->setAlignment( Qt::AlignRight );
626 bdaFreq->setSuffix(" kHz");
627 setMaxBound( bdaFreq )
628 bdaPropLayout->addWidget( bdaFreqLabel, 0, 0 );
629 bdaPropLayout->addWidget( bdaFreq, 0, 1 );
631 bdaSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
632 bdaSrate = new QSpinBox;
633 bdaSrate->setAlignment( Qt::AlignRight );
634 bdaSrate->setSuffix(" kHz");
635 setMaxBound( bdaSrate );
636 bdaPropLayout->addWidget( bdaSrateLabel, 1, 0 );
637 bdaPropLayout->addWidget( bdaSrate, 1, 1 );
640 CuMRL( bdaCard, valueChanged ( int ) );
641 CuMRL( bdaFreq, valueChanged ( int ) );
642 CuMRL( bdaSrate, valueChanged ( int ) );
643 BUTTONACT( bdas, updateButtons() );
644 BUTTONACT( bdat, updateButtons() );
645 BUTTONACT( bdac, updateButtons() );
646 BUTTONACT( bdas, updateMRL() );
647 BUTTONACT( bdat, updateMRL() );
648 BUTTONACT( bdac, updateMRL() );
653 addModuleAndLayouts( DVB_DEVICE, dvb, "DVB" );
656 QLabel *dvbDeviceLabel = new QLabel( qtr( "Adapter card to tune" ) );
657 QLabel *dvbTypeLabel = new QLabel( qtr( "DVB Type:" ) );
659 dvbCard = new QSpinBox;
660 dvbCard->setAlignment( Qt::AlignRight );
661 dvbCard->setPrefix( "/dev/dvb/adapter" );
663 dvbDevLayout->addWidget( dvbDeviceLabel, 0, 0 );
664 dvbDevLayout->addWidget( dvbCard, 0, 2, 1, 2 );
666 dvbs = new QRadioButton( "DVB-S" );
667 dvbs->setChecked( true );
668 dvbc = new QRadioButton( "DVB-C" );
669 dvbt = new QRadioButton( "DVB-T" );
671 dvbDevLayout->addWidget( dvbTypeLabel, 1, 0 );
672 dvbDevLayout->addWidget( dvbs, 1, 1 );
673 dvbDevLayout->addWidget( dvbc, 1, 2 );
674 dvbDevLayout->addWidget( dvbt, 1, 3 );
677 QLabel *dvbFreqLabel =
678 new QLabel( qtr( "Transponder/multiplex frequency" ) );
679 dvbFreq = new QSpinBox;
680 dvbFreq->setAlignment( Qt::AlignRight );
681 dvbFreq->setSuffix(" kHz");
682 setMaxBound( dvbFreq );
683 dvbPropLayout->addWidget( dvbFreqLabel, 0, 0 );
684 dvbPropLayout->addWidget( dvbFreq, 0, 1 );
686 QLabel *dvbSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
687 dvbSrate = new QSpinBox;
688 dvbSrate->setAlignment( Qt::AlignRight );
689 dvbSrate->setSuffix(" kHz");
690 setMaxBound( dvbSrate );
691 dvbPropLayout->addWidget( dvbSrateLabel, 1, 0 );
692 dvbPropLayout->addWidget( dvbSrate, 1, 1 );
695 CuMRL( dvbCard, valueChanged ( int ) );
696 CuMRL( dvbFreq, valueChanged ( int ) );
697 CuMRL( dvbSrate, valueChanged ( int ) );
698 BUTTONACT( dvbs, updateButtons() );
699 BUTTONACT( dvbt, updateButtons() );
700 BUTTONACT( dvbc, updateButtons() );
702 /* General connects */
703 connect( ui.deviceCombo, SIGNAL( activated( int ) ),
704 stackedDevLayout, SLOT( setCurrentIndex( int ) ) );
705 connect( ui.deviceCombo, SIGNAL( activated( int ) ),
706 stackedPropLayout, SLOT( setCurrentIndex( int ) ) );
707 CONNECT( ui.deviceCombo, activated( int ), this, updateMRL() );
712 CaptureOpenPanel::~CaptureOpenPanel()
715 void CaptureOpenPanel::clear()
718 void CaptureOpenPanel::updateMRL()
721 int i_devicetype = ui.deviceCombo->itemData(
722 ui.deviceCombo->currentIndex() ).toInt();
723 msg_Dbg( p_intf, "Capture Type: %i", i_devicetype );
724 switch( i_devicetype )
728 mrl += " :v4l-vdev=" + v4lVideoDevice->text();
729 mrl += " :v4l-adev=" + v4lAudioDevice->text();
730 mrl += " :v4l-norm=" + QString("%1").arg( v4lNormBox->currentIndex() );
731 mrl += " :v4l-frequency=" + QString("%1").arg( v4lFreq->value() );
735 mrl += " :pvr-device=" + pvrDevice->text();
736 mrl += " :pvr-radio-device=" + pvrRadioDevice->text();
737 mrl += " :pvr-norm=" + QString("%1").arg( pvrNormBox->currentIndex() );
738 if( pvrFreq->value() )
739 mrl += " :pvr-frequency=" + QString("%1").arg( pvrFreq->value() );
740 if( pvrBitr->value() )
741 mrl += " :pvr-bitrate=" + QString("%1").arg( pvrBitr->value() );
745 mrl += " :dvb-adapter=" + QString("%1").arg( dvbCard->value() );
746 mrl += " :dvb-frequency=" + QString("%1").arg( dvbFreq->value() );
747 mrl += " :dvb-srate=" + QString("%1").arg( dvbSrate->value() );
750 if( bdas->isChecked() ) mrl = "dvb-s://";
751 else if( bdat->isChecked() ) mrl = "dvb-t://";
752 else if( bdac->isChecked() ) mrl = "dvb-c://";
754 mrl += " :dvb-adapter=" + QString("%1").arg( bdaCard->value() );
755 mrl += " :dvb-frequency=" + QString("%1").arg( bdaFreq->value() );
756 mrl += " :dvb-srate=" + QString("%1").arg( bdaSrate->value() );
762 emit mrlUpdated( mrl );
765 void CaptureOpenPanel::updateButtons()
767 int i_devicetype = ui.deviceCombo->itemData(
768 ui.deviceCombo->currentIndex() ).toInt();
769 msg_Dbg( p_intf, "Capture Type: %i", i_devicetype );
770 switch( i_devicetype )
773 if( dvbs->isChecked() ) dvbFreq->setSuffix(" kHz");
774 if( dvbc->isChecked() || dvbt->isChecked() ) dvbFreq->setSuffix(" Hz");
777 if( bdas->isChecked() ) bdaFreq->setSuffix(" kHz");
778 if( bdac->isChecked() || bdat->isChecked() ) bdaFreq->setSuffix(" Hz");
779 if( bdas->isChecked() || bdac->isChecked() )
782 bdaSrateLabel->show();
787 bdaSrateLabel->hide();