open_panels.cpp 39.3 KB
Newer Older
Pierre's avatar
Pierre committed
1
/*****************************************************************************
zorglub's avatar
zorglub committed
2
3
 * open.cpp : Panels for the open dialogs
 ****************************************************************************
4
 * Copyright (C) 2006-2008 the VideoLAN team
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
5
6
 * Copyright (C) 2007 Société des arts technologiques
 * Copyright (C) 2007 Savoir-faire Linux
7
 *
8
 * $Id$
zorglub's avatar
zorglub committed
9
10
 *
 * Authors: Clément Stenac <zorglub@videolan.org>
zorglub's avatar
zorglub committed
11
 *          Jean-Baptiste Kempf <jb@videolan.org>
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
12
 *          Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
zorglub's avatar
zorglub committed
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

29
30
31
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
32
33

#include "qt4.hpp"
34
#include "components/open_panels.hpp"
35
#include "dialogs/open.hpp"
36
#include "dialogs_provider.hpp"
37

38
39
40
#include <QFileDialog>
#include <QDialogButtonBox>
#include <QLineEdit>
41
#include <QStackedLayout>
42
#include <QListView>
43
#include <QCompleter>
44
#include <QDirModel>
45
#include <QScrollArea>
46
#include <QUrl>
47

48
#define I_DEVICE_TOOLTIP N_("Select the device or the VIDEO_TS directory")
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
49

zorglub's avatar
zorglub committed
50
/**************************************************************************
51
 * Open Files and subtitles                                               *
zorglub's avatar
zorglub committed
52
53
54
55
 **************************************************************************/
FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
                                OpenPanel( _parent, _p_intf )
{
56
    /* Classic UI Setup */
zorglub's avatar
zorglub committed
57
    ui.setupUi( this );
58

59
    /** BEGIN QFileDialog tweaking **/
60
61
62
63
    /* Use a QFileDialog and customize it because we don't want to
       rewrite it all. Be careful to your eyes cause there are a few hacks.
       Be very careful and test correctly when you modify this. */

64
65
66
67
68
69
70
    /* Set Filters for file selection */
    QString fileTypes = "";
    ADD_FILTER_MEDIA( fileTypes );
    ADD_FILTER_VIDEO( fileTypes );
    ADD_FILTER_AUDIO( fileTypes );
    ADD_FILTER_PLAYLIST( fileTypes );
    ADD_FILTER_ALL( fileTypes );
71
    fileTypes.replace( QString(";*"), QString(" *"));
72

73
    // Make this QFileDialog a child of tempWidget from the ui.
74
    dialogBox = new FileOpenBox( ui.tempWidget, NULL,
75
            qfu( p_intf->p_sys->psz_filepath ), fileTypes );
76

77
    dialogBox->setFileMode( QFileDialog::ExistingFiles );
78
    dialogBox->setAcceptMode( QFileDialog::AcceptOpen );
79
80
#if HAS_QT43
    dialogBox->restoreState(
81
            getSettings()->value( "file-dialog-state" ).toByteArray() );
82
#endif
83

84
85
    /* We don't want to see a grip in the middle of the window, do we? */
    dialogBox->setSizeGripEnabled( false );
86
87

    /* Add a tooltip */
88
    dialogBox->setToolTip( qtr( "Select one or multiple files" ) );
89
    dialogBox->setMinimumHeight( 250 );
90
91

    // But hide the two OK/Cancel buttons. Enable them for debug.
92
    QDialogButtonBox *fileDialogAcceptBox =
93
                      dialogBox->findChildren<QDialogButtonBox*>()[0];
94
    fileDialogAcceptBox->hide();
95
96
97

    /* Ugly hacks to get the good Widget */
    //This lineEdit is the normal line in the fileDialog.
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
98
#if HAS_QT43
99
    lineFileEdit = dialogBox->findChildren<QLineEdit*>()[0];
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
100
#else
101
    lineFileEdit = dialogBox->findChildren<QLineEdit*>()[1];
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
102
#endif
103
    /* Make a list of QLabel inside the QFileDialog to access the good ones */
104
    QList<QLabel *> listLabel = dialogBox->findChildren<QLabel*>();
105
106

    /* Hide the FileNames one. Enable it for debug */
107
    listLabel[1]->setText( qtr( "File names:" ) );
108
    /* Change the text that was uncool in the usual box */
109
    listLabel[2]->setText( qtr( "Filter:" ) );
zorglub's avatar
zorglub committed
110

111
    dialogBox->layout()->setMargin( 0 );
112
    dialogBox->layout()->setSizeConstraint( QLayout::SetNoConstraint );
113

114
115
116
117
118
119
120
121
122
    /** END of QFileDialog tweaking **/

    // Add the DialogBox to the layout
    ui.gridLayout->addWidget( dialogBox, 0, 0, 1, 3 );

    //TODO later: fill the fileCompleteList with previous items played.
    QCompleter *fileCompleter = new QCompleter( fileCompleteList, this );
    fileCompleter->setModel( new QDirModel( fileCompleter ) );
    lineFileEdit->setCompleter( fileCompleter );
123

124
125
126
    // Hide the subtitles control by default.
    ui.subFrame->hide();

127
    /* Build the subs size combo box */
128
    setfillVLCConfigCombo( "freetype-rel-fontsize" , p_intf,
129
                            ui.sizeSubComboBox );
130

yoann's avatar
yoann committed
131
    /* Build the subs align combo box */
132
    setfillVLCConfigCombo( "subsdec-align", p_intf, ui.alignSubComboBox );
yoann's avatar
yoann committed
133

134
    /* Connects  */
135
    BUTTONACT( ui.subBrowseButton, browseFileSub() );
136
    BUTTONACT( ui.subCheckBox, toggleSubtitleFrame());
zorglub's avatar
zorglub committed
137

138
139
    CONNECT( lineFileEdit, textChanged( QString ), this, updateMRL() );
    CONNECT( ui.subInput, textChanged( QString ), this, updateMRL() );
140
141
    CONNECT( ui.alignSubComboBox, currentIndexChanged( int ), this, updateMRL() );
    CONNECT( ui.sizeSubComboBox, currentIndexChanged( int ), this, updateMRL() );
142
143
}

144
145
FileOpenPanel::~FileOpenPanel()
{
146
#if HAS_QT43
147
    getSettings()->setValue( "file-dialog-state", dialogBox->saveState() );
148
#endif
149
}
150

151
/* Show a fileBrowser to select a subtitle */
152
153
void FileOpenPanel::browseFileSub()
{
154
    // TODO Handle selection of more than one subtitles file
155
    QStringList files = THEDP->showSimpleOpen( qtr("Open subtitles file"),
156
157
                            EXT_FILTER_SUBTITLE,
                            dialogBox->directory().absolutePath() );
158
    if( files.isEmpty() ) return;
159
    ui.subInput->setText( files.join(" ") );
zorglub's avatar
zorglub committed
160
    updateMRL();
161
162
}

163
/* Update the current MRL */
164
165
void FileOpenPanel::updateMRL()
{
166
167
168
169
    QString mrl = "";
    foreach( QString file, dialogBox->selectedFiles() ) {
         mrl += "\"" + file + "\" ";
    }
zorglub's avatar
zorglub committed
170

171
    if( ui.subCheckBox->isChecked() ) {
172
        mrl.append( " :sub-file=\"" + ui.subInput->text() + "\"" );
173
174
        int align = ui.alignSubComboBox->itemData(
                    ui.alignSubComboBox->currentIndex() ).toInt();
175
        mrl.append( " :subsdec-align=" + QString().setNum( align ) );
176
177
        int size = ui.sizeSubComboBox->itemData(
                   ui.sizeSubComboBox->currentIndex() ).toInt();
178
        mrl.append( " :freetype-rel-fontsize=" + QString().setNum( size ) );
zorglub's avatar
zorglub committed
179
    }
180

181
182
183
184
185
186
187
    emit mrlUpdated( mrl );
    emit methodChanged( "file-caching" );
}

/* Function called by Open Dialog when clicke on Play/Enqueue */
void FileOpenPanel::accept()
{
188
    //TODO set the completer
189
    p_intf->p_sys->psz_filepath = qtu( dialogBox->directory().absolutePath() );
190
191
}

192
193
void FileOpenBox::accept()
{
194
    OpenDialog::getInstance( NULL, NULL, true )->selectSlots();
195
}
196
197

/* Function called by Open Dialog when clicked on cancel */
198
199
void FileOpenPanel::clear()
{
200
201
    lineFileEdit->clear();
    ui.subInput->clear();
202
203
}

204
205
void FileOpenPanel::toggleSubtitleFrame()
{
206
    TOGGLEV( ui.subFrame );
207
208
209
210
211

    /* Update the MRL */
    updateMRL();
}

zorglub's avatar
zorglub committed
212
/**************************************************************************
213
 * Open Discs ( DVD, CD, VCD and similar devices )                        *
zorglub's avatar
zorglub committed
214
 **************************************************************************/
215
DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
zorglub's avatar
zorglub committed
216
217
218
                                OpenPanel( _parent, _p_intf )
{
    ui.setupUi( this );
zorglub's avatar
zorglub committed
219

220
221
222
223
224
225
226
227
228
    /* Get the default configuration path for the devices */
    psz_dvddiscpath = config_GetPsz( p_intf, "dvd" );
    psz_vcddiscpath = config_GetPsz( p_intf, "vcd" );
    psz_cddadiscpath = config_GetPsz( p_intf, "cd-audio" );

    /* State to avoid overwritting the users changes with the configuration */
    b_firstdvd = true;
    b_firstvcd = true;
    b_firstcdda = true;
229

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
230
231
232
    ui.browseDiscButton->setToolTip( I_DEVICE_TOOLTIP );
    ui.deviceCombo->setToolTip( I_DEVICE_TOOLTIP );

233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
#if WIN32 /* Disc drives probing for Windows */
    char szDrives[512];
    szDrives[0] = '\0';
    if( GetLogicalDriveStringsA( sizeof( szDrives ) - 1, szDrives ) )
    {
        char *drive = szDrives;
        UINT oldMode = SetErrorMode( SEM_FAILCRITICALERRORS );
        while( *drive )
        {
            if( GetDriveTypeA(drive) == DRIVE_CDROM )
                ui.deviceCombo->addItem( drive );

            /* go to next drive */
            while( *(drive++) );
        }
        SetErrorMode(oldMode);
    }
250
#else /* Use a Completer under Linux */
251
252
253
254
    QCompleter *discCompleter = new QCompleter( this );
    discCompleter->setModel( new QDirModel( discCompleter ) );
    ui.deviceCombo->setCompleter( discCompleter );
#endif
255

256
    /* CONNECTs */
257
258
259
260
261
    BUTTONACT( ui.dvdRadioButton, updateButtons() );
    BUTTONACT( ui.vcdRadioButton, updateButtons() );
    BUTTONACT( ui.audioCDRadioButton, updateButtons() );
    BUTTONACT( ui.dvdsimple, updateButtons() );
    BUTTONACT( ui.browseDiscButton, browseDevice() );
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
262
263
    BUTTON_SET_ACT_I( ui.ejectButton, "", eject, qtr( "Eject the disc" ),
            eject() );
zorglub's avatar
zorglub committed
264

265
266
267
268
269
    CONNECT( ui.deviceCombo, editTextChanged( QString ), this, updateMRL());
    CONNECT( ui.titleSpin, valueChanged( int ), this, updateMRL());
    CONNECT( ui.chapterSpin, valueChanged( int ), this, updateMRL());
    CONNECT( ui.audioSpin, valueChanged( int ), this, updateMRL());
    CONNECT( ui.subtitlesSpin, valueChanged( int ), this, updateMRL());
270

271
    /* Run once the updateButtons function in order to fill correctly the comboBoxes */
272
    updateButtons();
zorglub's avatar
zorglub committed
273
274
}

275
DiscOpenPanel::~DiscOpenPanel()
276
{
ivoire's avatar
ivoire committed
277
278
279
    free( psz_dvddiscpath );
    free( psz_vcddiscpath );
    free( psz_cddadiscpath );
280
}
281

282
void DiscOpenPanel::clear()
zorglub's avatar
zorglub committed
283
{
284
285
    ui.titleSpin->setValue( 0 );
    ui.chapterSpin->setValue( 0 );
286
287
288
    b_firstcdda = true;
    b_firstdvd = true;
    b_firstvcd = true;
zorglub's avatar
zorglub committed
289
}
290

291
292
293
294
295
296
297
298
299
#ifdef WIN32
    #define setDrive( psz_name ) {\
    int index = ui.deviceCombo->findText( qfu( psz_name ) ); \
    if( index != -1 ) ui.deviceCombo->setCurrentIndex( index );}
#else
    #define setDrive( psz_name ) {\
    ui.deviceCombo->setEditText( qfu( psz_name ) ); }
#endif

300
/* update the buttons according the type of device */
301
302
303
304
void DiscOpenPanel::updateButtons()
{
    if ( ui.dvdRadioButton->isChecked() )
    {
305
306
307
308
309
        if( b_firstdvd )
        {
            setDrive( psz_dvddiscpath );
            b_firstdvd = false;
        }
310
311
312
313
        ui.titleLabel->setText( qtr("Title") );
        ui.chapterLabel->show();
        ui.chapterSpin->show();
        ui.diskOptionBox_2->show();
314
        ui.dvdsimple->setEnabled( true );
315
316
317
    }
    else if ( ui.vcdRadioButton->isChecked() )
    {
318
319
320
321
322
        if( b_firstvcd )
        {
            setDrive( psz_vcddiscpath );
            b_firstvcd = false;
        }
323
324
325
326
        ui.titleLabel->setText( qtr("Entry") );
        ui.chapterLabel->hide();
        ui.chapterSpin->hide();
        ui.diskOptionBox_2->show();
327
        ui.dvdsimple->setEnabled( false );
328
    }
329
    else /* CDDA */
330
    {
331
332
333
334
335
        if( b_firstcdda )
        {
            setDrive( psz_cddadiscpath );
            b_firstcdda = false;
        }
336
337
338
339
        ui.titleLabel->setText( qtr("Track") );
        ui.chapterLabel->hide();
        ui.chapterSpin->hide();
        ui.diskOptionBox_2->hide();
340
        ui.dvdsimple->setEnabled( false );
341
342
343
344
345
    }

    updateMRL();
}

346
/* Update the current MRL */
347
void DiscOpenPanel::updateMRL()
zorglub's avatar
zorglub committed
348
349
{
    QString mrl = "";
350

351
    /* CDDAX and VCDX not implemented. TODO ? */
zorglub's avatar
zorglub committed
352
353
    /* DVD */
    if( ui.dvdRadioButton->isChecked() ) {
354
        if( !ui.dvdsimple->isChecked() )
355
            mrl = "\"dvd://";
356
        else
357
            mrl = "\"dvdsimple://";
358
        mrl += ui.deviceCombo->currentText();
zorglub's avatar
zorglub committed
359
360
361
        emit methodChanged( "dvdnav-caching" );

        if ( ui.titleSpin->value() > 0 ) {
362
            mrl += QString("@%1").arg( ui.titleSpin->value() );
zorglub's avatar
zorglub committed
363
            if ( ui.chapterSpin->value() > 0 ) {
364
                mrl+= QString(":%1").arg( ui.chapterSpin->value() );
zorglub's avatar
zorglub committed
365
366
367
368
            }
        }

    /* VCD */
369
    } else if ( ui.vcdRadioButton->isChecked() ) {
370
        mrl = "\"vcd://" + ui.deviceCombo->currentText();
zorglub's avatar
zorglub committed
371
372
373
        emit methodChanged( "vcd-caching" );

        if( ui.titleSpin->value() > 0 ) {
374
            mrl += QString("@E%1").arg( ui.titleSpin->value() );
zorglub's avatar
zorglub committed
375
376
377
378
        }

    /* CDDA */
    } else {
379
        mrl = "\"cdda://" + ui.deviceCombo->currentText();
380
        if( ui.titleSpin->value() > 0 ) {
381
            QString("@%1").arg( ui.titleSpin->value() );
382
383
384
        }
    }

385
386
    mrl += "\"";

387
388
389
    if ( ui.dvdRadioButton->isChecked() || ui.vcdRadioButton->isChecked() )
    {
        if ( ui.audioSpin->value() >= 0 ) {
390
391
            mrl += " :audio-track=" +
                QString("%1").arg( ui.audioSpin->value() );
392
393
394
        }
        if ( ui.subtitlesSpin->value() >= 0 ) {
            mrl += " :sub-track=" +
395
                QString("%1").arg( ui.subtitlesSpin->value() );
396
        }
zorglub's avatar
zorglub committed
397
    }
398
    emit mrlUpdated( mrl );
399
400
}

401
402
void DiscOpenPanel::browseDevice()
{
403
    QString dir = QFileDialog::getExistingDirectory( 0,
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
404
            qtr( I_DEVICE_TOOLTIP ) );
405
406
407
408
409
    if (!dir.isEmpty()) {
        ui.deviceCombo->setEditText( dir );
    }
    updateMRL();
}
410

411
412
413
414
415
void DiscOpenPanel::eject()
{
    intf_Eject( p_intf, qtu( ui.deviceCombo->currentText() ) );
}

416
void DiscOpenPanel::accept()
417
{}
418

419
/**************************************************************************
420
 * Open Network streams and URL pages                                     *
421
422
423
424
425
 **************************************************************************/
NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
                                OpenPanel( _parent, _p_intf )
{
    ui.setupUi( this );
zorglub's avatar
zorglub committed
426

427
    /* CONNECTs */
428
    CONNECT( ui.protocolCombo, activated( int ),
429
430
             this, updateProtocol( int ) );
    CONNECT( ui.portSpin, valueChanged( int ), this, updateMRL() );
431
    CONNECT( ui.addressText, textChanged( QString ), this, updateMRL());
zorglub's avatar
zorglub committed
432
433
    CONNECT( ui.timeShift, clicked(), this, updateMRL());

434
435
436
437
    ui.protocolCombo->addItem( "" );
    ui.protocolCombo->addItem("HTTP", QVariant("http"));
    ui.protocolCombo->addItem("HTTPS", QVariant("https"));
    ui.protocolCombo->addItem("MMS", QVariant("mms"));
438
    ui.protocolCombo->addItem("FTP", QVariant("ftp"));
439
    ui.protocolCombo->addItem("RTSP", QVariant("rtsp"));
440
441
    ui.protocolCombo->addItem("RTP", QVariant("rtp"));
    ui.protocolCombo->addItem("UDP", QVariant("udp"));
442
    ui.protocolCombo->addItem("RTMP", QVariant("rtmp"));
443
444

    updateProtocol( ui.protocolCombo->currentIndex() );
zorglub's avatar
zorglub committed
445
446
}

447
448
449
NetOpenPanel::~NetOpenPanel()
{}

zorglub's avatar
zorglub committed
450
void NetOpenPanel::clear()
451
452
{}

453
/* update the widgets according the type of protocol */
454
void NetOpenPanel::updateProtocol( int idx_proto ) {
zorglub's avatar
zorglub committed
455
    QString addr = ui.addressText->text();
456
    QString proto = ui.protocolCombo->itemData( idx_proto ).toString();
zorglub's avatar
zorglub committed
457

458
    ui.timeShift->setEnabled( idx_proto == UDP_PROTO );
459
    ui.portSpin->setEnabled( idx_proto == UDP_PROTO ||
460
                             idx_proto == RTP_PROTO );
461
462

    if( idx_proto == NO_PROTO ) return;
zorglub's avatar
zorglub committed
463
464

    /* If we already have a protocol in the address, replace it */
465
466
    if( addr.contains( "://"))
    {
467
        if( idx_proto != UDP_PROTO && idx_proto != RTP_PROTO )
468
469
470
            addr.replace( QRegExp("^.*://@*"), proto + "://");
        else
             addr.replace( QRegExp("^.*://"), proto + "://@");
471
        ui.addressText->setText( addr );
zorglub's avatar
zorglub committed
472
473
    }
    updateMRL();
zorglub's avatar
zorglub committed
474
}
475

zorglub's avatar
zorglub committed
476
477
478
void NetOpenPanel::updateMRL() {
    QString mrl = "";
    QString addr = ui.addressText->text();
479
    addr = QUrl::toPercentEncoding( addr, ":/?#@!$&'()*+,;=" );
480
    int idx_proto = ui.protocolCombo->currentIndex();
zorglub's avatar
zorglub committed
481

482
    if( addr.contains( "://"))
483
    {
484
485
486
487
        /* Match the correct item in the comboBox */
        ui.protocolCombo->setCurrentIndex(
                ui.protocolCombo->findData( addr.section( ':', 0, 0 ) ) );

488
        if( idx_proto != UDP_PROTO || idx_proto != RTP_PROTO )
489
            mrl = addr;
490
491
492
    }
    else
    {
493
494
        switch( idx_proto ) {
        case HTTP_PROTO:
zorglub's avatar
zorglub committed
495
            mrl = "http://" + addr;
496
497
            emit methodChanged("http-caching");
            break;
498
        case HTTPS_PROTO:
499
            mrl = "https://" + addr;
zorglub's avatar
zorglub committed
500
501
            emit methodChanged("http-caching");
            break;
502
        case MMS_PROTO:
zorglub's avatar
zorglub committed
503
504
505
            mrl = "mms://" + addr;
            emit methodChanged("mms-caching");
            break;
506
        case FTP_PROTO:
zorglub's avatar
zorglub committed
507
508
509
            mrl = "ftp://" + addr;
            emit methodChanged("ftp-caching");
            break;
510
        case RTSP_PROTO:
zorglub's avatar
zorglub committed
511
512
513
            mrl = "rtsp://" + addr;
            emit methodChanged("rtsp-caching");
            break;
514
        case UDP_PROTO:
zorglub's avatar
zorglub committed
515
516
            mrl = "udp://@";
            /* Add [] to IPv6 */
517
518
            if ( addr.contains(':') && !addr.contains('[') )
            {
zorglub's avatar
zorglub committed
519
                mrl += "[" + addr + "]";
520
521
            }
            else mrl += addr;
522
            mrl += QString(":%1").arg( ui.portSpin->value() );
zorglub's avatar
zorglub committed
523
            emit methodChanged("udp-caching");
524
            break;
525
526
527
528
529
530
531
532
533
        case RTP_PROTO:
            mrl = "rtp://@";
            if ( addr.contains(':') && !addr.contains('[') )
                mrl += "[" + addr + "]"; /* Add [] to IPv6 */
            else
                mrl += addr;
            mrl += QString(":%1").arg( ui.portSpin->value() );
            emit methodChanged("rtp-caching");
            break;
534
535
536
537
        case RTMP_PROTO:
            mrl = "rtmp://" + addr;
            emit methodChanged("rtmp-caching");
            break;
zorglub's avatar
zorglub committed
538
539
        }
    }
540
541

    // Encode the boring stuffs
542

zorglub's avatar
zorglub committed
543
544
545
    if( ui.timeShift->isEnabled() && ui.timeShift->isChecked() ) {
        mrl += " :access-filter=timeshift";
    }
546
    emit mrlUpdated( mrl );
zorglub's avatar
zorglub committed
547
}
548
549

/**************************************************************************
550
 * Open Capture device ( DVB, PVR, V4L, and similar )                     *
551
552
553
554
555
 **************************************************************************/
CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
                                OpenPanel( _parent, _p_intf )
{
    ui.setupUi( this );
556

557
558
    BUTTONACT( ui.advancedButton, advancedDialog() );

559
    /* Create two stacked layouts in the main comboBoxes */
560
561
562
563
564
565
    QStackedLayout *stackedDevLayout = new QStackedLayout;
    ui.cardBox->setLayout( stackedDevLayout );

    QStackedLayout *stackedPropLayout = new QStackedLayout;
    ui.optionsBox->setLayout( stackedPropLayout );

566
    /* Creation and connections of the WIdgets in the stacked layout */
567
#define addModuleAndLayouts( number, name, label )                    \
568
569
    QWidget * name ## DevPage = new QWidget( this );                  \
    QWidget * name ## PropPage = new QWidget( this );                 \
570
571
    stackedDevLayout->addWidget( name ## DevPage );        \
    stackedPropLayout->addWidget( name ## PropPage );      \
572
573
574
575
    QGridLayout * name ## DevLayout = new QGridLayout;                \
    QGridLayout * name ## PropLayout = new QGridLayout;               \
    name ## DevPage->setLayout( name ## DevLayout );                  \
    name ## PropPage->setLayout( name ## PropLayout );                \
576
    ui.deviceCombo->addItem( qtr( label ), QVariant( number ) );
577
578
579

#define CuMRL( widget, slot ) CONNECT( widget , slot , this, updateMRL() );

580
581
582
583
584
585
586
#ifdef WIN32
    /*********************
     * DirectShow Stuffs *
     *********************/
    if( module_Exists( p_intf, "dshow" ) ){
    addModuleAndLayouts( DSHOW_DEVICE, dshow, "DirectShow" );

587
    devLayout = dshowDevLayout;
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
    /* dshow Properties */
    QLabel *dshowVSizeLabel = new QLabel( qtr( "Video size" ) );
    dshowPropLayout->addWidget( dshowVSizeLabel, 0, 0 );

    dshowVSizeLine = new QLineEdit;
    dshowPropLayout->addWidget( dshowVSizeLine, 0, 1);
    dshowPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
            1, 0, 3, 1 );

    /* dshow CONNECTs */
    CuMRL( vdevDshowW->combo, currentIndexChanged ( int ) );
    CuMRL( adevDshowW->combo, currentIndexChanged ( int ) );
    CuMRL( dshowVSizeLine, textChanged( QString ) );
    }

    /**************
     * BDA Stuffs *
     **************/
    if( module_Exists( p_intf, "bda" ) ){
    addModuleAndLayouts( BDA_DEVICE, bda, "DVB DirectShow" );

    /* bda Main */
    QLabel *bdaTypeLabel = new QLabel( qtr( "DVB Type:" ) );

    bdas = new QRadioButton( "DVB-S" );
    bdas->setChecked( true );
    bdac = new QRadioButton( "DVB-C" );
    bdat = new QRadioButton( "DVB-T" );

    bdaDevLayout->addWidget( bdaTypeLabel, 0, 0 );
    bdaDevLayout->addWidget( bdas, 0, 1 );
    bdaDevLayout->addWidget( bdac, 0, 2 );
    bdaDevLayout->addWidget( bdat, 0, 3 );

    /* bda Props */
    QLabel *bdaFreqLabel =
                    new QLabel( qtr( "Transponder/multiplex frequency" ) );
    bdaPropLayout->addWidget( bdaFreqLabel, 0, 0 );

    bdaFreq = new QSpinBox;
    bdaFreq->setAlignment( Qt::AlignRight );
    bdaFreq->setSuffix(" kHz");
    bdaFreq->setSingleStep( 1000 );
    setSpinBoxFreq( bdaFreq )
    bdaPropLayout->addWidget( bdaFreq, 0, 1 );

    bdaSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
    bdaPropLayout->addWidget( bdaSrateLabel, 1, 0 );

    bdaSrate = new QSpinBox;
    bdaSrate->setAlignment( Qt::AlignRight );
    bdaSrate->setSuffix(" kHz");
    setSpinBoxFreq( bdaSrate );
    bdaPropLayout->addWidget( bdaSrate, 1, 1 );

    bdaBandLabel = new QLabel( qtr( "Bandwidth" ) );
    bdaPropLayout->addWidget( bdaBandLabel, 2, 0 );

    bdaBandBox = new QComboBox;
    setfillVLCConfigCombo( "dvb-bandwidth", p_intf, bdaBandBox );
    bdaPropLayout->addWidget( bdaBandBox, 2, 1 );

    bdaBandLabel->hide();
    bdaBandBox->hide();
    bdaPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
            2, 0, 2, 1 );

    /* bda CONNECTs */
    CuMRL( bdaFreq, valueChanged ( int ) );
    CuMRL( bdaSrate, valueChanged ( int ) );
    CuMRL( bdaBandBox,  currentIndexChanged ( int ) );
    BUTTONACT( bdas, updateButtons() );
    BUTTONACT( bdat, updateButtons() );
    BUTTONACT( bdac, updateButtons() );
    BUTTONACT( bdas, updateMRL() );
    BUTTONACT( bdat, updateMRL() );
    BUTTONACT( bdac, updateMRL() );
    }

#else /* WIN32 */
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
    /*******
     * V4L2*
     *******/
    if( module_Exists( p_intf, "v4l2" ) ){
    addModuleAndLayouts( V4L2_DEVICE, v4l2, "Video for Linux 2" );

    /* V4l Main panel */
    QLabel *v4l2VideoDeviceLabel = new QLabel( qtr( "Video device name" ) );
    v4l2DevLayout->addWidget( v4l2VideoDeviceLabel, 0, 0 );

    v4l2VideoDevice = new QLineEdit;
    v4l2DevLayout->addWidget( v4l2VideoDevice, 0, 1 );

    QLabel *v4l2AudioDeviceLabel = new QLabel( qtr( "Audio device name" ) );
    v4l2DevLayout->addWidget( v4l2AudioDeviceLabel, 1, 0 );

    v4l2AudioDevice = new QLineEdit;
    v4l2DevLayout->addWidget( v4l2AudioDevice, 1, 1 );

    /* v4l2 Props panel */
    QLabel *v4l2StdLabel = new QLabel( qtr( "Standard" ) );
    v4l2PropLayout->addWidget( v4l2StdLabel, 0 , 0 );

    v4l2StdBox = new QComboBox;
    setfillVLCConfigCombo( "v4l2-standard", p_intf, v4l2StdBox );
    v4l2PropLayout->addWidget( v4l2StdBox, 0 , 1 );
    v4l2PropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
            1, 0, 3, 1 );

    /* v4l2 CONNECTs */
    CuMRL( v4l2VideoDevice, textChanged( QString ) );
    CuMRL( v4l2AudioDevice, textChanged( QString ) );
    CuMRL( v4l2StdBox,  currentIndexChanged ( int ) );
    }

703
704
705
    /*******
     * V4L *
     *******/
706
    if( module_Exists( p_intf, "v4l" ) ){
707
    addModuleAndLayouts( V4L_DEVICE, v4l, "Video for Linux" );
708
709

    /* V4l Main panel */
710
711
    QLabel *v4lVideoDeviceLabel = new QLabel( qtr( "Video device name" ) );
    v4lDevLayout->addWidget( v4lVideoDeviceLabel, 0, 0 );
712

713
    v4lVideoDevice = new QLineEdit;
714
    v4lDevLayout->addWidget( v4lVideoDevice, 0, 1 );
715

716
717
    QLabel *v4lAudioDeviceLabel = new QLabel( qtr( "Audio device name" ) );
    v4lDevLayout->addWidget( v4lAudioDeviceLabel, 1, 0 );
718

719
    v4lAudioDevice = new QLineEdit;
720
721
    v4lDevLayout->addWidget( v4lAudioDevice, 1, 1 );

722
    /* V4l Props panel */
723
724
725
    QLabel *v4lNormLabel = new QLabel( qtr( "Norm" ) );
    v4lPropLayout->addWidget( v4lNormLabel, 0 , 0 );

726
    v4lNormBox = new QComboBox;
727
728
    setfillVLCConfigCombo( "v4l-norm", p_intf, v4lNormBox );
    v4lPropLayout->addWidget( v4lNormBox, 0 , 1 );
729

730
731
732
    QLabel *v4lFreqLabel = new QLabel( qtr( "Frequency" ) );
    v4lPropLayout->addWidget( v4lFreqLabel, 1 , 0 );

733
    v4lFreq = new QSpinBox;
734
735
    v4lFreq->setAlignment( Qt::AlignRight );
    v4lFreq->setSuffix(" kHz");
736
    setSpinBoxFreq( v4lFreq );
737
    v4lPropLayout->addWidget( v4lFreq, 1 , 1 );
738
739
    v4lPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
            2, 0, 2, 1 );
740
741
742
743
744
745

    /* v4l CONNECTs */
    CuMRL( v4lVideoDevice, textChanged( QString ) );
    CuMRL( v4lAudioDevice, textChanged( QString ) );
    CuMRL( v4lFreq, valueChanged ( int ) );
    CuMRL( v4lNormBox,  currentIndexChanged ( int ) );
746
    }
747

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
748
749
750
    /*******
     * JACK *
     *******/
751
    if( module_Exists( p_intf, "jack" ) ){
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
752
753
754
755
    addModuleAndLayouts( JACK_DEVICE, jack, "JACK Audio Connection Kit" );

    /* Jack Main panel */
    /* Channels */
756
    QLabel *jackChannelsLabel = new QLabel( qtr( "Channels:" ) );
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
757
758
759
760
761
762
763
764
765
766
    jackDevLayout->addWidget( jackChannelsLabel, 1, 0 );

    jackChannels = new QSpinBox;
    setSpinBoxFreq( jackChannels );
    jackChannels->setMaximum(255);
    jackChannels->setValue(2);
    jackChannels->setAlignment( Qt::AlignRight );
    jackDevLayout->addWidget( jackChannels, 1, 1 );

    /* Jack Props panel */
767

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
768
    /* Selected ports */
769
    QLabel *jackPortsLabel = new QLabel( qtr( "Selected ports:" ) );
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
770
771
772
773
774
    jackPropLayout->addWidget( jackPortsLabel, 0 , 0 );

    jackPortsSelected = new QLineEdit( qtr( ".*") );
    jackPortsSelected->setAlignment( Qt::AlignRight );
    jackPropLayout->addWidget( jackPortsSelected, 0, 1 );
775

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
776
    /* Caching */
777
    QLabel *jackCachingLabel = new QLabel( qtr( "Input caching:" ) );
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
778
779
780
781
782
783
784
    jackPropLayout->addWidget( jackCachingLabel, 1 , 0 );
    jackCaching = new QSpinBox;
    setSpinBoxFreq( jackCaching );
    jackCaching->setSuffix( " ms" );
    jackCaching->setValue(1000);
    jackCaching->setAlignment( Qt::AlignRight );
    jackPropLayout->addWidget( jackCaching, 1 , 1 );
785

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
786
787
788
    /* Pace */
    jackPace = new QCheckBox(qtr( "Use VLC pace" ));
    jackPropLayout->addWidget( jackPace, 2, 1 );
789

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
790
791
792
    /* Auto Connect */
    jackConnect = new QCheckBox( qtr( "Auto connnection" ));
    jackPropLayout->addWidget( jackConnect, 3, 1 );
793

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
794
795
796
797
798
799
    /* Jack CONNECTs */
    CuMRL( jackChannels, valueChanged( int ) );
    CuMRL( jackCaching, valueChanged( int ) );
    CuMRL( jackPace, stateChanged( int ) );
    CuMRL( jackConnect, stateChanged( int ) );
    CuMRL( jackPortsSelected, textChanged( QString ) );
800
    }
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
801

802
803
804
    /************
     * PVR      *
     ************/
805
    if( module_Exists( p_intf, "pvr" ) ){
806
    addModuleAndLayouts( PVR_DEVICE, pvr, "PVR" );
807

808
    /* PVR Main panel */
809
810
    QLabel *pvrDeviceLabel = new QLabel( qtr( "Device name" ) );
    pvrDevLayout->addWidget( pvrDeviceLabel, 0, 0 );
811

812
813
    pvrDevice = new QLineEdit;
    pvrDevLayout->addWidget( pvrDevice, 0, 1 );
814

815
816
    QLabel *pvrRadioDeviceLabel = new QLabel( qtr( "Radio device name" ) );
    pvrDevLayout->addWidget( pvrRadioDeviceLabel, 1, 0 );
817

818
819
    pvrRadioDevice = new QLineEdit;
    pvrDevLayout->addWidget( pvrRadioDevice, 1, 1 );
820

821
    /* PVR props panel */
822
823
824
    QLabel *pvrNormLabel = new QLabel( qtr( "Norm" ) );
    pvrPropLayout->addWidget( pvrNormLabel, 0, 0 );

825
    pvrNormBox = new QComboBox;
826
827
828
    setfillVLCConfigCombo( "pvr-norm", p_intf, pvrNormBox );
    pvrPropLayout->addWidget( pvrNormBox, 0, 1 );

829
830
    QLabel *pvrFreqLabel = new QLabel( qtr( "Frequency" ) );
    pvrPropLayout->addWidget( pvrFreqLabel, 1, 0 );
831

832
    pvrFreq = new QSpinBox;
833
834
    pvrFreq->setAlignment( Qt::AlignRight );
    pvrFreq->setSuffix(" kHz");
835
    setSpinBoxFreq( pvrFreq );
836
837
    pvrPropLayout->addWidget( pvrFreq, 1, 1 );

838
839
840
    QLabel *pvrBitrLabel = new QLabel( qtr( "Bitrate" ) );
    pvrPropLayout->addWidget( pvrBitrLabel, 2, 0 );

841
842
843
    pvrBitr = new QSpinBox;
    pvrBitr->setAlignment( Qt::AlignRight );
    pvrBitr->setSuffix(" kHz");
844
    setSpinBoxFreq( pvrBitr );
845
    pvrPropLayout->addWidget( pvrBitr, 2, 1 );
846
847
    pvrPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
            3, 0, 1, 1 );
848
849

    /* PVR CONNECTs */
850
851
    CuMRL( pvrDevice, textChanged( QString ) );
    CuMRL( pvrRadioDevice, textChanged( QString ) );
852
853

    CuMRL( pvrFreq, valueChanged ( int ) );
854
    CuMRL( pvrBitr, valueChanged ( int ) );
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
    CuMRL( pvrNormBox, currentIndexChanged ( int ) );
    }

    /**************
     * DVB Stuffs *
     **************/
    if( module_Exists( p_intf, "dvb" ) ){
    addModuleAndLayouts( DVB_DEVICE, dvb, "DVB" );

    /* DVB Main */
    QLabel *dvbDeviceLabel = new QLabel( qtr( "Adapter card to tune" ) );
    QLabel *dvbTypeLabel = new QLabel( qtr( "DVB Type:" ) );

    dvbCard = new QSpinBox;
    dvbCard->setAlignment( Qt::AlignRight );
    dvbCard->setPrefix( "/dev/dvb/adapter" );

    dvbDevLayout->addWidget( dvbDeviceLabel, 0, 0 );
    dvbDevLayout->addWidget( dvbCard, 0, 2, 1, 2 );

    dvbs = new QRadioButton( "DVB-S" );
    dvbs->setChecked( true );
    dvbc = new QRadioButton( "DVB-C" );
    dvbt = new QRadioButton( "DVB-T" );

    dvbDevLayout->addWidget( dvbTypeLabel, 1, 0 );
    dvbDevLayout->addWidget( dvbs, 1, 1 );
    dvbDevLayout->addWidget( dvbc, 1, 2 );
    dvbDevLayout->addWidget( dvbt, 1, 3 );

    /* DVB Props panel */
    QLabel *dvbFreqLabel =
                    new QLabel( qtr( "Transponder/multiplex frequency" ) );
    dvbPropLayout->addWidget( dvbFreqLabel, 0, 0 );

    dvbFreq = new QSpinBox;
    dvbFreq->setAlignment( Qt::AlignRight );
    dvbFreq->setSuffix(" kHz");
    setSpinBoxFreq( dvbFreq  );
    dvbPropLayout->addWidget( dvbFreq, 0, 1 );

    QLabel *dvbSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
    dvbPropLayout->addWidget( dvbSrateLabel, 1, 0 );

    dvbSrate = new QSpinBox;
    dvbSrate->setAlignment( Qt::AlignRight );
    dvbSrate->setSuffix(" kHz");
    setSpinBoxFreq( dvbSrate );
    dvbPropLayout->addWidget( dvbSrate, 1, 1 );
    dvbPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
            2, 0, 2, 1 );

    /* DVB CONNECTs */
    CuMRL( dvbCard, valueChanged ( int ) );
    CuMRL( dvbFreq, valueChanged ( int ) );
    CuMRL( dvbSrate, valueChanged ( int ) );

    BUTTONACT( dvbs, updateButtons() );
    BUTTONACT( dvbt, updateButtons() );
    BUTTONACT( dvbc, updateButtons() );
    }

#endif
918
919


920
921
922
923
924
925
926
927
928
    /**********
     * Screen *
     **********/
    addModuleAndLayouts( SCREEN_DEVICE, screen, "Desktop" );
    QLabel *screenLabel = new QLabel( "This option will open your own "
            "desktop in order to save or stream it.");
    screenLabel->setWordWrap( true );
    screenDevLayout->addWidget( screenLabel, 0, 0 );

929
    /* General connects */
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
930
931
932
933
    CONNECT( ui.deviceCombo, activated( int ) ,
             stackedDevLayout, setCurrentIndex( int ) );
    CONNECT( ui.deviceCombo, activated( int ),
             stackedPropLayout, setCurrentIndex( int ) );
934
    CONNECT( ui.deviceCombo, activated( int ), this, updateMRL() );
935
    CONNECT( ui.deviceCombo, activated( int ), this, updateButtons() );
936
937

#undef addModule
938
939
940
}

CaptureOpenPanel::~CaptureOpenPanel()
941
942
{
}
943

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
944
void CaptureOpenPanel::clear()
945
946
947
{
    advMRL.clear();
}
948

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
949
void CaptureOpenPanel::updateMRL()
950
951
{
    QString mrl = "";
952
953
    int i_devicetype = ui.deviceCombo->itemData(
            ui.deviceCombo->currentIndex() ).toInt();
954
955
    switch( i_devicetype )
    {
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
#ifdef WIN32
    case BDA_DEVICE:
        if( bdas->isChecked() ) mrl = "dvb-s://";
        else if(  bdat->isChecked() ) mrl = "dvb-t://";
        else if(  bdac->isChecked() ) mrl = "dvb-c://";
        else return;
        mrl += " :dvb-frequency=" + QString("%1").arg( bdaFreq->value() );
        if( bdas->isChecked() || bdac->isChecked() )
            mrl += " :dvb-srate=" + QString("%1").arg( bdaSrate->value() );
        else
            mrl += " :dvb-bandwidth=" +
                QString("%1").arg( bdaBandBox->itemData(
                    bdaBandBox->currentIndex() ).toInt() );
        break;
    case DSHOW_DEVICE:
        mrl = "dshow://";
972
973
        mrl+= " :dshow-vdev=" + QString("\"%1\"").arg( vdevDshowW->getValue() );
        mrl+= " :dshow-adev=" + QString("\"%1\"").arg( adevDshowW->getValue() );
974
975
        if( dshowVSizeLine->isModified() )
            mrl += " :dshow-size=" + dshowVSizeLine->text();
976
977
        break;
#else
978
979
980
981
982
983
984
    case V4L_DEVICE:
        mrl = "v4l://";
        mrl += " :v4l-vdev=" + v4lVideoDevice->text();
        mrl += " :v4l-adev=" + v4lAudioDevice->text();
        mrl += " :v4l-norm=" + QString("%1").arg( v4lNormBox->currentIndex() );
        mrl += " :v4l-frequency=" + QString("%1").arg( v4lFreq->value() );
        break;
985
986
987
988
989
990
    case V4L2_DEVICE:
        mrl = "v4l2://";
        mrl += " :v4l2-dev=" + v4l2VideoDevice->text();
        mrl += " :v4l2-adev=" + v4l2AudioDevice->text();
        mrl += " :v4l2-standard=" + QString("%1").arg( v4l2StdBox->currentIndex() );
        break;
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
    case JACK_DEVICE:
        mrl = "jack://";
        mrl += "channels=" + QString("%1").arg( jackChannels->value() );
        mrl += ":ports=" + jackPortsSelected->text();
        mrl += " --jack-input-caching=" + QString("%1").arg( jackCaching->value() );
        if ( jackPace->isChecked() )
        {
                mrl += " --jack-input-use-vlc-pace";
        }
        if ( jackConnect->isChecked() )
        {
                mrl += " --jack-input-auto-connect";
        }
        break;
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
    case PVR_DEVICE:
        mrl = "pvr://";
        mrl += " :pvr-device=" + pvrDevice->text();
        mrl += " :pvr-radio-device=" + pvrRadioDevice->text();
        mrl += " :pvr-norm=" + QString("%1").arg( pvrNormBox->currentIndex() );
        if( pvrFreq->value() )
            mrl += " :pvr-frequency=" + QString("%1").arg( pvrFreq->value() );
        if( pvrBitr->value() )
            mrl += " :pvr-bitrate=" + QString("%1").arg( pvrBitr->value() );
        break;
    case DVB_DEVICE:
        mrl = "dvb://";
        mrl += " :dvb-adapter=" + QString("%1").arg( dvbCard->value() );
        mrl += " :dvb-frequency=" + QString("%1").arg( dvbFreq->value() );
        mrl += " :dvb-srate=" + QString("%1").arg( dvbSrate->value() );
        break;
1021
#endif
1022
1023
1024
    case SCREEN_DEVICE:
        mrl = "screen://";
        updateButtons();
1025
1026
        break;
    }
1027
1028
1029

    if( !advMRL.isEmpty() ) mrl += advMRL;

1030
1031
1032
    emit mrlUpdated( mrl );
}

1033
/**
1034
 * Update the Buttons (show/hide) for the GUI as all device type don't
1035
1036
 * use the same ui. elements.
 **/