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>
42 /**************************************************************************
43 * Open Files and subtitles *
44 **************************************************************************/
45 FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
46 OpenPanel( _parent, _p_intf )
48 /* Classic UI Setup */
51 /* Use a QFileDialog and customize it because we don't want to
52 rewrite it all. Be careful to your eyes cause there are a few hacks.
53 Be very careful and test correctly when you modify this. */
55 /* Set Filters for file selection */
56 QString fileTypes = "";
57 ADD_FILTER_MEDIA( fileTypes );
58 ADD_FILTER_VIDEO( fileTypes );
59 ADD_FILTER_AUDIO( fileTypes );
60 ADD_FILTER_PLAYLIST( fileTypes );
61 ADD_FILTER_ALL( fileTypes );
62 fileTypes.replace( QString(";*"), QString(" *"));
64 // Make this QFileDialog a child of tempWidget from the ui.
65 dialogBox = new FileOpenBox( ui.tempWidget, NULL,
66 qfu( p_intf->p_libvlc->psz_homedir ), fileTypes );
68 dialogBox->setFileMode( QFileDialog::ExistingFiles );
69 dialogBox->setAcceptMode( QFileDialog::AcceptOpen );
71 /* retrieve last known path used in file browsing */
72 char *psz_filepath = config_GetPsz( p_intf, "qt-filedialog-path" );
75 dialogBox->setDirectory( qfu( psz_filepath ) );
79 /* We don't want to see a grip in the middle of the window, do we? */
80 dialogBox->setSizeGripEnabled( false );
83 dialogBox->setToolTip( qtr( "Select one or multiple files, or a folder" ) );
85 // Add it to the layout
86 ui.gridLayout->addWidget( dialogBox, 0, 0, 1, 3 );
88 // But hide the two OK/Cancel buttons. Enable them for debug.
89 QDialogButtonBox *fileDialogAcceptBox =
90 findChildren<QDialogButtonBox*>()[0];
91 fileDialogAcceptBox->hide();
93 /* Ugly hacks to get the good Widget */
94 //This lineEdit is the normal line in the fileDialog.
96 lineFileEdit = findChildren<QLineEdit*>()[2];
98 lineFileEdit = findChildren<QLineEdit*>()[3];
101 QStringList fileCompleteList ;
102 QCompleter *fileCompleter = new QCompleter( fileCompleteList, this );
104 lineFileEdit->setCompleter( fileCompleter );
106 // lineFileEdit->hide();
108 /* Make a list of QLabel inside the QFileDialog to access the good ones */
109 QList<QLabel *> listLabel = findChildren<QLabel*>();
111 /* Hide the FileNames one. Enable it for debug */
112 listLabel[4]->hide();
113 /* Change the text that was uncool in the usual box */
114 listLabel[5]->setText( qtr( "Filter:" ) );
117 QListView *fileListView = findChildren<QListView*>().first();
119 // Hide the subtitles control by default.
122 /* Build the subs size combo box */
123 setfillVLCConfigCombo( "freetype-rel-fontsize" , p_intf,
124 ui.sizeSubComboBox );
126 /* Build the subs align combo box */
127 setfillVLCConfigCombo( "subsdec-align", p_intf, ui.alignSubComboBox );
130 BUTTONACT( ui.subBrowseButton, browseFileSub() );
131 BUTTONACT( ui.subCheckBox, toggleSubtitleFrame());
134 CONNECT( fileListView, clicked( QModelIndex ), this, updateMRL() );
136 CONNECT( ui.fileInput, editTextChanged( QString ), this, updateMRL() );
138 CONNECT( ui.subInput, editTextChanged( QString ), this, updateMRL() );
139 CONNECT( ui.alignSubComboBox, currentIndexChanged( int ), this,
141 CONNECT( ui.sizeSubComboBox, currentIndexChanged( int ), this,
144 CONNECT( lineFileEdit, textChanged( QString ), this, browseFile() );
147 FileOpenPanel::~FileOpenPanel()
150 QStringList FileOpenPanel::browse( QString help )
152 return THEDP->showSimpleOpen( help );
155 void FileOpenPanel::browseFile()
157 QString fileString = "";
158 foreach( QString file, dialogBox->selectedFiles() ) {
159 fileString += "\"" + file + "\" ";
161 ui.fileInput->setEditText( fileString );
165 void FileOpenPanel::browseFileSub()
167 // FIXME Handle selection of more than one subtitles file
168 QStringList files = THEDP->showSimpleOpen( qtr("Open subtitles file"),
170 dialogBox->directory().absolutePath() );
171 if( files.isEmpty() ) return;
172 ui.subInput->setEditText( files.join(" ") );
176 void FileOpenPanel::updateMRL()
178 msg_Dbg( p_intf, "I was here" );
179 QString mrl = ui.fileInput->currentText();
181 if( ui.subCheckBox->isChecked() ) {
182 mrl.append( " :sub-file=" + ui.subInput->currentText() );
183 int align = ui.alignSubComboBox->itemData(
184 ui.alignSubComboBox->currentIndex() ).toInt();
185 mrl.append( " :subsdec-align=" + QString().setNum( align ) );
186 int size = ui.sizeSubComboBox->itemData(
187 ui.sizeSubComboBox->currentIndex() ).toInt();
188 mrl.append( " :freetype-rel-fontsize=" + QString().setNum( size ) );
191 const char *psz_filepath = config_GetPsz( p_intf, "qt-filedialog-path" );
192 if( ( NULL == psz_filepath )
193 || strcmp( psz_filepath, qtu( dialogBox->directory().absolutePath() )) )
195 /* set dialog box current directory as last known path */
196 config_PutPsz( p_intf, "qt-filedialog-path",
197 qtu( dialogBox->directory().absolutePath() ) );
201 emit mrlUpdated( mrl );
202 emit methodChanged( "file-caching" );
206 /* Function called by Open Dialog when clicke on Play/Enqueue */
207 void FileOpenPanel::accept()
209 ui.fileInput->addItem( ui.fileInput->currentText());
210 if ( ui.fileInput->count() > 8 ) ui.fileInput->removeItem( 0 );
213 void FileOpenBox::accept()
215 OpenDialog::getInstance( NULL, NULL )->play();
218 /* Function called by Open Dialog when clicked on cancel */
219 void FileOpenPanel::clear()
221 ui.fileInput->setEditText( "" );
222 ui.subInput->setEditText( "" );
225 void FileOpenPanel::toggleSubtitleFrame()
227 if ( ui.subFrame->isVisible() )
242 /**************************************************************************
243 * Open Discs ( DVD, CD, VCD and similar devices ) *
244 **************************************************************************/
245 DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
246 OpenPanel( _parent, _p_intf )
250 #if WIN32 /* Disc drives probing for Windows */
253 if( GetLogicalDriveStringsA( sizeof( szDrives ) - 1, szDrives ) )
255 char *drive = szDrives;
256 UINT oldMode = SetErrorMode( SEM_FAILCRITICALERRORS );
259 if( GetDriveTypeA(drive) == DRIVE_CDROM )
260 ui.deviceCombo->addItem( drive );
262 /* go to next drive */
265 SetErrorMode(oldMode);
267 #endif /* Disc Probing under Windows */
270 BUTTONACT( ui.dvdRadioButton, updateButtons());
271 BUTTONACT( ui.vcdRadioButton, updateButtons());
272 BUTTONACT( ui.audioCDRadioButton, updateButtons());
273 BUTTONACT( ui.dvdsimple, updateButtons());
275 CONNECT( ui.deviceCombo, editTextChanged( QString ), this, updateMRL());
276 CONNECT( ui.titleSpin, valueChanged( int ), this, updateMRL());
277 CONNECT( ui.chapterSpin, valueChanged( int ), this, updateMRL());
278 CONNECT( ui.audioSpin, valueChanged( int ), this, updateMRL());
279 CONNECT( ui.subtitlesSpin, valueChanged( int ), this, updateMRL());
282 DiscOpenPanel::~DiscOpenPanel()
285 void DiscOpenPanel::clear()
287 ui.titleSpin->setValue( 0 );
288 ui.chapterSpin->setValue( 0 );
291 void DiscOpenPanel::updateButtons()
293 if ( ui.dvdRadioButton->isChecked() )
295 ui.titleLabel->setText( qtr("Title") );
296 ui.chapterLabel->show();
297 ui.chapterSpin->show();
298 ui.diskOptionBox_2->show();
300 else if ( ui.vcdRadioButton->isChecked() )
302 ui.titleLabel->setText( qtr("Entry") );
303 ui.chapterLabel->hide();
304 ui.chapterSpin->hide();
305 ui.diskOptionBox_2->show();
309 ui.titleLabel->setText( qtr("Track") );
310 ui.chapterLabel->hide();
311 ui.chapterSpin->hide();
312 ui.diskOptionBox_2->hide();
319 void DiscOpenPanel::updateMRL()
323 /* CDDAX and VCDX not implemented. FIXME ? */
325 if( ui.dvdRadioButton->isChecked() ) {
326 if( !ui.dvdsimple->isChecked() )
329 mrl = "dvdsimple://";
330 mrl += ui.deviceCombo->currentText();
331 emit methodChanged( "dvdnav-caching" );
333 if ( ui.titleSpin->value() > 0 ) {
334 mrl += QString("@%1").arg( ui.titleSpin->value() );
335 if ( ui.chapterSpin->value() > 0 ) {
336 mrl+= QString(":%1").arg( ui.chapterSpin->value() );
341 } else if ( ui.vcdRadioButton->isChecked() ) {
342 mrl = "vcd://" + ui.deviceCombo->currentText();
343 emit methodChanged( "vcd-caching" );
345 if( ui.titleSpin->value() > 0 ) {
346 mrl += QString("@E%1").arg( ui.titleSpin->value() );
351 mrl = "cdda://" + ui.deviceCombo->currentText();
352 if( ui.titleSpin->value() > 0 ) {
353 QString("@%1").arg( ui.titleSpin->value() );
357 if ( ui.dvdRadioButton->isChecked() || ui.vcdRadioButton->isChecked() )
359 if ( ui.audioSpin->value() >= 0 ) {
360 mrl += " :audio-track=" +
361 QString("%1").arg( ui.audioSpin->value() );
363 if ( ui.subtitlesSpin->value() >= 0 ) {
364 mrl += " :sub-track=" +
365 QString("%1").arg( ui.subtitlesSpin->value() );
368 emit mrlUpdated( mrl );
372 /**************************************************************************
373 * Open Network streams and URL pages *
374 **************************************************************************/
375 NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
376 OpenPanel( _parent, _p_intf )
381 CONNECT( ui.protocolCombo, currentIndexChanged( int ),
382 this, updateProtocol( int ) );
383 CONNECT( ui.portSpin, valueChanged( int ), this, updateMRL() );
384 CONNECT( ui.addressText, textChanged( QString ), this, updateAddress());
385 CONNECT( ui.timeShift, clicked(), this, updateMRL());
386 CONNECT( ui.ipv6, clicked(), this, updateMRL());
388 ui.protocolCombo->addItem("HTTP", QVariant("http"));
389 ui.protocolCombo->addItem("HTTPS", QVariant("https"));
390 ui.protocolCombo->addItem("FTP", QVariant("ftp"));
391 ui.protocolCombo->addItem("MMS", QVariant("mms"));
392 ui.protocolCombo->addItem("RTSP", QVariant("rtsp"));
393 ui.protocolCombo->addItem("UDP/RTP (unicast)", QVariant("udp"));
394 ui.protocolCombo->addItem("UDP/RTP (multicast)", QVariant("udp"));
397 NetOpenPanel::~NetOpenPanel()
400 void NetOpenPanel::clear()
403 void NetOpenPanel::updateProtocol( int idx ) {
404 QString addr = ui.addressText->text();
405 QString proto = ui.protocolCombo->itemData( idx ).toString();
407 ui.timeShift->setEnabled( idx >= 5 );
408 ui.ipv6->setEnabled( idx == 5 );
409 ui.addressText->setEnabled( idx != 5 );
410 ui.portSpin->setEnabled( idx >= 5 );
412 /* If we already have a protocol in the address, replace it */
413 if( addr.contains( "://")) {
414 msg_Err( p_intf, "replace");
415 addr.replace( QRegExp("^.*://"), proto + "://");
416 ui.addressText->setText( addr );
421 void NetOpenPanel::updateAddress() {
425 void NetOpenPanel::updateMRL() {
427 QString addr = ui.addressText->text();
428 int proto = ui.protocolCombo->currentIndex();
430 if( addr.contains( "://") && proto != 5 ) {
435 mrl = "http://" + addr;
437 mrl = "https://" + addr;
438 emit methodChanged("http-caching");
441 mrl = "mms://" + addr;
442 emit methodChanged("mms-caching");
445 mrl = "ftp://" + addr;
446 emit methodChanged("ftp-caching");
449 mrl = "rtsp://" + addr;
450 emit methodChanged("rtsp-caching");
454 if( ui.ipv6->isEnabled() && ui.ipv6->isChecked() ) {
457 mrl += QString(":%1").arg( ui.portSpin->value() );
458 emit methodChanged("udp-caching");
460 case 6: /* UDP multicast */
463 if ( addr.contains(':') && !addr.contains('[') ) {
464 mrl += "[" + addr + "]";
466 mrl += QString(":%1").arg( ui.portSpin->value() );
467 emit methodChanged("udp-caching");
470 if( ui.timeShift->isEnabled() && ui.timeShift->isChecked() ) {
471 mrl += " :access-filter=timeshift";
473 emit mrlUpdated( mrl );
476 /**************************************************************************
477 * Open Capture device ( DVB, PVR, V4L, and similar ) *
478 **************************************************************************/
479 CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
480 OpenPanel( _parent, _p_intf )
484 /* Create two stacked layouts in the main comboBoxes */
485 QStackedLayout *stackedDevLayout = new QStackedLayout;
486 ui.cardBox->setLayout( stackedDevLayout );
488 QStackedLayout *stackedPropLayout = new QStackedLayout;
489 ui.optionsBox->setLayout( stackedPropLayout );
491 /* Creation and connections of the WIdgets in the stacked layout */
492 #define addModuleAndLayouts( number, name, label ) \
493 QWidget * name ## DevPage = new QWidget( this ); \
494 QWidget * name ## PropPage = new QWidget( this ); \
495 stackedDevLayout->addWidget( name ## DevPage ); \
496 stackedPropLayout->addWidget( name ## PropPage ); \
497 QGridLayout * name ## DevLayout = new QGridLayout; \
498 QGridLayout * name ## PropLayout = new QGridLayout; \
499 name ## DevPage->setLayout( name ## DevLayout ); \
500 name ## PropPage->setLayout( name ## PropLayout ); \
501 ui.deviceCombo->addItem( qtr( label ), QVariant( number ) );
503 #define CuMRL( widget, slot ) CONNECT( widget , slot , this, updateMRL() );
508 addModuleAndLayouts( V4L_DEVICE, v4l, "Video for Linux" );
511 QLabel *v4lVideoDeviceLabel = new QLabel( qtr( "Video device name" ) );
512 v4lDevLayout->addWidget( v4lVideoDeviceLabel, 0, 0 );
514 v4lVideoDevice = new QLineEdit;
515 v4lDevLayout->addWidget( v4lVideoDevice, 0, 1 );
517 QLabel *v4lAudioDeviceLabel = new QLabel( qtr( "Audio device name" ) );
518 v4lDevLayout->addWidget( v4lAudioDeviceLabel, 1, 0 );
520 v4lAudioDevice = new QLineEdit;
521 v4lDevLayout->addWidget( v4lAudioDevice, 1, 1 );
523 /* V4l Props panel */
524 QLabel *v4lNormLabel = new QLabel( qtr( "Norm" ) );
525 v4lPropLayout->addWidget( v4lNormLabel, 0 , 0 );
527 v4lNormBox = new QComboBox;
528 setfillVLCConfigCombo( "v4l-norm", p_intf, v4lNormBox );
529 v4lPropLayout->addWidget( v4lNormBox, 0 , 1 );
531 QLabel *v4lFreqLabel = new QLabel( qtr( "Frequency" ) );
532 v4lPropLayout->addWidget( v4lFreqLabel, 1 , 0 );
534 v4lFreq = new QSpinBox;
535 v4lFreq->setAlignment( Qt::AlignRight );
536 v4lFreq->setSuffix(" kHz");
537 setSpinBoxFreq( v4lFreq );
538 v4lPropLayout->addWidget( v4lFreq, 1 , 1 );
541 CuMRL( v4lVideoDevice, textChanged( QString ) );
542 CuMRL( v4lAudioDevice, textChanged( QString ) );
543 CuMRL( v4lFreq, valueChanged ( int ) );
544 CuMRL( v4lNormBox, currentIndexChanged ( int ) );
549 addModuleAndLayouts( V4L2_DEVICE, v4l2, "Video for Linux 2" );
552 QLabel *v4l2VideoDeviceLabel = new QLabel( qtr( "Video device name" ) );
553 v4l2DevLayout->addWidget( v4l2VideoDeviceLabel, 0, 0 );
555 v4l2VideoDevice = new QLineEdit;
556 v4l2DevLayout->addWidget( v4l2VideoDevice, 0, 1 );
558 QLabel *v4l2AudioDeviceLabel = new QLabel( qtr( "Audio device name" ) );
559 v4l2DevLayout->addWidget( v4l2AudioDeviceLabel, 1, 0 );
561 v4l2AudioDevice = new QLineEdit;
562 v4l2DevLayout->addWidget( v4l2AudioDevice, 1, 1 );
564 /* v4l2 Props panel */
565 QLabel *v4l2StdLabel = new QLabel( qtr( "Standard" ) );
566 v4l2PropLayout->addWidget( v4l2StdLabel, 0 , 0 );
568 v4l2StdBox = new QComboBox;
569 setfillVLCConfigCombo( "v4l2-standard", p_intf, v4l2StdBox );
570 v4l2PropLayout->addWidget( v4l2StdBox, 0 , 1 );
573 CuMRL( v4l2VideoDevice, textChanged( QString ) );
574 CuMRL( v4l2AudioDevice, textChanged( QString ) );
575 CuMRL( v4l2StdBox, currentIndexChanged ( int ) );
580 addModuleAndLayouts( JACK_DEVICE, jack, "JACK Audio Connection Kit" );
582 /* Jack Main panel */
584 QLabel *jackChannelsLabel = new QLabel( qtr( "Channels :" ) );
585 jackDevLayout->addWidget( jackChannelsLabel, 1, 0 );
587 jackChannels = new QSpinBox;
588 setSpinBoxFreq( jackChannels );
589 jackChannels->setMaximum(255);
590 jackChannels->setValue(2);
591 jackChannels->setAlignment( Qt::AlignRight );
592 jackDevLayout->addWidget( jackChannels, 1, 1 );
594 /* Jack Props panel */
597 QLabel *jackPortsLabel = new QLabel( qtr( "Selected ports :" ) );
598 jackPropLayout->addWidget( jackPortsLabel, 0 , 0 );
600 jackPortsSelected = new QLineEdit( qtr( ".*") );
601 jackPortsSelected->setAlignment( Qt::AlignRight );
602 jackPropLayout->addWidget( jackPortsSelected, 0, 1 );
605 QLabel *jackCachingLabel = new QLabel( qtr( "Input caching :" ) );
606 jackPropLayout->addWidget( jackCachingLabel, 1 , 0 );
607 jackCaching = new QSpinBox;
608 setSpinBoxFreq( jackCaching );
609 jackCaching->setSuffix( " ms" );
610 jackCaching->setValue(1000);
611 jackCaching->setAlignment( Qt::AlignRight );
612 jackPropLayout->addWidget( jackCaching, 1 , 1 );
615 jackPace = new QCheckBox(qtr( "Use VLC pace" ));
616 jackPropLayout->addWidget( jackPace, 2, 1 );
619 jackConnect = new QCheckBox( qtr( "Auto connnection" ));
620 jackPropLayout->addWidget( jackConnect, 3, 1 );
623 CuMRL( jackChannels, valueChanged( int ) );
624 CuMRL( jackCaching, valueChanged( int ) );
625 CuMRL( jackPace, stateChanged( int ) );
626 CuMRL( jackConnect, stateChanged( int ) );
627 CuMRL( jackPortsSelected, textChanged( QString ) );
632 addModuleAndLayouts( PVR_DEVICE, pvr, "PVR" );
635 QLabel *pvrDeviceLabel = new QLabel( qtr( "Device name" ) );
636 pvrDevLayout->addWidget( pvrDeviceLabel, 0, 0 );
638 pvrDevice = new QLineEdit;
639 pvrDevLayout->addWidget( pvrDevice, 0, 1 );
641 QLabel *pvrRadioDeviceLabel = new QLabel( qtr( "Radio device name" ) );
642 pvrDevLayout->addWidget( pvrRadioDeviceLabel, 1, 0 );
644 pvrRadioDevice = new QLineEdit;
645 pvrDevLayout->addWidget( pvrRadioDevice, 1, 1 );
647 /* PVR props panel */
648 QLabel *pvrNormLabel = new QLabel( qtr( "Norm" ) );
649 pvrPropLayout->addWidget( pvrNormLabel, 0, 0 );
651 pvrNormBox = new QComboBox;
652 setfillVLCConfigCombo( "pvr-norm", p_intf, pvrNormBox );
653 pvrPropLayout->addWidget( pvrNormBox, 0, 1 );
655 QLabel *pvrFreqLabel = new QLabel( qtr( "Frequency" ) );
656 pvrPropLayout->addWidget( pvrFreqLabel, 1, 0 );
658 pvrFreq = new QSpinBox;
659 pvrFreq->setAlignment( Qt::AlignRight );
660 pvrFreq->setSuffix(" kHz");
661 setSpinBoxFreq( pvrFreq );
662 pvrPropLayout->addWidget( pvrFreq, 1, 1 );
664 QLabel *pvrBitrLabel = new QLabel( qtr( "Bitrate" ) );
665 pvrPropLayout->addWidget( pvrBitrLabel, 2, 0 );
667 pvrBitr = new QSpinBox;
668 pvrBitr->setAlignment( Qt::AlignRight );
669 pvrBitr->setSuffix(" kHz");
670 setSpinBoxFreq( pvrBitr );
671 pvrPropLayout->addWidget( pvrBitr, 2, 1 );
674 CuMRL( pvrDevice, textChanged( QString ) );
675 CuMRL( pvrRadioDevice, textChanged( QString ) );
677 CuMRL( pvrFreq, valueChanged ( int ) );
678 CuMRL( pvrBitr, valueChanged ( int ) );
679 CuMRL( pvrNormBox, currentIndexChanged ( int ) );
681 /*********************
682 * DirectShow Stuffs *
683 *********************/
684 addModuleAndLayouts( DSHOW_DEVICE, dshow, "DirectShow" );
688 QLabel *dshowVDeviceLabel = new QLabel( qtr( "Video Device Name " ) );
689 dshowDevLayout->addWidget( dshowVDeviceLabel, 0, 0 );
691 QLabel *dshowADeviceLabel = new QLabel( qtr( "Audio Device Name " ) );
692 dshowDevLayout->addWidget( dshowADeviceLabel, 1, 0 );
694 QComboBox *dshowVDevice = new QComboBox;
695 dshowDevLayout->addWidget( dshowVDevice, 0, 1 );
697 QComboBox *dshowADevice = new QComboBox;
698 dshowDevLayout->addWidget( dshowADevice, 1, 1 );
700 QPushButton *dshowVRefresh = new QPushButton( qtr( "Update List" ) );
701 dshowDevLayout->addWidget( dshowVRefresh, 0, 2 );
703 QPushButton *dshowARefresh = new QPushButton( qtr( "Update List" ) );
704 dshowDevLayout->addWidget( dshowARefresh, 1, 2 );
706 QPushButton *dshowVConfig = new QPushButton( qtr( "Configure" ) );
707 dshowDevLayout->addWidget( dshowVConfig, 0, 3 );
709 QPushButton *dshowAConfig = new QPushButton( qtr( "Configure" ) );
710 dshowDevLayout->addWidget( dshowAConfig, 1, 3 );
712 /* dshow Properties */
714 QLabel *dshowVSizeLabel = new QLabel( qtr( "Video size" ) );
715 dshowPropLayout->addWidget( dshowVSizeLabel, 0, 0 );
717 QLineEdit *dshowVSizeLine = new QLineEdit;
718 dshowPropLayout->addWidget( dshowVSizeLine, 0, 1);
721 CuMRL( dshowVDevice, currentIndexChanged ( int ) );
722 CuMRL( dshowADevice, currentIndexChanged ( int ) );
723 CuMRL( dshowVSizeLine, textChanged( QString ) );
728 addModuleAndLayouts( BDA_DEVICE, bda, "DVB DirectShow" );
731 QLabel *bdaTypeLabel = new QLabel( qtr( "DVB Type:" ) );
733 bdas = new QRadioButton( "DVB-S" );
734 bdas->setChecked( true );
735 bdac = new QRadioButton( "DVB-C" );
736 bdat = new QRadioButton( "DVB-T" );
738 bdaDevLayout->addWidget( bdaTypeLabel, 0, 0 );
739 bdaDevLayout->addWidget( bdas, 0, 1 );
740 bdaDevLayout->addWidget( bdac, 0, 2 );
741 bdaDevLayout->addWidget( bdat, 0, 3 );
744 QLabel *bdaFreqLabel =
745 new QLabel( qtr( "Transponder/multiplex frequency" ) );
746 bdaPropLayout->addWidget( bdaFreqLabel, 0, 0 );
748 bdaFreq = new QSpinBox;
749 bdaFreq->setAlignment( Qt::AlignRight );
750 bdaFreq->setSuffix(" kHz");
751 bdaFreq->setSingleStep( 1000 );
752 setSpinBoxFreq( bdaFreq )
753 bdaPropLayout->addWidget( bdaFreq, 0, 1 );
755 bdaSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
756 bdaPropLayout->addWidget( bdaSrateLabel, 1, 0 );
758 bdaSrate = new QSpinBox;
759 bdaSrate->setAlignment( Qt::AlignRight );
760 bdaSrate->setSuffix(" kHz");
761 setSpinBoxFreq( bdaSrate );
762 bdaPropLayout->addWidget( bdaSrate, 1, 1 );
764 bdaBandLabel = new QLabel( qtr( "Bandwidth" ) );
765 bdaPropLayout->addWidget( bdaBandLabel, 2, 0 );
767 bdaBandBox = new QComboBox;
768 setfillVLCConfigCombo( "dvb-bandwidth", p_intf, bdaBandBox );
769 bdaPropLayout->addWidget( bdaBandBox, 2, 1 );
771 bdaBandLabel->hide();
775 CuMRL( bdaFreq, valueChanged ( int ) );
776 CuMRL( bdaSrate, valueChanged ( int ) );
777 CuMRL( bdaBandBox, currentIndexChanged ( int ) );
778 BUTTONACT( bdas, updateButtons() );
779 BUTTONACT( bdat, updateButtons() );
780 BUTTONACT( bdac, updateButtons() );
781 BUTTONACT( bdas, updateMRL() );
782 BUTTONACT( bdat, updateMRL() );
783 BUTTONACT( bdac, updateMRL() );
788 addModuleAndLayouts( DVB_DEVICE, dvb, "DVB" );
791 QLabel *dvbDeviceLabel = new QLabel( qtr( "Adapter card to tune" ) );
792 QLabel *dvbTypeLabel = new QLabel( qtr( "DVB Type:" ) );
794 dvbCard = new QSpinBox;
795 dvbCard->setAlignment( Qt::AlignRight );
796 dvbCard->setPrefix( "/dev/dvb/adapter" );
798 dvbDevLayout->addWidget( dvbDeviceLabel, 0, 0 );
799 dvbDevLayout->addWidget( dvbCard, 0, 2, 1, 2 );
801 dvbs = new QRadioButton( "DVB-S" );
802 dvbs->setChecked( true );
803 dvbc = new QRadioButton( "DVB-C" );
804 dvbt = new QRadioButton( "DVB-T" );
806 dvbDevLayout->addWidget( dvbTypeLabel, 1, 0 );
807 dvbDevLayout->addWidget( dvbs, 1, 1 );
808 dvbDevLayout->addWidget( dvbc, 1, 2 );
809 dvbDevLayout->addWidget( dvbt, 1, 3 );
811 /* DVB Props panel */
812 QLabel *dvbFreqLabel =
813 new QLabel( qtr( "Transponder/multiplex frequency" ) );
814 dvbPropLayout->addWidget( dvbFreqLabel, 0, 0 );
816 dvbFreq = new QSpinBox;
817 dvbFreq->setAlignment( Qt::AlignRight );
818 dvbFreq->setSuffix(" kHz");
819 setSpinBoxFreq( dvbFreq );
820 dvbPropLayout->addWidget( dvbFreq, 0, 1 );
822 QLabel *dvbSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
823 dvbPropLayout->addWidget( dvbSrateLabel, 1, 0 );
825 dvbSrate = new QSpinBox;
826 dvbSrate->setAlignment( Qt::AlignRight );
827 dvbSrate->setSuffix(" kHz");
828 setSpinBoxFreq( dvbSrate );
829 dvbPropLayout->addWidget( dvbSrate, 1, 1 );
832 CuMRL( dvbCard, valueChanged ( int ) );
833 CuMRL( dvbFreq, valueChanged ( int ) );
834 CuMRL( dvbSrate, valueChanged ( int ) );
836 BUTTONACT( dvbs, updateButtons() );
837 BUTTONACT( dvbt, updateButtons() );
838 BUTTONACT( dvbc, updateButtons() );
843 addModuleAndLayouts( SCREEN_DEVICE, screen, "Desktop" );
844 QLabel *screenLabel = new QLabel( "This option will open your own "
845 "desktop in order to save or stream it.");
846 screenLabel->setWordWrap( true );
847 screenDevLayout->addWidget( screenLabel, 0, 0 );
849 /* General connects */
850 connect( ui.deviceCombo, SIGNAL( activated( int ) ),
851 stackedDevLayout, SLOT( setCurrentIndex( int ) ) );
852 connect( ui.deviceCombo, SIGNAL( activated( int ) ),
853 stackedPropLayout, SLOT( setCurrentIndex( int ) ) );
854 CONNECT( ui.deviceCombo, activated( int ), this, updateMRL() );
855 CONNECT( ui.deviceCombo, activated( int ), this, updateButtons() );
860 CaptureOpenPanel::~CaptureOpenPanel()
863 void CaptureOpenPanel::clear()
866 void CaptureOpenPanel::updateMRL()
869 int i_devicetype = ui.deviceCombo->itemData(
870 ui.deviceCombo->currentIndex() ).toInt();
871 switch( i_devicetype )
875 mrl += " :v4l-vdev=" + v4lVideoDevice->text();
876 mrl += " :v4l-adev=" + v4lAudioDevice->text();
877 mrl += " :v4l-norm=" + QString("%1").arg( v4lNormBox->currentIndex() );
878 mrl += " :v4l-frequency=" + QString("%1").arg( v4lFreq->value() );
882 mrl += " :v4l2-dev=" + v4l2VideoDevice->text();
883 mrl += " :v4l2-adev=" + v4l2AudioDevice->text();
884 mrl += " :v4l2-standard=" + QString("%1").arg( v4l2StdBox->currentIndex() );
888 mrl += "channels=" + QString("%1").arg( jackChannels->value() );
889 mrl += ":ports=" + jackPortsSelected->text();
890 mrl += " --jack-input-caching=" + QString("%1").arg( jackCaching->value() );
891 if ( jackPace->isChecked() )
893 mrl += " --jack-input-use-vlc-pace";
895 if ( jackConnect->isChecked() )
897 mrl += " --jack-input-auto-connect";
902 mrl += " :pvr-device=" + pvrDevice->text();
903 mrl += " :pvr-radio-device=" + pvrRadioDevice->text();
904 mrl += " :pvr-norm=" + QString("%1").arg( pvrNormBox->currentIndex() );
905 if( pvrFreq->value() )
906 mrl += " :pvr-frequency=" + QString("%1").arg( pvrFreq->value() );
907 if( pvrBitr->value() )
908 mrl += " :pvr-bitrate=" + QString("%1").arg( pvrBitr->value() );
912 mrl += " :dvb-adapter=" + QString("%1").arg( dvbCard->value() );
913 mrl += " :dvb-frequency=" + QString("%1").arg( dvbFreq->value() );
914 mrl += " :dvb-srate=" + QString("%1").arg( dvbSrate->value() );
917 if( bdas->isChecked() ) mrl = "dvb-s://";
918 else if( bdat->isChecked() ) mrl = "dvb-t://";
919 else if( bdac->isChecked() ) mrl = "dvb-c://";
921 mrl += " :dvb-frequency=" + QString("%1").arg( bdaFreq->value() );
922 if( bdas->isChecked() || bdac->isChecked() )
923 mrl += " :dvb-srate=" + QString("%1").arg( bdaSrate->value() );
925 mrl += " :dvb-bandwidth=" +
926 QString("%1").arg( bdaBandBox->itemData(
927 bdaBandBox->currentIndex() ).toInt() );
936 emit mrlUpdated( mrl );
940 * Update the Buttons (show/hide) for the GUI as all device type don't
941 * use the same ui. elements.
943 void CaptureOpenPanel::updateButtons()
945 /* Be sure to display the ui Elements in case they were hidden by
946 * some Device Type (like Screen://) */
947 ui.optionsBox->show();
948 ui.advancedButton->show();
949 /* Get the current Device Number */
950 int i_devicetype = ui.deviceCombo->itemData(
951 ui.deviceCombo->currentIndex() ).toInt();
952 msg_Dbg( p_intf, "Capture Type: %i", i_devicetype );
953 switch( i_devicetype )
956 if( dvbs->isChecked() ) dvbFreq->setSuffix(" kHz");
957 if( dvbc->isChecked() || dvbt->isChecked() ) dvbFreq->setSuffix(" Hz");
960 if( bdas->isChecked() || bdac->isChecked() )
963 bdaSrateLabel->show();
965 bdaBandLabel->hide();
970 bdaSrateLabel->hide();
972 bdaBandLabel->show();
976 ui.optionsBox->hide();
977 ui.advancedButton->hide();