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 /*Win 32 Probe as in WX ? */
256 BUTTONACT( ui.dvdRadioButton, updateButtons());
257 BUTTONACT( ui.vcdRadioButton, updateButtons());
258 BUTTONACT( ui.audioCDRadioButton, updateButtons());
259 BUTTONACT( ui.dvdsimple, updateButtons());
261 CONNECT( ui.deviceCombo, editTextChanged( QString ), this, updateMRL());
262 CONNECT( ui.titleSpin, valueChanged( int ), this, updateMRL());
263 CONNECT( ui.chapterSpin, valueChanged( int ), this, updateMRL());
264 CONNECT( ui.audioSpin, valueChanged( int ), this, updateMRL());
265 CONNECT( ui.subtitlesSpin, valueChanged( int ), this, updateMRL());
268 DiscOpenPanel::~DiscOpenPanel()
271 void DiscOpenPanel::clear()
273 ui.titleSpin->setValue( 0 );
274 ui.chapterSpin->setValue( 0 );
277 void DiscOpenPanel::updateButtons()
279 if ( ui.dvdRadioButton->isChecked() )
281 ui.titleLabel->setText( qtr("Title") );
282 ui.chapterLabel->show();
283 ui.chapterSpin->show();
284 ui.diskOptionBox_2->show();
286 else if ( ui.vcdRadioButton->isChecked() )
288 ui.titleLabel->setText( qtr("Entry") );
289 ui.chapterLabel->hide();
290 ui.chapterSpin->hide();
291 ui.diskOptionBox_2->show();
295 ui.titleLabel->setText( qtr("Track") );
296 ui.chapterLabel->hide();
297 ui.chapterSpin->hide();
298 ui.diskOptionBox_2->hide();
305 void DiscOpenPanel::updateMRL()
309 /* CDDAX and VCDX not implemented. FIXME ? */
311 if( ui.dvdRadioButton->isChecked() ) {
312 if( !ui.dvdsimple->isChecked() )
315 mrl = "dvdsimple://";
316 mrl += ui.deviceCombo->currentText();
317 emit methodChanged( "dvdnav-caching" );
319 if ( ui.titleSpin->value() > 0 ) {
320 mrl += QString("@%1").arg( ui.titleSpin->value() );
321 if ( ui.chapterSpin->value() > 0 ) {
322 mrl+= QString(":%1").arg( ui.chapterSpin->value() );
327 } else if ( ui.vcdRadioButton->isChecked() ) {
328 mrl = "vcd://" + ui.deviceCombo->currentText();
329 emit methodChanged( "vcd-caching" );
331 if( ui.titleSpin->value() > 0 ) {
332 mrl += QString("@E%1").arg( ui.titleSpin->value() );
337 mrl = "cdda://" + ui.deviceCombo->currentText();
338 if( ui.titleSpin->value() > 0 ) {
339 QString("@%1").arg( ui.titleSpin->value() );
343 if ( ui.dvdRadioButton->isChecked() || ui.vcdRadioButton->isChecked() )
345 if ( ui.audioSpin->value() >= 0 ) {
346 mrl += " :audio-track=" +
347 QString("%1").arg( ui.audioSpin->value() );
349 if ( ui.subtitlesSpin->value() >= 0 ) {
350 mrl += " :sub-track=" +
351 QString("%1").arg( ui.subtitlesSpin->value() );
354 emit mrlUpdated( mrl );
358 /**************************************************************************
359 * Open Network streams and URL pages *
360 **************************************************************************/
361 NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
362 OpenPanel( _parent, _p_intf )
367 CONNECT( ui.protocolCombo, currentIndexChanged( int ),
368 this, updateProtocol( int ) );
369 CONNECT( ui.portSpin, valueChanged( int ), this, updateMRL() );
370 CONNECT( ui.addressText, textChanged( QString ), this, updateAddress());
371 CONNECT( ui.timeShift, clicked(), this, updateMRL());
372 CONNECT( ui.ipv6, clicked(), this, updateMRL());
374 ui.protocolCombo->addItem("HTTP", QVariant("http"));
375 ui.protocolCombo->addItem("HTTPS", QVariant("https"));
376 ui.protocolCombo->addItem("FTP", QVariant("ftp"));
377 ui.protocolCombo->addItem("MMS", QVariant("mms"));
378 ui.protocolCombo->addItem("RTSP", QVariant("rtsp"));
379 ui.protocolCombo->addItem("UDP/RTP (unicast)", QVariant("udp"));
380 ui.protocolCombo->addItem("UDP/RTP (multicast)", QVariant("udp"));
383 NetOpenPanel::~NetOpenPanel()
386 void NetOpenPanel::clear()
389 void NetOpenPanel::updateProtocol( int idx ) {
390 QString addr = ui.addressText->text();
391 QString proto = ui.protocolCombo->itemData( idx ).toString();
393 ui.timeShift->setEnabled( idx >= 5 );
394 ui.ipv6->setEnabled( idx == 5 );
395 ui.addressText->setEnabled( idx != 5 );
396 ui.portSpin->setEnabled( idx >= 5 );
398 /* If we already have a protocol in the address, replace it */
399 if( addr.contains( "://")) {
400 msg_Err( p_intf, "replace");
401 addr.replace( QRegExp("^.*://"), proto + "://");
402 ui.addressText->setText( addr );
407 void NetOpenPanel::updateAddress() {
411 void NetOpenPanel::updateMRL() {
413 QString addr = ui.addressText->text();
414 int proto = ui.protocolCombo->currentIndex();
416 if( addr.contains( "://") && proto != 5 ) {
421 mrl = "http://" + addr;
423 mrl = "https://" + addr;
424 emit methodChanged("http-caching");
427 mrl = "mms://" + addr;
428 emit methodChanged("mms-caching");
431 mrl = "ftp://" + addr;
432 emit methodChanged("ftp-caching");
435 mrl = "rtsp://" + addr;
436 emit methodChanged("rtsp-caching");
440 if( ui.ipv6->isEnabled() && ui.ipv6->isChecked() ) {
443 mrl += QString(":%1").arg( ui.portSpin->value() );
444 emit methodChanged("udp-caching");
446 case 6: /* UDP multicast */
449 if ( addr.contains(':') && !addr.contains('[') ) {
450 mrl += "[" + addr + "]";
452 mrl += QString(":%1").arg( ui.portSpin->value() );
453 emit methodChanged("udp-caching");
456 if( ui.timeShift->isEnabled() && ui.timeShift->isChecked() ) {
457 mrl += " :access-filter=timeshift";
459 emit mrlUpdated( mrl );
462 /**************************************************************************
463 * Open Capture device ( DVB, PVR, V4L, and similar ) *
464 **************************************************************************/
465 CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
466 OpenPanel( _parent, _p_intf )
470 /* Create two stacked layouts in the main comboBoxes */
471 QStackedLayout *stackedDevLayout = new QStackedLayout;
472 ui.cardBox->setLayout( stackedDevLayout );
474 QStackedLayout *stackedPropLayout = new QStackedLayout;
475 ui.optionsBox->setLayout( stackedPropLayout );
477 /* Creation and connections of the WIdgets in the stacked layout */
478 #define addModuleAndLayouts( number, name, label ) \
479 QWidget * name ## DevPage = new QWidget( this ); \
480 QWidget * name ## PropPage = new QWidget( this ); \
481 stackedDevLayout->addWidget( name ## DevPage ); \
482 stackedPropLayout->addWidget( name ## PropPage ); \
483 QGridLayout * name ## DevLayout = new QGridLayout; \
484 QGridLayout * name ## PropLayout = new QGridLayout; \
485 name ## DevPage->setLayout( name ## DevLayout ); \
486 name ## PropPage->setLayout( name ## PropLayout ); \
487 ui.deviceCombo->addItem( qtr( label ), QVariant( number ) );
489 #define CuMRL( widget, slot ) CONNECT( widget , slot , this, updateMRL() );
494 addModuleAndLayouts( V4L_DEVICE, v4l, "Video for Linux" );
497 QLabel *v4lVideoDeviceLabel = new QLabel( qtr( "Video device name" ) );
498 v4lDevLayout->addWidget( v4lVideoDeviceLabel, 0, 0 );
500 v4lVideoDevice = new QLineEdit;
501 v4lDevLayout->addWidget( v4lVideoDevice, 0, 1 );
503 QLabel *v4lAudioDeviceLabel = new QLabel( qtr( "Audio device name" ) );
504 v4lDevLayout->addWidget( v4lAudioDeviceLabel, 1, 0 );
506 v4lAudioDevice = new QLineEdit;
507 v4lDevLayout->addWidget( v4lAudioDevice, 1, 1 );
509 /* V4l Props panel */
510 QLabel *v4lNormLabel = new QLabel( qtr( "Norm" ) );
511 v4lPropLayout->addWidget( v4lNormLabel, 0 , 0 );
513 v4lNormBox = new QComboBox;
514 setfillVLCConfigCombo( "v4l-norm", p_intf, v4lNormBox );
515 v4lPropLayout->addWidget( v4lNormBox, 0 , 1 );
517 QLabel *v4lFreqLabel = new QLabel( qtr( "Frequency" ) );
518 v4lPropLayout->addWidget( v4lFreqLabel, 1 , 0 );
520 v4lFreq = new QSpinBox;
521 v4lFreq->setAlignment( Qt::AlignRight );
522 v4lFreq->setSuffix(" kHz");
523 setSpinBoxFreq( v4lFreq );
524 v4lPropLayout->addWidget( v4lFreq, 1 , 1 );
527 CuMRL( v4lVideoDevice, textChanged( QString ) );
528 CuMRL( v4lAudioDevice, textChanged( QString ) );
529 CuMRL( v4lFreq, valueChanged ( int ) );
530 CuMRL( v4lNormBox, currentIndexChanged ( int ) );
535 addModuleAndLayouts( JACK_DEVICE, jack, "JACK Audio Connection Kit" );
537 /* Jack Main panel */
539 QLabel *jackChannelsLabel = new QLabel( qtr( "Channels :" ) );
540 jackDevLayout->addWidget( jackChannelsLabel, 1, 0 );
542 jackChannels = new QSpinBox;
543 setSpinBoxFreq( jackChannels );
544 jackChannels->setMaximum(255);
545 jackChannels->setValue(2);
546 jackChannels->setAlignment( Qt::AlignRight );
547 jackDevLayout->addWidget( jackChannels, 1, 1 );
549 /* Jack Props panel */
552 QLabel *jackPortsLabel = new QLabel( qtr( "Selected ports :" ) );
553 jackPropLayout->addWidget( jackPortsLabel, 0 , 0 );
555 jackPortsSelected = new QLineEdit( qtr( ".*") );
556 jackPortsSelected->setAlignment( Qt::AlignRight );
557 jackPropLayout->addWidget( jackPortsSelected, 0, 1 );
560 QLabel *jackCachingLabel = new QLabel( qtr( "Input caching :" ) );
561 jackPropLayout->addWidget( jackCachingLabel, 1 , 0 );
562 jackCaching = new QSpinBox;
563 setSpinBoxFreq( jackCaching );
564 jackCaching->setSuffix( " ms" );
565 jackCaching->setValue(1000);
566 jackCaching->setAlignment( Qt::AlignRight );
567 jackPropLayout->addWidget( jackCaching, 1 , 1 );
570 jackPace = new QCheckBox(qtr( "Use VLC pace" ));
571 jackPropLayout->addWidget( jackPace, 2, 1 );
574 jackConnect = new QCheckBox( qtr( "Auto connnection" ));
575 jackPropLayout->addWidget( jackConnect, 3, 1 );
578 CuMRL( jackChannels, valueChanged( int ) );
579 CuMRL( jackCaching, valueChanged( int ) );
580 CuMRL( jackPace, stateChanged( int ) );
581 CuMRL( jackConnect, stateChanged( int ) );
582 CuMRL( jackPortsSelected, textChanged( QString ) );
587 addModuleAndLayouts( PVR_DEVICE, pvr, "PVR" );
590 QLabel *pvrDeviceLabel = new QLabel( qtr( "Device name" ) );
591 pvrDevLayout->addWidget( pvrDeviceLabel, 0, 0 );
593 pvrDevice = new QLineEdit;
594 pvrDevLayout->addWidget( pvrDevice, 0, 1 );
596 QLabel *pvrRadioDeviceLabel = new QLabel( qtr( "Radio device name" ) );
597 pvrDevLayout->addWidget( pvrRadioDeviceLabel, 1, 0 );
599 pvrRadioDevice = new QLineEdit;
600 pvrDevLayout->addWidget( pvrRadioDevice, 1, 1 );
602 /* PVR props panel */
603 QLabel *pvrNormLabel = new QLabel( qtr( "Norm" ) );
604 pvrPropLayout->addWidget( pvrNormLabel, 0, 0 );
606 pvrNormBox = new QComboBox;
607 setfillVLCConfigCombo( "pvr-norm", p_intf, pvrNormBox );
608 pvrPropLayout->addWidget( pvrNormBox, 0, 1 );
610 QLabel *pvrFreqLabel = new QLabel( qtr( "Frequency" ) );
611 pvrPropLayout->addWidget( pvrFreqLabel, 1, 0 );
613 pvrFreq = new QSpinBox;
614 pvrFreq->setAlignment( Qt::AlignRight );
615 pvrFreq->setSuffix(" kHz");
616 setSpinBoxFreq( pvrFreq );
617 pvrPropLayout->addWidget( pvrFreq, 1, 1 );
619 QLabel *pvrBitrLabel = new QLabel( qtr( "Bitrate" ) );
620 pvrPropLayout->addWidget( pvrBitrLabel, 2, 0 );
622 pvrBitr = new QSpinBox;
623 pvrBitr->setAlignment( Qt::AlignRight );
624 pvrBitr->setSuffix(" kHz");
625 setSpinBoxFreq( pvrBitr );
626 pvrPropLayout->addWidget( pvrBitr, 2, 1 );
629 CuMRL( pvrDevice, textChanged( QString ) );
630 CuMRL( pvrRadioDevice, textChanged( QString ) );
632 CuMRL( pvrFreq, valueChanged ( int ) );
633 CuMRL( pvrBitr, valueChanged ( int ) );
634 CuMRL( pvrNormBox, currentIndexChanged ( int ) );
636 /*********************
637 * DirectShow Stuffs *
638 *********************/
639 addModuleAndLayouts( DSHOW_DEVICE, dshow, "DirectShow" );
643 QLabel *dshowVDeviceLabel = new QLabel( qtr( "Video Device Name " ) );
644 dshowDevLayout->addWidget( dshowVDeviceLabel, 0, 0 );
646 QLabel *dshowADeviceLabel = new QLabel( qtr( "Audio Device Name " ) );
647 dshowDevLayout->addWidget( dshowADeviceLabel, 1, 0 );
649 QComboBox *dshowVDevice = new QComboBox;
650 dshowDevLayout->addWidget( dshowVDevice, 0, 1 );
652 QComboBox *dshowADevice = new QComboBox;
653 dshowDevLayout->addWidget( dshowADevice, 1, 1 );
655 QPushButton *dshowVRefresh = new QPushButton( qtr( "Update List" ) );
656 dshowDevLayout->addWidget( dshowVRefresh, 0, 2 );
658 QPushButton *dshowARefresh = new QPushButton( qtr( "Update List" ) );
659 dshowDevLayout->addWidget( dshowARefresh, 1, 2 );
661 QPushButton *dshowVConfig = new QPushButton( qtr( "Configure" ) );
662 dshowDevLayout->addWidget( dshowVConfig, 0, 3 );
664 QPushButton *dshowAConfig = new QPushButton( qtr( "Configure" ) );
665 dshowDevLayout->addWidget( dshowAConfig, 1, 3 );
667 /* dshow Properties */
669 QLabel *dshowVSizeLabel = new QLabel( qtr( "Video size" ) );
670 dshowPropLayout->addWidget( dshowVSizeLabel, 0, 0 );
672 QLineEdit *dshowVSizeLine = new QLineEdit;
673 dshowPropLayout->addWidget( dshowVSizeLine, 0, 1);
676 CuMRL( dshowVDevice, currentIndexChanged ( int ) );
677 CuMRL( dshowADevice, currentIndexChanged ( int ) );
678 CuMRL( dshowVSizeLine, textChanged( QString ) );
683 addModuleAndLayouts( BDA_DEVICE, bda, "DVB DirectShow" );
686 QLabel *bdaTypeLabel = new QLabel( qtr( "DVB Type:" ) );
688 bdas = new QRadioButton( "DVB-S" );
689 bdas->setChecked( true );
690 bdac = new QRadioButton( "DVB-C" );
691 bdat = new QRadioButton( "DVB-T" );
693 bdaDevLayout->addWidget( bdaTypeLabel, 0, 0 );
694 bdaDevLayout->addWidget( bdas, 0, 1 );
695 bdaDevLayout->addWidget( bdac, 0, 2 );
696 bdaDevLayout->addWidget( bdat, 0, 3 );
699 QLabel *bdaFreqLabel =
700 new QLabel( qtr( "Transponder/multiplex frequency" ) );
701 bdaPropLayout->addWidget( bdaFreqLabel, 0, 0 );
703 bdaFreq = new QSpinBox;
704 bdaFreq->setAlignment( Qt::AlignRight );
705 bdaFreq->setSuffix(" kHz");
706 bdaFreq->setSingleStep( 1000 );
707 setSpinBoxFreq( bdaFreq )
708 bdaPropLayout->addWidget( bdaFreq, 0, 1 );
710 bdaSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
711 bdaPropLayout->addWidget( bdaSrateLabel, 1, 0 );
713 bdaSrate = new QSpinBox;
714 bdaSrate->setAlignment( Qt::AlignRight );
715 bdaSrate->setSuffix(" kHz");
716 setSpinBoxFreq( bdaSrate );
717 bdaPropLayout->addWidget( bdaSrate, 1, 1 );
719 bdaBandLabel = new QLabel( qtr( "Bandwidth" ) );
720 bdaPropLayout->addWidget( bdaBandLabel, 2, 0 );
722 bdaBandBox = new QComboBox;
723 setfillVLCConfigCombo( "dvb-bandwidth", p_intf, bdaBandBox );
724 bdaPropLayout->addWidget( bdaBandBox, 2, 1 );
726 bdaBandLabel->hide();
730 CuMRL( bdaFreq, valueChanged ( int ) );
731 CuMRL( bdaSrate, valueChanged ( int ) );
732 CuMRL( bdaBandBox, currentIndexChanged ( int ) );
733 BUTTONACT( bdas, updateButtons() );
734 BUTTONACT( bdat, updateButtons() );
735 BUTTONACT( bdac, updateButtons() );
736 BUTTONACT( bdas, updateMRL() );
737 BUTTONACT( bdat, updateMRL() );
738 BUTTONACT( bdac, updateMRL() );
743 addModuleAndLayouts( DVB_DEVICE, dvb, "DVB" );
746 QLabel *dvbDeviceLabel = new QLabel( qtr( "Adapter card to tune" ) );
747 QLabel *dvbTypeLabel = new QLabel( qtr( "DVB Type:" ) );
749 dvbCard = new QSpinBox;
750 dvbCard->setAlignment( Qt::AlignRight );
751 dvbCard->setPrefix( "/dev/dvb/adapter" );
753 dvbDevLayout->addWidget( dvbDeviceLabel, 0, 0 );
754 dvbDevLayout->addWidget( dvbCard, 0, 2, 1, 2 );
756 dvbs = new QRadioButton( "DVB-S" );
757 dvbs->setChecked( true );
758 dvbc = new QRadioButton( "DVB-C" );
759 dvbt = new QRadioButton( "DVB-T" );
761 dvbDevLayout->addWidget( dvbTypeLabel, 1, 0 );
762 dvbDevLayout->addWidget( dvbs, 1, 1 );
763 dvbDevLayout->addWidget( dvbc, 1, 2 );
764 dvbDevLayout->addWidget( dvbt, 1, 3 );
766 /* DVB Props panel */
767 QLabel *dvbFreqLabel =
768 new QLabel( qtr( "Transponder/multiplex frequency" ) );
769 dvbPropLayout->addWidget( dvbFreqLabel, 0, 0 );
771 dvbFreq = new QSpinBox;
772 dvbFreq->setAlignment( Qt::AlignRight );
773 dvbFreq->setSuffix(" kHz");
774 setSpinBoxFreq( dvbFreq );
775 dvbPropLayout->addWidget( dvbFreq, 0, 1 );
777 QLabel *dvbSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
778 dvbPropLayout->addWidget( dvbSrateLabel, 1, 0 );
780 dvbSrate = new QSpinBox;
781 dvbSrate->setAlignment( Qt::AlignRight );
782 dvbSrate->setSuffix(" kHz");
783 setSpinBoxFreq( dvbSrate );
784 dvbPropLayout->addWidget( dvbSrate, 1, 1 );
787 CuMRL( dvbCard, valueChanged ( int ) );
788 CuMRL( dvbFreq, valueChanged ( int ) );
789 CuMRL( dvbSrate, valueChanged ( int ) );
791 BUTTONACT( dvbs, updateButtons() );
792 BUTTONACT( dvbt, updateButtons() );
793 BUTTONACT( dvbc, updateButtons() );
799 addModuleAndLayouts( SCREEN_DEVICE, screen, "Desktop" );
800 QLabel *screenLabel = new QLabel( "This option will open your own "
801 "desktop in order to save or stream it.");
802 screenLabel->setWordWrap( true );
803 screenDevLayout->addWidget( screenLabel, 0, 0 );
806 /* General connects */
807 connect( ui.deviceCombo, SIGNAL( activated( int ) ),
808 stackedDevLayout, SLOT( setCurrentIndex( int ) ) );
809 connect( ui.deviceCombo, SIGNAL( activated( int ) ),
810 stackedPropLayout, SLOT( setCurrentIndex( int ) ) );
811 CONNECT( ui.deviceCombo, activated( int ), this, updateMRL() );
812 CONNECT( ui.deviceCombo, activated( int ), this, updateButtons() );
817 CaptureOpenPanel::~CaptureOpenPanel()
820 void CaptureOpenPanel::clear()
823 void CaptureOpenPanel::updateMRL()
826 int i_devicetype = ui.deviceCombo->itemData(
827 ui.deviceCombo->currentIndex() ).toInt();
828 msg_Dbg( p_intf, "Capture Type: %i", i_devicetype );
829 switch( i_devicetype )
833 mrl += " :v4l-vdev=" + v4lVideoDevice->text();
834 mrl += " :v4l-adev=" + v4lAudioDevice->text();
835 mrl += " :v4l-norm=" + QString("%1").arg( v4lNormBox->currentIndex() );
836 mrl += " :v4l-frequency=" + QString("%1").arg( v4lFreq->value() );
840 mrl += "channels=" + QString("%1").arg( jackChannels->value() );
841 mrl += ":ports=" + jackPortsSelected->text();
842 mrl += " --jack-input-caching=" + QString("%1").arg( jackCaching->value() );
843 if ( jackPace->isChecked() )
845 mrl += " --jack-input-use-vlc-pace";
847 if ( jackConnect->isChecked() )
849 mrl += " --jack-input-auto-connect";
854 mrl += " :pvr-device=" + pvrDevice->text();
855 mrl += " :pvr-radio-device=" + pvrRadioDevice->text();
856 mrl += " :pvr-norm=" + QString("%1").arg( pvrNormBox->currentIndex() );
857 if( pvrFreq->value() )
858 mrl += " :pvr-frequency=" + QString("%1").arg( pvrFreq->value() );
859 if( pvrBitr->value() )
860 mrl += " :pvr-bitrate=" + QString("%1").arg( pvrBitr->value() );
864 mrl += " :dvb-adapter=" + QString("%1").arg( dvbCard->value() );
865 mrl += " :dvb-frequency=" + QString("%1").arg( dvbFreq->value() );
866 mrl += " :dvb-srate=" + QString("%1").arg( dvbSrate->value() );
869 if( bdas->isChecked() ) mrl = "dvb-s://";
870 else if( bdat->isChecked() ) mrl = "dvb-t://";
871 else if( bdac->isChecked() ) mrl = "dvb-c://";
873 mrl += " :dvb-frequency=" + QString("%1").arg( bdaFreq->value() );
874 if( bdas->isChecked() || bdac->isChecked() )
875 mrl += " :dvb-srate=" + QString("%1").arg( bdaSrate->value() );
877 mrl += " :dvb-bandwidth=" +
878 QString("%1").arg( bdaBandBox->itemData(
879 bdaBandBox->currentIndex() ).toInt() );
888 emit mrlUpdated( mrl );
892 * Update the Buttons (show/hide) for the GUI as all device type don't
893 * use the same ui. elements.
895 void CaptureOpenPanel::updateButtons()
897 /* Be sure to display the ui Elements in case they were hidden by
898 * some Device Type (like Screen://) */
899 ui.optionsBox->show();
900 ui.advancedButton->show();
901 /* Get the current Device Number */
902 int i_devicetype = ui.deviceCombo->itemData(
903 ui.deviceCombo->currentIndex() ).toInt();
904 msg_Dbg( p_intf, "Capture Type: %i", i_devicetype );
905 switch( i_devicetype )
908 if( dvbs->isChecked() ) dvbFreq->setSuffix(" kHz");
909 if( dvbc->isChecked() || dvbt->isChecked() ) dvbFreq->setSuffix(" Hz");
912 if( bdas->isChecked() || bdac->isChecked() )
915 bdaSrateLabel->show();
917 bdaBandLabel->hide();
922 bdaSrateLabel->hide();
924 bdaBandLabel->show();
928 ui.optionsBox->hide();
929 ui.advancedButton->hide();