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>
38 /**************************************************************************
39 * Open Files and subtitles *
40 **************************************************************************/
41 FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
42 OpenPanel( _parent, _p_intf )
44 /* Classic UI Setup */
47 /* Use a QFileDialog and customize it because we don't want to
48 rewrite it all. Be careful to your eyes cause there are a few hacks.
49 Be very careful and test correctly when you modify this. */
51 /* Set Filters for file selection */
52 QString fileTypes = "";
53 ADD_FILTER_MEDIA( fileTypes );
54 ADD_FILTER_VIDEO( fileTypes );
55 ADD_FILTER_AUDIO( fileTypes );
56 ADD_FILTER_PLAYLIST( fileTypes );
57 ADD_FILTER_ALL( fileTypes );
58 fileTypes.replace( QString(";*"), QString(" *"));
60 // Make this QFileDialog a child of tempWidget from the ui.
61 dialogBox = new FileOpenBox( ui.tempWidget, NULL,
62 qfu( p_intf->p_libvlc->psz_homedir ), fileTypes );
63 dialogBox->setFileMode( QFileDialog::ExistingFiles );
64 dialogBox->setAcceptMode( QFileDialog::AcceptOpen );
66 /* retrieve last known path used in file browsing */
67 char *psz_filepath = config_GetPsz( p_intf, "qt-filedialog-path" );
70 dialogBox->setDirectory( QString::fromUtf8( psz_filepath ) );
74 /* We don't want to see a grip in the middle of the window, do we? */
75 dialogBox->setSizeGripEnabled( false );
78 dialogBox->setToolTip( qtr( "Select one or multiple files, or a folder" ) );
80 // Add it to the layout
81 ui.gridLayout->addWidget( dialogBox, 0, 0, 1, 3 );
83 // But hide the two OK/Cancel buttons. Enable them for debug.
84 QDialogButtonBox *fileDialogAcceptBox =
85 findChildren<QDialogButtonBox*>()[0];
86 fileDialogAcceptBox->hide();
88 /* Ugly hacks to get the good Widget */
89 //This lineEdit is the normal line in the fileDialog.
90 #if QT_VERSION >= 0x040300
91 lineFileEdit = findChildren<QLineEdit*>()[2];
93 lineFileEdit = findChildren<QLineEdit*>()[3];
97 /* Make a list of QLabel inside the QFileDialog to access the good ones */
98 QList<QLabel *> listLabel = findChildren<QLabel*>();
100 /* Hide the FileNames one. Enable it for debug */
101 listLabel[4]->hide();
102 /* Change the text that was uncool in the usual box */
103 listLabel[5]->setText( qtr( "Filter:" ) );
106 /* QFileDialog is quite buggy make it brerable on win32 by tweaking
108 QListView *fileListView = findChildren<QListView*>().first();
109 fileListView->setLayoutMode(QListView::Batched);
110 fileListView->setViewMode(QListView::ListMode);
111 fileListView->setResizeMode(QListView::Adjust);
112 fileListView->setUniformItemSizes(false);
113 fileListView->setFlow(QListView::TopToBottom);
114 fileListView->setWrapping(true);
117 // Hide the subtitles control by default.
120 /* Build the subs size combo box */
121 setfillVLCConfigCombo( "freetype-rel-fontsize" , p_intf,
122 ui.sizeSubComboBox );
124 /* Build the subs align combo box */
125 setfillVLCConfigCombo( "subsdec-align", p_intf, ui.alignSubComboBox );
128 BUTTONACT( ui.subBrowseButton, browseFileSub() );
129 BUTTONACT( ui.subCheckBox, toggleSubtitleFrame());
131 CONNECT( ui.fileInput, editTextChanged( QString ), this, updateMRL() );
132 CONNECT( ui.subInput, editTextChanged( QString ), this, updateMRL() );
133 CONNECT( ui.alignSubComboBox, currentIndexChanged( int ), this,
135 CONNECT( ui.sizeSubComboBox, currentIndexChanged( int ), this,
138 CONNECT( lineFileEdit, textChanged( QString ), this, browseFile() );
141 FileOpenPanel::~FileOpenPanel()
144 QStringList FileOpenPanel::browse( QString help )
146 return THEDP->showSimpleOpen( help );
149 void FileOpenPanel::browseFile()
151 QString fileString = "";
152 foreach( QString file, dialogBox->selectedFiles() ) {
153 fileString += "\"" + file + "\" ";
155 ui.fileInput->setEditText( fileString );
159 void FileOpenPanel::browseFileSub()
161 // FIXME Handle selection of more than one subtitles file
162 QStringList files = THEDP->showSimpleOpen( qtr("Open subtitles file"),
164 dialogBox->directory().absolutePath() );
165 if( files.isEmpty() ) return;
166 ui.subInput->setEditText( files.join(" ") );
170 void FileOpenPanel::updateMRL()
172 QString mrl = ui.fileInput->currentText();
174 if( ui.subCheckBox->isChecked() ) {
175 mrl.append( " :sub-file=" + ui.subInput->currentText() );
176 int align = ui.alignSubComboBox->itemData(
177 ui.alignSubComboBox->currentIndex() ).toInt();
178 mrl.append( " :subsdec-align=" + QString().setNum( align ) );
179 int size = ui.sizeSubComboBox->itemData(
180 ui.sizeSubComboBox->currentIndex() ).toInt();
181 mrl.append( " :freetype-rel-fontsize=" + QString().setNum( size ) );
184 const char *psz_filepath = config_GetPsz( p_intf, "qt-filedialog-path" );
185 if( ( NULL == psz_filepath )
186 || strcmp( psz_filepath, qtu( dialogBox->directory().absolutePath() )) )
188 /* set dialog box current directory as last known path */
189 config_PutPsz( p_intf, "qt-filedialog-path",
190 qtu( dialogBox->directory().absolutePath() ) );
194 emit mrlUpdated( mrl );
195 emit methodChanged( "file-caching" );
199 /* Function called by Open Dialog when clicke on Play/Enqueue */
200 void FileOpenPanel::accept()
202 ui.fileInput->addItem( ui.fileInput->currentText());
203 if ( ui.fileInput->count() > 8 ) ui.fileInput->removeItem( 0 );
206 void FileOpenBox::accept()
208 OpenDialog::getInstance( NULL, NULL )->play();
211 /* Function called by Open Dialog when clicked on cancel */
212 void FileOpenPanel::clear()
214 ui.fileInput->setEditText( "" );
215 ui.subInput->setEditText( "" );
218 void FileOpenPanel::toggleSubtitleFrame()
220 if ( ui.subFrame->isVisible() )
235 /**************************************************************************
236 * Open Discs ( DVD, CD, VCD and similar devices ) *
237 **************************************************************************/
238 DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
239 OpenPanel( _parent, _p_intf )
243 /*Win 32 Probe as in WX ? */
246 BUTTONACT( ui.dvdRadioButton, updateButtons());
247 BUTTONACT( ui.vcdRadioButton, updateButtons());
248 BUTTONACT( ui.audioCDRadioButton, updateButtons());
249 BUTTONACT( ui.dvdsimple, updateButtons());
251 CONNECT( ui.deviceCombo, editTextChanged( QString ), this, updateMRL());
252 CONNECT( ui.titleSpin, valueChanged( int ), this, updateMRL());
253 CONNECT( ui.chapterSpin, valueChanged( int ), this, updateMRL());
254 CONNECT( ui.audioSpin, valueChanged( int ), this, updateMRL());
255 CONNECT( ui.subtitlesSpin, valueChanged( int ), this, updateMRL());
258 DiscOpenPanel::~DiscOpenPanel()
261 void DiscOpenPanel::clear()
263 ui.titleSpin->setValue( 0 );
264 ui.chapterSpin->setValue( 0 );
267 void DiscOpenPanel::updateButtons()
269 if ( ui.dvdRadioButton->isChecked() )
271 ui.titleLabel->setText( qtr("Title") );
272 ui.chapterLabel->show();
273 ui.chapterSpin->show();
274 ui.diskOptionBox_2->show();
276 else if ( ui.vcdRadioButton->isChecked() )
278 ui.titleLabel->setText( qtr("Entry") );
279 ui.chapterLabel->hide();
280 ui.chapterSpin->hide();
281 ui.diskOptionBox_2->show();
285 ui.titleLabel->setText( qtr("Track") );
286 ui.chapterLabel->hide();
287 ui.chapterSpin->hide();
288 ui.diskOptionBox_2->hide();
295 void DiscOpenPanel::updateMRL()
299 /* CDDAX and VCDX not implemented. FIXME ? */
301 if( ui.dvdRadioButton->isChecked() ) {
302 if( !ui.dvdsimple->isChecked() )
305 mrl = "dvdsimple://";
306 mrl += ui.deviceCombo->currentText();
307 emit methodChanged( "dvdnav-caching" );
309 if ( ui.titleSpin->value() > 0 ) {
310 mrl += QString("@%1").arg( ui.titleSpin->value() );
311 if ( ui.chapterSpin->value() > 0 ) {
312 mrl+= QString(":%1").arg( ui.chapterSpin->value() );
317 } else if ( ui.vcdRadioButton->isChecked() ) {
318 mrl = "vcd://" + ui.deviceCombo->currentText();
319 emit methodChanged( "vcd-caching" );
321 if( ui.titleSpin->value() > 0 ) {
322 mrl += QString("@E%1").arg( ui.titleSpin->value() );
327 mrl = "cdda://" + ui.deviceCombo->currentText();
328 if( ui.titleSpin->value() > 0 ) {
329 QString("@%1").arg( ui.titleSpin->value() );
333 if ( ui.dvdRadioButton->isChecked() || ui.vcdRadioButton->isChecked() )
335 if ( ui.audioSpin->value() >= 0 ) {
336 mrl += " :audio-track=" +
337 QString("%1").arg( ui.audioSpin->value() );
339 if ( ui.subtitlesSpin->value() >= 0 ) {
340 mrl += " :sub-track=" +
341 QString("%1").arg( ui.subtitlesSpin->value() );
344 emit mrlUpdated( mrl );
349 /**************************************************************************
350 * Open Network streams and URL pages *
351 **************************************************************************/
352 NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
353 OpenPanel( _parent, _p_intf )
358 CONNECT( ui.protocolCombo, currentIndexChanged( int ),
359 this, updateProtocol( int ) );
360 CONNECT( ui.portSpin, valueChanged( int ), this, updateMRL() );
361 CONNECT( ui.addressText, textChanged( QString ), this, updateAddress());
362 CONNECT( ui.timeShift, clicked(), this, updateMRL());
363 CONNECT( ui.ipv6, clicked(), this, updateMRL());
365 ui.protocolCombo->addItem("HTTP", QVariant("http"));
366 ui.protocolCombo->addItem("HTTPS", QVariant("https"));
367 ui.protocolCombo->addItem("FTP", QVariant("ftp"));
368 ui.protocolCombo->addItem("MMS", QVariant("mms"));
369 ui.protocolCombo->addItem("RTSP", QVariant("rtsp"));
370 ui.protocolCombo->addItem("UDP/RTP (unicast)", QVariant("udp"));
371 ui.protocolCombo->addItem("UDP/RTP (multicast)", QVariant("udp"));
374 NetOpenPanel::~NetOpenPanel()
377 void NetOpenPanel::clear()
380 void NetOpenPanel::updateProtocol( int idx ) {
381 QString addr = ui.addressText->text();
382 QString proto = ui.protocolCombo->itemData( idx ).toString();
384 ui.timeShift->setEnabled( idx >= 4 );
385 ui.ipv6->setEnabled( idx == 4 );
386 ui.addressText->setEnabled( idx != 4 );
387 ui.portSpin->setEnabled( idx >= 4 );
389 /* If we already have a protocol in the address, replace it */
390 if( addr.contains( "://")) {
391 msg_Err( p_intf, "replace");
392 addr.replace( QRegExp("^.*://"), proto + "://");
393 ui.addressText->setText( addr );
398 void NetOpenPanel::updateAddress() {
402 void NetOpenPanel::updateMRL() {
404 QString addr = ui.addressText->text();
405 int proto = ui.protocolCombo->currentIndex();
407 if( addr.contains( "://") && proto != 4 ) {
413 mrl = "http://" + addr;
414 emit methodChanged("http-caching");
417 mrl = "mms://" + addr;
418 emit methodChanged("mms-caching");
421 mrl = "ftp://" + addr;
422 emit methodChanged("ftp-caching");
425 mrl = "rtsp://" + addr;
426 emit methodChanged("rtsp-caching");
430 if( ui.ipv6->isEnabled() && ui.ipv6->isChecked() ) {
433 mrl += QString(":%1").arg( ui.portSpin->value() );
434 emit methodChanged("udp-caching");
436 case 6: /* UDP multicast */
439 if ( addr.contains(':') && !addr.contains('[') ) {
440 mrl += "[" + addr + "]";
442 mrl += QString(":%1").arg( ui.portSpin->value() );
443 emit methodChanged("udp-caching");
446 if( ui.timeShift->isEnabled() && ui.timeShift->isChecked() ) {
447 mrl += " :access-filter=timeshift";
449 emit mrlUpdated( mrl );
452 /**************************************************************************
453 * Open Capture device ( DVB, PVR, V4L, and similar ) *
454 **************************************************************************/
455 CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
456 OpenPanel( _parent, _p_intf )
460 /* Create two stacked layouts in the main comboBoxes */
461 QStackedLayout *stackedDevLayout = new QStackedLayout;
462 ui.cardBox->setLayout( stackedDevLayout );
464 QStackedLayout *stackedPropLayout = new QStackedLayout;
465 ui.optionsBox->setLayout( stackedPropLayout );
467 /* Creation and connections of the WIdgets in the stacked layout */
468 #define addModuleAndLayouts( number, name, label ) \
469 QWidget * name ## DevPage = new QWidget( this ); \
470 QWidget * name ## PropPage = new QWidget( this ); \
471 stackedDevLayout->addWidget( name ## DevPage ); \
472 stackedPropLayout->addWidget( name ## PropPage ); \
473 QGridLayout * name ## DevLayout = new QGridLayout; \
474 QGridLayout * name ## PropLayout = new QGridLayout; \
475 name ## DevPage->setLayout( name ## DevLayout ); \
476 name ## PropPage->setLayout( name ## PropLayout ); \
477 ui.deviceCombo->addItem( qtr( label ), QVariant( number ) );
479 #define CuMRL( widget, slot ) CONNECT( widget , slot , this, updateMRL() );
484 addModuleAndLayouts( V4L_DEVICE, v4l, "Video for Linux" );
487 QLabel *v4lVideoDeviceLabel = new QLabel( qtr( "Video device name" ) );
488 v4lDevLayout->addWidget( v4lVideoDeviceLabel, 0, 0 );
490 v4lVideoDevice = new QLineEdit;
491 v4lDevLayout->addWidget( v4lVideoDevice, 0, 1 );
493 QLabel *v4lAudioDeviceLabel = new QLabel( qtr( "Audio device name" ) );
494 v4lDevLayout->addWidget( v4lAudioDeviceLabel, 1, 0 );
496 v4lAudioDevice = new QLineEdit;
497 v4lDevLayout->addWidget( v4lAudioDevice, 1, 1 );
499 /* V4l Props panel */
500 QLabel *v4lNormLabel = new QLabel( qtr( "Norm" ) );
501 v4lPropLayout->addWidget( v4lNormLabel, 0 , 0 );
503 v4lNormBox = new QComboBox;
504 setfillVLCConfigCombo( "v4l-norm", p_intf, v4lNormBox );
505 v4lPropLayout->addWidget( v4lNormBox, 0 , 1 );
507 QLabel *v4lFreqLabel = new QLabel( qtr( "Frequency" ) );
508 v4lPropLayout->addWidget( v4lFreqLabel, 1 , 0 );
510 v4lFreq = new QSpinBox;
511 v4lFreq->setAlignment( Qt::AlignRight );
512 v4lFreq->setSuffix(" kHz");
513 setSpinBoxFreq( v4lFreq );
514 v4lPropLayout->addWidget( v4lFreq, 1 , 1 );
517 CuMRL( v4lVideoDevice, textChanged( QString ) );
518 CuMRL( v4lAudioDevice, textChanged( QString ) );
519 CuMRL( v4lFreq, valueChanged ( int ) );
520 CuMRL( v4lNormBox, currentIndexChanged ( int ) );
525 addModuleAndLayouts( PVR_DEVICE, pvr, "PVR" );
528 QLabel *pvrDeviceLabel = new QLabel( qtr( "Device name" ) );
529 pvrDevLayout->addWidget( pvrDeviceLabel, 0, 0 );
531 pvrDevice = new QLineEdit;
532 pvrDevLayout->addWidget( pvrDevice, 0, 1 );
534 QLabel *pvrRadioDeviceLabel = new QLabel( qtr( "Radio device name" ) );
535 pvrDevLayout->addWidget( pvrRadioDeviceLabel, 1, 0 );
537 pvrRadioDevice = new QLineEdit;
538 pvrDevLayout->addWidget( pvrRadioDevice, 1, 1 );
540 /* PVR props panel */
541 QLabel *pvrNormLabel = new QLabel( qtr( "Norm" ) );
542 pvrPropLayout->addWidget( pvrNormLabel, 0, 0 );
544 pvrNormBox = new QComboBox;
545 setfillVLCConfigCombo( "pvr-norm", p_intf, pvrNormBox );
546 pvrPropLayout->addWidget( pvrNormBox, 0, 1 );
548 QLabel *pvrFreqLabel = new QLabel( qtr( "Frequency" ) );
549 pvrPropLayout->addWidget( pvrFreqLabel, 1, 0 );
551 pvrFreq = new QSpinBox;
552 pvrFreq->setAlignment( Qt::AlignRight );
553 pvrFreq->setSuffix(" kHz");
554 setSpinBoxFreq( pvrFreq );
555 pvrPropLayout->addWidget( pvrFreq, 1, 1 );
557 QLabel *pvrBitrLabel = new QLabel( qtr( "Bitrate" ) );
558 pvrPropLayout->addWidget( pvrBitrLabel, 2, 0 );
560 pvrBitr = new QSpinBox;
561 pvrBitr->setAlignment( Qt::AlignRight );
562 pvrBitr->setSuffix(" kHz");
563 setSpinBoxFreq( pvrBitr );
564 pvrPropLayout->addWidget( pvrBitr, 2, 1 );
567 CuMRL( pvrDevice, textChanged( QString ) );
568 CuMRL( pvrRadioDevice, textChanged( QString ) );
570 CuMRL( pvrFreq, valueChanged ( int ) );
571 CuMRL( pvrBitr, valueChanged ( int ) );
572 CuMRL( pvrNormBox, currentIndexChanged ( int ) );
574 /*********************
575 * DirectShow Stuffs *
576 *********************/
577 addModuleAndLayouts( DSHOW_DEVICE, dshow, "DirectShow" );
581 QLabel *dshowVDeviceLabel = new QLabel( qtr( "Video Device Name " ) );
582 dshowDevLayout->addWidget( dshowVDeviceLabel, 0, 0 );
584 QLabel *dshowADeviceLabel = new QLabel( qtr( "Audio Device Name " ) );
585 dshowDevLayout->addWidget( dshowADeviceLabel, 1, 0 );
587 QComboBox *dshowVDevice = new QComboBox;
588 dshowDevLayout->addWidget( dshowVDevice, 0, 1 );
590 QComboBox *dshowADevice = new QComboBox;
591 dshowDevLayout->addWidget( dshowADevice, 1, 1 );
593 QPushButton *dshowVRefresh = new QPushButton( qtr( "Update List" ) );
594 dshowDevLayout->addWidget( dshowVRefresh, 0, 2 );
596 QPushButton *dshowARefresh = new QPushButton( qtr( "Update List" ) );
597 dshowDevLayout->addWidget( dshowARefresh, 1, 2 );
599 QPushButton *dshowVConfig = new QPushButton( qtr( "Configure" ) );
600 dshowDevLayout->addWidget( dshowVConfig, 0, 3 );
602 QPushButton *dshowAConfig = new QPushButton( qtr( "Configure" ) );
603 dshowDevLayout->addWidget( dshowAConfig, 1, 3 );
605 /* dshow Properties */
607 QLabel *dshowVSizeLabel = new QLabel( qtr( "Video size" ) );
608 dshowPropLayout->addWidget( dshowVSizeLabel, 0, 0 );
610 QLineEdit *dshowVSizeLine = new QLineEdit;
611 dshowPropLayout->addWidget( dshowVSizeLine, 0, 1);
614 CuMRL( dshowVDevice, currentIndexChanged ( int ) );
615 CuMRL( dshowADevice, currentIndexChanged ( int ) );
616 CuMRL( dshowVSizeLine, textChanged( QString ) );
621 addModuleAndLayouts( BDA_DEVICE, bda, "DVB DirectShow" );
624 QLabel *bdaTypeLabel = new QLabel( qtr( "DVB Type:" ) );
626 bdas = new QRadioButton( "DVB-S" );
627 bdas->setChecked( true );
628 bdac = new QRadioButton( "DVB-C" );
629 bdat = new QRadioButton( "DVB-T" );
631 bdaDevLayout->addWidget( bdaTypeLabel, 0, 0 );
632 bdaDevLayout->addWidget( bdas, 0, 1 );
633 bdaDevLayout->addWidget( bdac, 0, 2 );
634 bdaDevLayout->addWidget( bdat, 0, 3 );
637 QLabel *bdaFreqLabel =
638 new QLabel( qtr( "Transponder/multiplex frequency" ) );
639 bdaPropLayout->addWidget( bdaFreqLabel, 0, 0 );
641 bdaFreq = new QSpinBox;
642 bdaFreq->setAlignment( Qt::AlignRight );
643 bdaFreq->setSuffix(" kHz");
644 bdaFreq->setSingleStep( 1000 );
645 setSpinBoxFreq( bdaFreq )
646 bdaPropLayout->addWidget( bdaFreq, 0, 1 );
648 bdaSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
649 bdaPropLayout->addWidget( bdaSrateLabel, 1, 0 );
651 bdaSrate = new QSpinBox;
652 bdaSrate->setAlignment( Qt::AlignRight );
653 bdaSrate->setSuffix(" kHz");
654 setSpinBoxFreq( bdaSrate );
655 bdaPropLayout->addWidget( bdaSrate, 1, 1 );
657 bdaBandLabel = new QLabel( qtr( "Bandwidth" ) );
658 bdaPropLayout->addWidget( bdaBandLabel, 2, 0 );
660 bdaBandBox = new QComboBox;
661 setfillVLCConfigCombo( "dvb-bandwidth", p_intf, bdaBandBox );
662 bdaPropLayout->addWidget( bdaBandBox, 2, 1 );
664 bdaBandLabel->hide();
668 CuMRL( bdaFreq, valueChanged ( int ) );
669 CuMRL( bdaSrate, valueChanged ( int ) );
670 CuMRL( bdaBandBox, currentIndexChanged ( int ) );
671 BUTTONACT( bdas, updateButtons() );
672 BUTTONACT( bdat, updateButtons() );
673 BUTTONACT( bdac, updateButtons() );
674 BUTTONACT( bdas, updateMRL() );
675 BUTTONACT( bdat, updateMRL() );
676 BUTTONACT( bdac, updateMRL() );
681 addModuleAndLayouts( DVB_DEVICE, dvb, "DVB" );
684 QLabel *dvbDeviceLabel = new QLabel( qtr( "Adapter card to tune" ) );
685 QLabel *dvbTypeLabel = new QLabel( qtr( "DVB Type:" ) );
687 dvbCard = new QSpinBox;
688 dvbCard->setAlignment( Qt::AlignRight );
689 dvbCard->setPrefix( "/dev/dvb/adapter" );
691 dvbDevLayout->addWidget( dvbDeviceLabel, 0, 0 );
692 dvbDevLayout->addWidget( dvbCard, 0, 2, 1, 2 );
694 dvbs = new QRadioButton( "DVB-S" );
695 dvbs->setChecked( true );
696 dvbc = new QRadioButton( "DVB-C" );
697 dvbt = new QRadioButton( "DVB-T" );
699 dvbDevLayout->addWidget( dvbTypeLabel, 1, 0 );
700 dvbDevLayout->addWidget( dvbs, 1, 1 );
701 dvbDevLayout->addWidget( dvbc, 1, 2 );
702 dvbDevLayout->addWidget( dvbt, 1, 3 );
704 /* DVB Props panel */
705 QLabel *dvbFreqLabel =
706 new QLabel( qtr( "Transponder/multiplex frequency" ) );
707 dvbPropLayout->addWidget( dvbFreqLabel, 0, 0 );
709 dvbFreq = new QSpinBox;
710 dvbFreq->setAlignment( Qt::AlignRight );
711 dvbFreq->setSuffix(" kHz");
712 setSpinBoxFreq( dvbFreq );
713 dvbPropLayout->addWidget( dvbFreq, 0, 1 );
715 QLabel *dvbSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
716 dvbPropLayout->addWidget( dvbSrateLabel, 1, 0 );
718 dvbSrate = new QSpinBox;
719 dvbSrate->setAlignment( Qt::AlignRight );
720 dvbSrate->setSuffix(" kHz");
721 setSpinBoxFreq( dvbSrate );
722 dvbPropLayout->addWidget( dvbSrate, 1, 1 );
725 CuMRL( dvbCard, valueChanged ( int ) );
726 CuMRL( dvbFreq, valueChanged ( int ) );
727 CuMRL( dvbSrate, valueChanged ( int ) );
729 BUTTONACT( dvbs, updateButtons() );
730 BUTTONACT( dvbt, updateButtons() );
731 BUTTONACT( dvbc, updateButtons() );
737 addModuleAndLayouts( SCREEN_DEVICE, screen, "Desktop" );
738 QLabel *screenLabel = new QLabel( "This option will open your own "
739 "desktop in order to save or stream it.");
740 screenLabel->setWordWrap( true );
741 screenDevLayout->addWidget( screenLabel, 0, 0 );
744 /* General connects */
745 connect( ui.deviceCombo, SIGNAL( activated( int ) ),
746 stackedDevLayout, SLOT( setCurrentIndex( int ) ) );
747 connect( ui.deviceCombo, SIGNAL( activated( int ) ),
748 stackedPropLayout, SLOT( setCurrentIndex( int ) ) );
749 CONNECT( ui.deviceCombo, activated( int ), this, updateMRL() );
750 CONNECT( ui.deviceCombo, activated( int ), this, updateButtons() );
755 CaptureOpenPanel::~CaptureOpenPanel()
758 void CaptureOpenPanel::clear()
761 void CaptureOpenPanel::updateMRL()
764 int i_devicetype = ui.deviceCombo->itemData(
765 ui.deviceCombo->currentIndex() ).toInt();
766 msg_Dbg( p_intf, "Capture Type: %i", i_devicetype );
767 switch( i_devicetype )
771 mrl += " :v4l-vdev=" + v4lVideoDevice->text();
772 mrl += " :v4l-adev=" + v4lAudioDevice->text();
773 mrl += " :v4l-norm=" + QString("%1").arg( v4lNormBox->currentIndex() );
774 mrl += " :v4l-frequency=" + QString("%1").arg( v4lFreq->value() );
778 mrl += " :pvr-device=" + pvrDevice->text();
779 mrl += " :pvr-radio-device=" + pvrRadioDevice->text();
780 mrl += " :pvr-norm=" + QString("%1").arg( pvrNormBox->currentIndex() );
781 if( pvrFreq->value() )
782 mrl += " :pvr-frequency=" + QString("%1").arg( pvrFreq->value() );
783 if( pvrBitr->value() )
784 mrl += " :pvr-bitrate=" + QString("%1").arg( pvrBitr->value() );
788 mrl += " :dvb-adapter=" + QString("%1").arg( dvbCard->value() );
789 mrl += " :dvb-frequency=" + QString("%1").arg( dvbFreq->value() );
790 mrl += " :dvb-srate=" + QString("%1").arg( dvbSrate->value() );
793 if( bdas->isChecked() ) mrl = "dvb-s://";
794 else if( bdat->isChecked() ) mrl = "dvb-t://";
795 else if( bdac->isChecked() ) mrl = "dvb-c://";
797 mrl += " :dvb-frequency=" + QString("%1").arg( bdaFreq->value() );
798 if( bdas->isChecked() || bdac->isChecked() )
799 mrl += " :dvb-srate=" + QString("%1").arg( bdaSrate->value() );
801 mrl += " :dvb-bandwidth=" +
802 QString("%1").arg( bdaBandBox->itemData(
803 bdaBandBox->currentIndex() ).toInt() );
812 emit mrlUpdated( mrl );
816 * Update the Buttons (show/hide) for the GUI as all device type don't
817 * use the same ui. elements.
819 void CaptureOpenPanel::updateButtons()
821 /* Be sure to display the ui Elements in case they were hidden by
822 * some Device Type (like Screen://) */
823 ui.optionsBox->show();
824 ui.advancedButton->show();
825 /* Get the current Device Number */
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 )
832 if( dvbs->isChecked() ) dvbFreq->setSuffix(" kHz");
833 if( dvbc->isChecked() || dvbt->isChecked() ) dvbFreq->setSuffix(" Hz");
836 if( bdas->isChecked() || bdac->isChecked() )
839 bdaSrateLabel->show();
841 bdaBandLabel->hide();
846 bdaSrateLabel->hide();
848 bdaBandLabel->show();
852 ui.optionsBox->hide();
853 ui.advancedButton->hide();