1 /*****************************************************************************
2 * open.cpp : Panels for the open dialogs
3 ****************************************************************************
4 * Copyright (C) 2006-2007 the VideoLAN team
5 * Copyright (C) 2007 Société des arts technologiques
6 * Copyright (C) 2007 Savoir-faire Linux
9 * Authors: Clément Stenac <zorglub@videolan.org>
10 * Jean-Baptiste Kempf <jb@videolan.org>
11 * Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
26 *****************************************************************************/
30 #include "components/open.hpp"
31 #include "dialogs/open.hpp"
32 #include "dialogs_provider.hpp"
33 #include "util/customwidgets.hpp"
35 #include <QFileDialog>
36 #include <QDialogButtonBox>
38 #include <QStackedLayout>
41 /**************************************************************************
42 * Open Files and subtitles *
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 );
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( qfu( 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.
95 lineFileEdit = findChildren<QLineEdit*>()[2];
97 lineFileEdit = findChildren<QLineEdit*>()[3];
99 // lineFileEdit->hide();
101 /* Make a list of QLabel inside the QFileDialog to access the good ones */
102 QList<QLabel *> listLabel = findChildren<QLabel*>();
104 /* Hide the FileNames one. Enable it for debug */
105 listLabel[4]->hide();
106 /* Change the text that was uncool in the usual box */
107 listLabel[5]->setText( qtr( "Filter:" ) );
110 QListView *fileListView = findChildren<QListView*>().first();
112 /* QFileDialog is quite buggy make it brerable on win32 by tweaking
114 fileListView->setLayoutMode(QListView::Batched);
115 fileListView->setViewMode(QListView::ListMode);
116 fileListView->setResizeMode(QListView::Adjust);
117 fileListView->setUniformItemSizes(false);
118 fileListView->setFlow(QListView::TopToBottom);
119 fileListView->setWrapping(true);
122 // Hide the subtitles control by default.
125 /* Build the subs size combo box */
126 setfillVLCConfigCombo( "freetype-rel-fontsize" , p_intf,
127 ui.sizeSubComboBox );
129 /* Build the subs align combo box */
130 setfillVLCConfigCombo( "subsdec-align", p_intf, ui.alignSubComboBox );
133 BUTTONACT( ui.subBrowseButton, browseFileSub() );
134 BUTTONACT( ui.subCheckBox, toggleSubtitleFrame());
137 CONNECT( fileListView, clicked( QModelIndex ), this, updateMRL() );
139 CONNECT( ui.fileInput, editTextChanged( QString ), this, updateMRL() );
141 CONNECT( ui.subInput, editTextChanged( QString ), this, updateMRL() );
142 CONNECT( ui.alignSubComboBox, currentIndexChanged( int ), this,
144 CONNECT( ui.sizeSubComboBox, currentIndexChanged( int ), this,
147 CONNECT( lineFileEdit, textChanged( QString ), this, browseFile() );
150 FileOpenPanel::~FileOpenPanel()
153 QStringList FileOpenPanel::browse( QString help )
155 return THEDP->showSimpleOpen( help );
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 msg_Dbg( p_intf, "I was here" );
182 QString mrl = ui.fileInput->currentText();
184 if( ui.subCheckBox->isChecked() ) {
185 mrl.append( " :sub-file=" + ui.subInput->currentText() );
186 int align = ui.alignSubComboBox->itemData(
187 ui.alignSubComboBox->currentIndex() ).toInt();
188 mrl.append( " :subsdec-align=" + QString().setNum( align ) );
189 int size = ui.sizeSubComboBox->itemData(
190 ui.sizeSubComboBox->currentIndex() ).toInt();
191 mrl.append( " :freetype-rel-fontsize=" + QString().setNum( size ) );
194 const char *psz_filepath = config_GetPsz( p_intf, "qt-filedialog-path" );
195 if( ( NULL == psz_filepath )
196 || strcmp( psz_filepath, qtu( dialogBox->directory().absolutePath() )) )
198 /* set dialog box current directory as last known path */
199 config_PutPsz( p_intf, "qt-filedialog-path",
200 qtu( dialogBox->directory().absolutePath() ) );
204 emit mrlUpdated( mrl );
205 emit methodChanged( "file-caching" );
209 /* Function called by Open Dialog when clicke on Play/Enqueue */
210 void FileOpenPanel::accept()
212 ui.fileInput->addItem( ui.fileInput->currentText());
213 if ( ui.fileInput->count() > 8 ) ui.fileInput->removeItem( 0 );
216 void FileOpenBox::accept()
218 OpenDialog::getInstance( NULL, NULL )->play();
221 /* Function called by Open Dialog when clicked on cancel */
222 void FileOpenPanel::clear()
224 ui.fileInput->setEditText( "" );
225 ui.subInput->setEditText( "" );
228 void FileOpenPanel::toggleSubtitleFrame()
230 if ( ui.subFrame->isVisible() )
245 /**************************************************************************
246 * Open Discs ( DVD, CD, VCD and similar devices ) *
247 **************************************************************************/
248 DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
249 OpenPanel( _parent, _p_intf )
253 #if WIN32 /* Disc drives probing for Windows */
256 if( GetLogicalDriveStringsA( sizeof( szDrives ) - 1, szDrives ) )
258 char *drive = szDrives;
259 UINT oldMode = SetErrorMode( SEM_FAILCRITICALERRORS );
262 if( GetDriveTypeA(drive) == DRIVE_CDROM )
263 ui.deviceCombo->addItem( drive );
265 /* go to next drive */
268 SetErrorMode(oldMode);
270 #endif /* Disc Probing under Windows */
273 BUTTONACT( ui.dvdRadioButton, updateButtons());
274 BUTTONACT( ui.vcdRadioButton, updateButtons());
275 BUTTONACT( ui.audioCDRadioButton, updateButtons());
276 BUTTONACT( ui.dvdsimple, updateButtons());
278 CONNECT( ui.deviceCombo, editTextChanged( QString ), this, updateMRL());
279 CONNECT( ui.titleSpin, valueChanged( int ), this, updateMRL());
280 CONNECT( ui.chapterSpin, valueChanged( int ), this, updateMRL());
281 CONNECT( ui.audioSpin, valueChanged( int ), this, updateMRL());
282 CONNECT( ui.subtitlesSpin, valueChanged( int ), this, updateMRL());
285 DiscOpenPanel::~DiscOpenPanel()
288 void DiscOpenPanel::clear()
290 ui.titleSpin->setValue( 0 );
291 ui.chapterSpin->setValue( 0 );
294 void DiscOpenPanel::updateButtons()
296 if ( ui.dvdRadioButton->isChecked() )
298 ui.titleLabel->setText( qtr("Title") );
299 ui.chapterLabel->show();
300 ui.chapterSpin->show();
301 ui.diskOptionBox_2->show();
303 else if ( ui.vcdRadioButton->isChecked() )
305 ui.titleLabel->setText( qtr("Entry") );
306 ui.chapterLabel->hide();
307 ui.chapterSpin->hide();
308 ui.diskOptionBox_2->show();
312 ui.titleLabel->setText( qtr("Track") );
313 ui.chapterLabel->hide();
314 ui.chapterSpin->hide();
315 ui.diskOptionBox_2->hide();
322 void DiscOpenPanel::updateMRL()
326 /* CDDAX and VCDX not implemented. FIXME ? */
328 if( ui.dvdRadioButton->isChecked() ) {
329 if( !ui.dvdsimple->isChecked() )
332 mrl = "dvdsimple://";
333 mrl += ui.deviceCombo->currentText();
334 emit methodChanged( "dvdnav-caching" );
336 if ( ui.titleSpin->value() > 0 ) {
337 mrl += QString("@%1").arg( ui.titleSpin->value() );
338 if ( ui.chapterSpin->value() > 0 ) {
339 mrl+= QString(":%1").arg( ui.chapterSpin->value() );
344 } else if ( ui.vcdRadioButton->isChecked() ) {
345 mrl = "vcd://" + ui.deviceCombo->currentText();
346 emit methodChanged( "vcd-caching" );
348 if( ui.titleSpin->value() > 0 ) {
349 mrl += QString("@E%1").arg( ui.titleSpin->value() );
354 mrl = "cdda://" + ui.deviceCombo->currentText();
355 if( ui.titleSpin->value() > 0 ) {
356 QString("@%1").arg( ui.titleSpin->value() );
360 if ( ui.dvdRadioButton->isChecked() || ui.vcdRadioButton->isChecked() )
362 if ( ui.audioSpin->value() >= 0 ) {
363 mrl += " :audio-track=" +
364 QString("%1").arg( ui.audioSpin->value() );
366 if ( ui.subtitlesSpin->value() >= 0 ) {
367 mrl += " :sub-track=" +
368 QString("%1").arg( ui.subtitlesSpin->value() );
371 emit mrlUpdated( mrl );
375 /**************************************************************************
376 * Open Network streams and URL pages *
377 **************************************************************************/
378 NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
379 OpenPanel( _parent, _p_intf )
384 CONNECT( ui.protocolCombo, currentIndexChanged( int ),
385 this, updateProtocol( int ) );
386 CONNECT( ui.portSpin, valueChanged( int ), this, updateMRL() );
387 CONNECT( ui.addressText, textChanged( QString ), this, updateAddress());
388 CONNECT( ui.timeShift, clicked(), this, updateMRL());
389 CONNECT( ui.ipv6, clicked(), this, updateMRL());
391 ui.protocolCombo->addItem("HTTP", QVariant("http"));
392 ui.protocolCombo->addItem("HTTPS", QVariant("https"));
393 ui.protocolCombo->addItem("FTP", QVariant("ftp"));
394 ui.protocolCombo->addItem("MMS", QVariant("mms"));
395 ui.protocolCombo->addItem("RTSP", QVariant("rtsp"));
396 ui.protocolCombo->addItem("UDP/RTP (unicast)", QVariant("udp"));
397 ui.protocolCombo->addItem("UDP/RTP (multicast)", QVariant("udp"));
400 NetOpenPanel::~NetOpenPanel()
403 void NetOpenPanel::clear()
406 void NetOpenPanel::updateProtocol( int idx ) {
407 QString addr = ui.addressText->text();
408 QString proto = ui.protocolCombo->itemData( idx ).toString();
410 ui.timeShift->setEnabled( idx >= 5 );
411 ui.ipv6->setEnabled( idx == 5 );
412 ui.addressText->setEnabled( idx != 5 );
413 ui.portSpin->setEnabled( idx >= 5 );
415 /* If we already have a protocol in the address, replace it */
416 if( addr.contains( "://")) {
417 msg_Err( p_intf, "replace");
418 addr.replace( QRegExp("^.*://"), proto + "://");
419 ui.addressText->setText( addr );
424 void NetOpenPanel::updateAddress() {
428 void NetOpenPanel::updateMRL() {
430 QString addr = ui.addressText->text();
431 int proto = ui.protocolCombo->currentIndex();
433 if( addr.contains( "://") && proto != 5 ) {
438 mrl = "http://" + addr;
440 mrl = "https://" + addr;
441 emit methodChanged("http-caching");
444 mrl = "mms://" + addr;
445 emit methodChanged("mms-caching");
448 mrl = "ftp://" + addr;
449 emit methodChanged("ftp-caching");
452 mrl = "rtsp://" + addr;
453 emit methodChanged("rtsp-caching");
457 if( ui.ipv6->isEnabled() && ui.ipv6->isChecked() ) {
460 mrl += QString(":%1").arg( ui.portSpin->value() );
461 emit methodChanged("udp-caching");
463 case 6: /* UDP multicast */
466 if ( addr.contains(':') && !addr.contains('[') ) {
467 mrl += "[" + addr + "]";
469 mrl += QString(":%1").arg( ui.portSpin->value() );
470 emit methodChanged("udp-caching");
473 if( ui.timeShift->isEnabled() && ui.timeShift->isChecked() ) {
474 mrl += " :access-filter=timeshift";
476 emit mrlUpdated( mrl );
479 /**************************************************************************
480 * Open Capture device ( DVB, PVR, V4L, and similar ) *
481 **************************************************************************/
482 CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
483 OpenPanel( _parent, _p_intf )
487 /* Create two stacked layouts in the main comboBoxes */
488 QStackedLayout *stackedDevLayout = new QStackedLayout;
489 ui.cardBox->setLayout( stackedDevLayout );
491 QStackedLayout *stackedPropLayout = new QStackedLayout;
492 ui.optionsBox->setLayout( stackedPropLayout );
494 /* Creation and connections of the WIdgets in the stacked layout */
495 #define addModuleAndLayouts( number, name, label ) \
496 QWidget * name ## DevPage = new QWidget( this ); \
497 QWidget * name ## PropPage = new QWidget( this ); \
498 stackedDevLayout->addWidget( name ## DevPage ); \
499 stackedPropLayout->addWidget( name ## PropPage ); \
500 QGridLayout * name ## DevLayout = new QGridLayout; \
501 QGridLayout * name ## PropLayout = new QGridLayout; \
502 name ## DevPage->setLayout( name ## DevLayout ); \
503 name ## PropPage->setLayout( name ## PropLayout ); \
504 ui.deviceCombo->addItem( qtr( label ), QVariant( number ) );
506 #define CuMRL( widget, slot ) CONNECT( widget , slot , this, updateMRL() );
511 addModuleAndLayouts( V4L_DEVICE, v4l, "Video for Linux" );
514 QLabel *v4lVideoDeviceLabel = new QLabel( qtr( "Video device name" ) );
515 v4lDevLayout->addWidget( v4lVideoDeviceLabel, 0, 0 );
517 v4lVideoDevice = new QLineEdit;
518 v4lDevLayout->addWidget( v4lVideoDevice, 0, 1 );
520 QLabel *v4lAudioDeviceLabel = new QLabel( qtr( "Audio device name" ) );
521 v4lDevLayout->addWidget( v4lAudioDeviceLabel, 1, 0 );
523 v4lAudioDevice = new QLineEdit;
524 v4lDevLayout->addWidget( v4lAudioDevice, 1, 1 );
526 /* V4l Props panel */
527 QLabel *v4lNormLabel = new QLabel( qtr( "Norm" ) );
528 v4lPropLayout->addWidget( v4lNormLabel, 0 , 0 );
530 v4lNormBox = new QComboBox;
531 setfillVLCConfigCombo( "v4l-norm", p_intf, v4lNormBox );
532 v4lPropLayout->addWidget( v4lNormBox, 0 , 1 );
534 QLabel *v4lFreqLabel = new QLabel( qtr( "Frequency" ) );
535 v4lPropLayout->addWidget( v4lFreqLabel, 1 , 0 );
537 v4lFreq = new QSpinBox;
538 v4lFreq->setAlignment( Qt::AlignRight );
539 v4lFreq->setSuffix(" kHz");
540 setSpinBoxFreq( v4lFreq );
541 v4lPropLayout->addWidget( v4lFreq, 1 , 1 );
544 CuMRL( v4lVideoDevice, textChanged( QString ) );
545 CuMRL( v4lAudioDevice, textChanged( QString ) );
546 CuMRL( v4lFreq, valueChanged ( int ) );
547 CuMRL( v4lNormBox, currentIndexChanged ( int ) );
552 addModuleAndLayouts( JACK_DEVICE, jack, "JACK Audio Connection Kit" );
554 /* Jack Main panel */
556 QLabel *jackChannelsLabel = new QLabel( qtr( "Channels :" ) );
557 jackDevLayout->addWidget( jackChannelsLabel, 1, 0 );
559 jackChannels = new QSpinBox;
560 setSpinBoxFreq( jackChannels );
561 jackChannels->setMaximum(255);
562 jackChannels->setValue(2);
563 jackChannels->setAlignment( Qt::AlignRight );
564 jackDevLayout->addWidget( jackChannels, 1, 1 );
566 /* Jack Props panel */
569 QLabel *jackPortsLabel = new QLabel( qtr( "Selected ports :" ) );
570 jackPropLayout->addWidget( jackPortsLabel, 0 , 0 );
572 jackPortsSelected = new QLineEdit( qtr( ".*") );
573 jackPortsSelected->setAlignment( Qt::AlignRight );
574 jackPropLayout->addWidget( jackPortsSelected, 0, 1 );
577 QLabel *jackCachingLabel = new QLabel( qtr( "Input caching :" ) );
578 jackPropLayout->addWidget( jackCachingLabel, 1 , 0 );
579 jackCaching = new QSpinBox;
580 setSpinBoxFreq( jackCaching );
581 jackCaching->setSuffix( " ms" );
582 jackCaching->setValue(1000);
583 jackCaching->setAlignment( Qt::AlignRight );
584 jackPropLayout->addWidget( jackCaching, 1 , 1 );
587 jackPace = new QCheckBox(qtr( "Use VLC pace" ));
588 jackPropLayout->addWidget( jackPace, 2, 1 );
591 jackConnect = new QCheckBox( qtr( "Auto connnection" ));
592 jackPropLayout->addWidget( jackConnect, 3, 1 );
595 CuMRL( jackChannels, valueChanged( int ) );
596 CuMRL( jackCaching, valueChanged( int ) );
597 CuMRL( jackPace, stateChanged( int ) );
598 CuMRL( jackConnect, stateChanged( int ) );
599 CuMRL( jackPortsSelected, textChanged( QString ) );
604 addModuleAndLayouts( PVR_DEVICE, pvr, "PVR" );
607 QLabel *pvrDeviceLabel = new QLabel( qtr( "Device name" ) );
608 pvrDevLayout->addWidget( pvrDeviceLabel, 0, 0 );
610 pvrDevice = new QLineEdit;
611 pvrDevLayout->addWidget( pvrDevice, 0, 1 );
613 QLabel *pvrRadioDeviceLabel = new QLabel( qtr( "Radio device name" ) );
614 pvrDevLayout->addWidget( pvrRadioDeviceLabel, 1, 0 );
616 pvrRadioDevice = new QLineEdit;
617 pvrDevLayout->addWidget( pvrRadioDevice, 1, 1 );
619 /* PVR props panel */
620 QLabel *pvrNormLabel = new QLabel( qtr( "Norm" ) );
621 pvrPropLayout->addWidget( pvrNormLabel, 0, 0 );
623 pvrNormBox = new QComboBox;
624 setfillVLCConfigCombo( "pvr-norm", p_intf, pvrNormBox );
625 pvrPropLayout->addWidget( pvrNormBox, 0, 1 );
627 QLabel *pvrFreqLabel = new QLabel( qtr( "Frequency" ) );
628 pvrPropLayout->addWidget( pvrFreqLabel, 1, 0 );
630 pvrFreq = new QSpinBox;
631 pvrFreq->setAlignment( Qt::AlignRight );
632 pvrFreq->setSuffix(" kHz");
633 setSpinBoxFreq( pvrFreq );
634 pvrPropLayout->addWidget( pvrFreq, 1, 1 );
636 QLabel *pvrBitrLabel = new QLabel( qtr( "Bitrate" ) );
637 pvrPropLayout->addWidget( pvrBitrLabel, 2, 0 );
639 pvrBitr = new QSpinBox;
640 pvrBitr->setAlignment( Qt::AlignRight );
641 pvrBitr->setSuffix(" kHz");
642 setSpinBoxFreq( pvrBitr );
643 pvrPropLayout->addWidget( pvrBitr, 2, 1 );
646 CuMRL( pvrDevice, textChanged( QString ) );
647 CuMRL( pvrRadioDevice, textChanged( QString ) );
649 CuMRL( pvrFreq, valueChanged ( int ) );
650 CuMRL( pvrBitr, valueChanged ( int ) );
651 CuMRL( pvrNormBox, currentIndexChanged ( int ) );
653 /*********************
654 * DirectShow Stuffs *
655 *********************/
656 addModuleAndLayouts( DSHOW_DEVICE, dshow, "DirectShow" );
660 QLabel *dshowVDeviceLabel = new QLabel( qtr( "Video Device Name " ) );
661 dshowDevLayout->addWidget( dshowVDeviceLabel, 0, 0 );
663 QLabel *dshowADeviceLabel = new QLabel( qtr( "Audio Device Name " ) );
664 dshowDevLayout->addWidget( dshowADeviceLabel, 1, 0 );
666 QComboBox *dshowVDevice = new QComboBox;
667 dshowDevLayout->addWidget( dshowVDevice, 0, 1 );
669 QComboBox *dshowADevice = new QComboBox;
670 dshowDevLayout->addWidget( dshowADevice, 1, 1 );
672 QPushButton *dshowVRefresh = new QPushButton( qtr( "Update List" ) );
673 dshowDevLayout->addWidget( dshowVRefresh, 0, 2 );
675 QPushButton *dshowARefresh = new QPushButton( qtr( "Update List" ) );
676 dshowDevLayout->addWidget( dshowARefresh, 1, 2 );
678 QPushButton *dshowVConfig = new QPushButton( qtr( "Configure" ) );
679 dshowDevLayout->addWidget( dshowVConfig, 0, 3 );
681 QPushButton *dshowAConfig = new QPushButton( qtr( "Configure" ) );
682 dshowDevLayout->addWidget( dshowAConfig, 1, 3 );
684 /* dshow Properties */
686 QLabel *dshowVSizeLabel = new QLabel( qtr( "Video size" ) );
687 dshowPropLayout->addWidget( dshowVSizeLabel, 0, 0 );
689 QLineEdit *dshowVSizeLine = new QLineEdit;
690 dshowPropLayout->addWidget( dshowVSizeLine, 0, 1);
693 CuMRL( dshowVDevice, currentIndexChanged ( int ) );
694 CuMRL( dshowADevice, currentIndexChanged ( int ) );
695 CuMRL( dshowVSizeLine, textChanged( QString ) );
700 addModuleAndLayouts( BDA_DEVICE, bda, "DVB DirectShow" );
703 QLabel *bdaTypeLabel = new QLabel( qtr( "DVB Type:" ) );
705 bdas = new QRadioButton( "DVB-S" );
706 bdas->setChecked( true );
707 bdac = new QRadioButton( "DVB-C" );
708 bdat = new QRadioButton( "DVB-T" );
710 bdaDevLayout->addWidget( bdaTypeLabel, 0, 0 );
711 bdaDevLayout->addWidget( bdas, 0, 1 );
712 bdaDevLayout->addWidget( bdac, 0, 2 );
713 bdaDevLayout->addWidget( bdat, 0, 3 );
716 QLabel *bdaFreqLabel =
717 new QLabel( qtr( "Transponder/multiplex frequency" ) );
718 bdaPropLayout->addWidget( bdaFreqLabel, 0, 0 );
720 bdaFreq = new QSpinBox;
721 bdaFreq->setAlignment( Qt::AlignRight );
722 bdaFreq->setSuffix(" kHz");
723 bdaFreq->setSingleStep( 1000 );
724 setSpinBoxFreq( bdaFreq )
725 bdaPropLayout->addWidget( bdaFreq, 0, 1 );
727 bdaSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
728 bdaPropLayout->addWidget( bdaSrateLabel, 1, 0 );
730 bdaSrate = new QSpinBox;
731 bdaSrate->setAlignment( Qt::AlignRight );
732 bdaSrate->setSuffix(" kHz");
733 setSpinBoxFreq( bdaSrate );
734 bdaPropLayout->addWidget( bdaSrate, 1, 1 );
736 bdaBandLabel = new QLabel( qtr( "Bandwidth" ) );
737 bdaPropLayout->addWidget( bdaBandLabel, 2, 0 );
739 bdaBandBox = new QComboBox;
740 setfillVLCConfigCombo( "dvb-bandwidth", p_intf, bdaBandBox );
741 bdaPropLayout->addWidget( bdaBandBox, 2, 1 );
743 bdaBandLabel->hide();
747 CuMRL( bdaFreq, valueChanged ( int ) );
748 CuMRL( bdaSrate, valueChanged ( int ) );
749 CuMRL( bdaBandBox, currentIndexChanged ( int ) );
750 BUTTONACT( bdas, updateButtons() );
751 BUTTONACT( bdat, updateButtons() );
752 BUTTONACT( bdac, updateButtons() );
753 BUTTONACT( bdas, updateMRL() );
754 BUTTONACT( bdat, updateMRL() );
755 BUTTONACT( bdac, updateMRL() );
760 addModuleAndLayouts( DVB_DEVICE, dvb, "DVB" );
763 QLabel *dvbDeviceLabel = new QLabel( qtr( "Adapter card to tune" ) );
764 QLabel *dvbTypeLabel = new QLabel( qtr( "DVB Type:" ) );
766 dvbCard = new QSpinBox;
767 dvbCard->setAlignment( Qt::AlignRight );
768 dvbCard->setPrefix( "/dev/dvb/adapter" );
770 dvbDevLayout->addWidget( dvbDeviceLabel, 0, 0 );
771 dvbDevLayout->addWidget( dvbCard, 0, 2, 1, 2 );
773 dvbs = new QRadioButton( "DVB-S" );
774 dvbs->setChecked( true );
775 dvbc = new QRadioButton( "DVB-C" );
776 dvbt = new QRadioButton( "DVB-T" );
778 dvbDevLayout->addWidget( dvbTypeLabel, 1, 0 );
779 dvbDevLayout->addWidget( dvbs, 1, 1 );
780 dvbDevLayout->addWidget( dvbc, 1, 2 );
781 dvbDevLayout->addWidget( dvbt, 1, 3 );
783 /* DVB Props panel */
784 QLabel *dvbFreqLabel =
785 new QLabel( qtr( "Transponder/multiplex frequency" ) );
786 dvbPropLayout->addWidget( dvbFreqLabel, 0, 0 );
788 dvbFreq = new QSpinBox;
789 dvbFreq->setAlignment( Qt::AlignRight );
790 dvbFreq->setSuffix(" kHz");
791 setSpinBoxFreq( dvbFreq );
792 dvbPropLayout->addWidget( dvbFreq, 0, 1 );
794 QLabel *dvbSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
795 dvbPropLayout->addWidget( dvbSrateLabel, 1, 0 );
797 dvbSrate = new QSpinBox;
798 dvbSrate->setAlignment( Qt::AlignRight );
799 dvbSrate->setSuffix(" kHz");
800 setSpinBoxFreq( dvbSrate );
801 dvbPropLayout->addWidget( dvbSrate, 1, 1 );
804 CuMRL( dvbCard, valueChanged ( int ) );
805 CuMRL( dvbFreq, valueChanged ( int ) );
806 CuMRL( dvbSrate, valueChanged ( int ) );
808 BUTTONACT( dvbs, updateButtons() );
809 BUTTONACT( dvbt, updateButtons() );
810 BUTTONACT( dvbc, updateButtons() );
815 addModuleAndLayouts( SCREEN_DEVICE, screen, "Desktop" );
816 QLabel *screenLabel = new QLabel( "This option will open your own "
817 "desktop in order to save or stream it.");
818 screenLabel->setWordWrap( true );
819 screenDevLayout->addWidget( screenLabel, 0, 0 );
821 /* General connects */
822 connect( ui.deviceCombo, SIGNAL( activated( int ) ),
823 stackedDevLayout, SLOT( setCurrentIndex( int ) ) );
824 connect( ui.deviceCombo, SIGNAL( activated( int ) ),
825 stackedPropLayout, SLOT( setCurrentIndex( int ) ) );
826 CONNECT( ui.deviceCombo, activated( int ), this, updateMRL() );
827 CONNECT( ui.deviceCombo, activated( int ), this, updateButtons() );
832 CaptureOpenPanel::~CaptureOpenPanel()
835 void CaptureOpenPanel::clear()
838 void CaptureOpenPanel::updateMRL()
841 int i_devicetype = ui.deviceCombo->itemData(
842 ui.deviceCombo->currentIndex() ).toInt();
843 switch( i_devicetype )
847 mrl += " :v4l-vdev=" + v4lVideoDevice->text();
848 mrl += " :v4l-adev=" + v4lAudioDevice->text();
849 mrl += " :v4l-norm=" + QString("%1").arg( v4lNormBox->currentIndex() );
850 mrl += " :v4l-frequency=" + QString("%1").arg( v4lFreq->value() );
854 mrl += "channels=" + QString("%1").arg( jackChannels->value() );
855 mrl += ":ports=" + jackPortsSelected->text();
856 mrl += " --jack-input-caching=" + QString("%1").arg( jackCaching->value() );
857 if ( jackPace->isChecked() )
859 mrl += " --jack-input-use-vlc-pace";
861 if ( jackConnect->isChecked() )
863 mrl += " --jack-input-auto-connect";
868 mrl += " :pvr-device=" + pvrDevice->text();
869 mrl += " :pvr-radio-device=" + pvrRadioDevice->text();
870 mrl += " :pvr-norm=" + QString("%1").arg( pvrNormBox->currentIndex() );
871 if( pvrFreq->value() )
872 mrl += " :pvr-frequency=" + QString("%1").arg( pvrFreq->value() );
873 if( pvrBitr->value() )
874 mrl += " :pvr-bitrate=" + QString("%1").arg( pvrBitr->value() );
878 mrl += " :dvb-adapter=" + QString("%1").arg( dvbCard->value() );
879 mrl += " :dvb-frequency=" + QString("%1").arg( dvbFreq->value() );
880 mrl += " :dvb-srate=" + QString("%1").arg( dvbSrate->value() );
883 if( bdas->isChecked() ) mrl = "dvb-s://";
884 else if( bdat->isChecked() ) mrl = "dvb-t://";
885 else if( bdac->isChecked() ) mrl = "dvb-c://";
887 mrl += " :dvb-frequency=" + QString("%1").arg( bdaFreq->value() );
888 if( bdas->isChecked() || bdac->isChecked() )
889 mrl += " :dvb-srate=" + QString("%1").arg( bdaSrate->value() );
891 mrl += " :dvb-bandwidth=" +
892 QString("%1").arg( bdaBandBox->itemData(
893 bdaBandBox->currentIndex() ).toInt() );
902 emit mrlUpdated( mrl );
906 * Update the Buttons (show/hide) for the GUI as all device type don't
907 * use the same ui. elements.
909 void CaptureOpenPanel::updateButtons()
911 /* Be sure to display the ui Elements in case they were hidden by
912 * some Device Type (like Screen://) */
913 ui.optionsBox->show();
914 ui.advancedButton->show();
915 /* Get the current Device Number */
916 int i_devicetype = ui.deviceCombo->itemData(
917 ui.deviceCombo->currentIndex() ).toInt();
918 msg_Dbg( p_intf, "Capture Type: %i", i_devicetype );
919 switch( i_devicetype )
922 if( dvbs->isChecked() ) dvbFreq->setSuffix(" kHz");
923 if( dvbc->isChecked() || dvbt->isChecked() ) dvbFreq->setSuffix(" Hz");
926 if( bdas->isChecked() || bdac->isChecked() )
929 bdaSrateLabel->show();
931 bdaBandLabel->hide();
936 bdaSrateLabel->hide();
938 bdaBandLabel->show();
942 ui.optionsBox->hide();
943 ui.advancedButton->hide();