open_panels.cpp 38.9 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-2007 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

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

57
    /** BEGIN QFileDialog tweaking **/
58
59
60
61
    /* 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. */

62
63
64
65
66
67
68
    /* 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 );
69
    fileTypes.replace( QString(";*"), QString(" *"));
70

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

75
    dialogBox->setFileMode( QFileDialog::ExistingFiles );
76
    dialogBox->setAcceptMode( QFileDialog::AcceptOpen );
77
78
    dialogBox->setViewMode( config_GetInt( p_intf, "qt-open-detail" ) ?
            QFileDialog::Detail : QFileDialog::List );
79

80
81
    /* We don't want to see a grip in the middle of the window, do we? */
    dialogBox->setSizeGripEnabled( false );
82
83

    /* Add a tooltip */
84
    dialogBox->setToolTip( qtr( "Select one or multiple files" ) );
85
86

    // But hide the two OK/Cancel buttons. Enable them for debug.
87
    QDialogButtonBox *fileDialogAcceptBox =
88
                      dialogBox->findChildren<QDialogButtonBox*>()[0];
89
    fileDialogAcceptBox->hide();
90
91
92

    /* 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
93
#if HAS_QT43
94
    lineFileEdit = dialogBox->findChildren<QLineEdit*>()[0];
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
95
#else
96
    lineFileEdit = dialogBox->findChildren<QLineEdit*>()[1];
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
97
#endif
98
    /* Make a list of QLabel inside the QFileDialog to access the good ones */
99
    QList<QLabel *> listLabel = dialogBox->findChildren<QLabel*>();
100
101

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

106
    dialogBox->layout()->setMargin( 0 );
107
    dialogBox->layout()->setSizeConstraint( QLayout::SetNoConstraint );
108

109
110
111
112
113
114
115
116
117
    /** 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 );
118

119
120
121
    // Hide the subtitles control by default.
    ui.subFrame->hide();

122
    /* Build the subs size combo box */
123
    setfillVLCConfigCombo( "freetype-rel-fontsize" , p_intf,
124
                            ui.sizeSubComboBox );
125

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

129
    /* Connects  */
130
    BUTTONACT( ui.subBrowseButton, browseFileSub() );
131
    BUTTONACT( ui.subCheckBox, toggleSubtitleFrame());
zorglub's avatar
zorglub committed
132

133
134
    CONNECT( lineFileEdit, textChanged( QString ), this, updateMRL() );
    CONNECT( ui.subInput, textChanged( QString ), this, updateMRL() );
135
136
    CONNECT( ui.alignSubComboBox, currentIndexChanged( int ), this, updateMRL() );
    CONNECT( ui.sizeSubComboBox, currentIndexChanged( int ), this, updateMRL() );
137
138
}

139
140
141
FileOpenPanel::~FileOpenPanel()
{
}
142

143
/* Show a fileBrowser to select a subtitle */
144
145
void FileOpenPanel::browseFileSub()
{
146
    // TODO Handle selection of more than one subtitles file
147
    QStringList files = THEDP->showSimpleOpen( qtr("Open subtitles file"),
148
149
                            EXT_FILTER_SUBTITLE,
                            dialogBox->directory().absolutePath() );
150
    if( files.isEmpty() ) return;
151
    ui.subInput->setText( files.join(" ") );
zorglub's avatar
zorglub committed
152
    updateMRL();
153
154
}

155
/* Update the current MRL */
156
157
void FileOpenPanel::updateMRL()
{
158
159
160
161
    QString mrl = "";
    foreach( QString file, dialogBox->selectedFiles() ) {
         mrl += "\"" + file + "\" ";
    }
zorglub's avatar
zorglub committed
162

163
    if( ui.subCheckBox->isChecked() ) {
164
        mrl.append( " :sub-file=\"" + ui.subInput->text() + "\"" );
165
166
        int align = ui.alignSubComboBox->itemData(
                    ui.alignSubComboBox->currentIndex() ).toInt();
167
        mrl.append( " :subsdec-align=" + QString().setNum( align ) );
168
169
        int size = ui.sizeSubComboBox->itemData(
                   ui.sizeSubComboBox->currentIndex() ).toInt();
170
        mrl.append( " :freetype-rel-fontsize=" + QString().setNum( size ) );
zorglub's avatar
zorglub committed
171
    }
172

173
174
175
176
177
178
179
    emit mrlUpdated( mrl );
    emit methodChanged( "file-caching" );
}

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

184
185
186
187
void FileOpenBox::accept()
{
    OpenDialog::getInstance( NULL, NULL )->play();
}
188
189

/* Function called by Open Dialog when clicked on cancel */
190
191
void FileOpenPanel::clear()
{
192
193
    lineFileEdit->clear();
    ui.subInput->clear();
194
195
}

196
197
void FileOpenPanel::toggleSubtitleFrame()
{
198
    TOGGLEV( ui.subFrame );
199
200
201
202
203

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

zorglub's avatar
zorglub committed
204
/**************************************************************************
205
 * Open Discs ( DVD, CD, VCD and similar devices )                        *
zorglub's avatar
zorglub committed
206
 **************************************************************************/
207
DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
zorglub's avatar
zorglub committed
208
209
210
                                OpenPanel( _parent, _p_intf )
{
    ui.setupUi( this );
zorglub's avatar
zorglub committed
211

212
213
214
215
216
217
218
219
220
    /* 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;
221

222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
#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);
    }
239
#else /* Use a Completer under Linux */
240
241
242
243
    QCompleter *discCompleter = new QCompleter( this );
    discCompleter->setModel( new QDirModel( discCompleter ) );
    ui.deviceCombo->setCompleter( discCompleter );
#endif
244

245
    /* CONNECTs */
246
247
248
249
250
    BUTTONACT( ui.dvdRadioButton, updateButtons() );
    BUTTONACT( ui.vcdRadioButton, updateButtons() );
    BUTTONACT( ui.audioCDRadioButton, updateButtons() );
    BUTTONACT( ui.dvdsimple, updateButtons() );
    BUTTONACT( ui.browseDiscButton, browseDevice() );
251
    BUTTONACT( ui.ejectButton, eject() );
zorglub's avatar
zorglub committed
252

253
254
255
256
257
    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());
258

259
    /* Run once the updateButtons function in order to fill correctly the comboBoxes */
260
    updateButtons();
zorglub's avatar
zorglub committed
261
262
}

263
DiscOpenPanel::~DiscOpenPanel()
264
265
266
267
268
{
    delete psz_dvddiscpath;
    delete psz_vcddiscpath;
    delete psz_cddadiscpath;
}
269

270
void DiscOpenPanel::clear()
zorglub's avatar
zorglub committed
271
{
272
273
    ui.titleSpin->setValue( 0 );
    ui.chapterSpin->setValue( 0 );
274
275
276
    b_firstcdda = true;
    b_firstdvd = true;
    b_firstvcd = true;
zorglub's avatar
zorglub committed
277
}
278

279
280
281
282
283
284
285
286
287
#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

288
/* update the buttons according the type of device */
289
290
291
292
void DiscOpenPanel::updateButtons()
{
    if ( ui.dvdRadioButton->isChecked() )
    {
293
294
295
296
297
        if( b_firstdvd )
        {
            setDrive( psz_dvddiscpath );
            b_firstdvd = false;
        }
298
299
300
301
        ui.titleLabel->setText( qtr("Title") );
        ui.chapterLabel->show();
        ui.chapterSpin->show();
        ui.diskOptionBox_2->show();
302
        ui.dvdsimple->setEnabled( true );
303
304
305
    }
    else if ( ui.vcdRadioButton->isChecked() )
    {
306
307
308
309
310
        if( b_firstvcd )
        {
            setDrive( psz_vcddiscpath );
            b_firstvcd = false;
        }
311
312
313
314
        ui.titleLabel->setText( qtr("Entry") );
        ui.chapterLabel->hide();
        ui.chapterSpin->hide();
        ui.diskOptionBox_2->show();
315
        ui.dvdsimple->setEnabled( false );
316
    }
317
    else /* CDDA */
318
    {
319
320
321
322
323
        if( b_firstcdda )
        {
            setDrive( psz_cddadiscpath );
            b_firstcdda = false;
        }
324
325
326
327
        ui.titleLabel->setText( qtr("Track") );
        ui.chapterLabel->hide();
        ui.chapterSpin->hide();
        ui.diskOptionBox_2->hide();
328
        ui.dvdsimple->setEnabled( false );
329
330
331
332
333
    }

    updateMRL();
}

334
/* Update the current MRL */
335
void DiscOpenPanel::updateMRL()
zorglub's avatar
zorglub committed
336
337
{
    QString mrl = "";
338

339
    /* CDDAX and VCDX not implemented. TODO ? */
zorglub's avatar
zorglub committed
340
341
    /* DVD */
    if( ui.dvdRadioButton->isChecked() ) {
342
        if( !ui.dvdsimple->isChecked() )
343
            mrl = "\"dvd://";
344
        else
345
            mrl = "\"dvdsimple://";
346
        mrl += ui.deviceCombo->currentText();
zorglub's avatar
zorglub committed
347
348
349
        emit methodChanged( "dvdnav-caching" );

        if ( ui.titleSpin->value() > 0 ) {
350
            mrl += QString("@%1").arg( ui.titleSpin->value() );
zorglub's avatar
zorglub committed
351
            if ( ui.chapterSpin->value() > 0 ) {
352
                mrl+= QString(":%1").arg( ui.chapterSpin->value() );
zorglub's avatar
zorglub committed
353
354
355
356
            }
        }

    /* VCD */
357
    } else if ( ui.vcdRadioButton->isChecked() ) {
358
        mrl = "\"vcd://" + ui.deviceCombo->currentText();
zorglub's avatar
zorglub committed
359
360
361
        emit methodChanged( "vcd-caching" );

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

    /* CDDA */
    } else {
367
        mrl = "\"cdda://" + ui.deviceCombo->currentText();
368
        if( ui.titleSpin->value() > 0 ) {
369
            QString("@%1").arg( ui.titleSpin->value() );
370
371
372
        }
    }

373
374
    mrl += "\"";

375
376
377
    if ( ui.dvdRadioButton->isChecked() || ui.vcdRadioButton->isChecked() )
    {
        if ( ui.audioSpin->value() >= 0 ) {
378
379
            mrl += " :audio-track=" +
                QString("%1").arg( ui.audioSpin->value() );
380
381
382
        }
        if ( ui.subtitlesSpin->value() >= 0 ) {
            mrl += " :sub-track=" +
383
                QString("%1").arg( ui.subtitlesSpin->value() );
384
        }
zorglub's avatar
zorglub committed
385
    }
386
    emit mrlUpdated( mrl );
387
388
}

389
390
void DiscOpenPanel::browseDevice()
{
391
    QString dir = QFileDialog::getExistingDirectory( 0,
392
393
394
395
396
397
            qtr("Open a device or a VIDEO_TS directory") );
    if (!dir.isEmpty()) {
        ui.deviceCombo->setEditText( dir );
    }
    updateMRL();
}
398

399
400
401
402
403
void DiscOpenPanel::eject()
{
    intf_Eject( p_intf, qtu( ui.deviceCombo->currentText() ) );
}

404
void DiscOpenPanel::accept()
405
{}
406

407
/**************************************************************************
408
 * Open Network streams and URL pages                                     *
409
410
411
412
413
 **************************************************************************/
NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
                                OpenPanel( _parent, _p_intf )
{
    ui.setupUi( this );
zorglub's avatar
zorglub committed
414

415
    /* CONNECTs */
416
    CONNECT( ui.protocolCombo, activated( int ),
417
418
             this, updateProtocol( int ) );
    CONNECT( ui.portSpin, valueChanged( int ), this, updateMRL() );
419
    CONNECT( ui.addressText, textChanged( QString ), this, updateMRL());
zorglub's avatar
zorglub committed
420
421
422
    CONNECT( ui.timeShift, clicked(), this, updateMRL());
    CONNECT( ui.ipv6, clicked(), this, updateMRL());

423
424
425
426
427
428
429
430
431
    ui.protocolCombo->addItem( "" );
    ui.protocolCombo->addItem("HTTP", QVariant("http"));
    ui.protocolCombo->addItem("HTTPS", QVariant("https"));
    ui.protocolCombo->addItem("FTP", QVariant("ftp"));
    ui.protocolCombo->addItem("MMS", QVariant("mms"));
    ui.protocolCombo->addItem("RTSP", QVariant("rtsp"));
    ui.protocolCombo->addItem("UDP/RTP (unicast)", QVariant("udp"));
    ui.protocolCombo->addItem("UDP/RTP (multicast)", QVariant("udp"));
    ui.protocolCombo->addItem("RTMP", QVariant("rtmp"));
zorglub's avatar
zorglub committed
432
433
}

434
435
436
NetOpenPanel::~NetOpenPanel()
{}

zorglub's avatar
zorglub committed
437
void NetOpenPanel::clear()
438
439
{}

440
/* update the widgets according the type of protocol */
441
void NetOpenPanel::updateProtocol( int idx_proto ) {
zorglub's avatar
zorglub committed
442
    QString addr = ui.addressText->text();
443
    QString proto = ui.protocolCombo->itemData( idx_proto ).toString();
zorglub's avatar
zorglub committed
444

445
446
    ui.timeShift->setEnabled( idx_proto == UDP_PROTO ||
                              idx_proto == UDPM_PROTO );
447
448
    ui.ipv6->setEnabled( idx_proto == UDP_PROTO );
    ui.addressText->setEnabled( idx_proto != UDP_PROTO );
449
450
    ui.portSpin->setEnabled( idx_proto == UDP_PROTO ||
                             idx_proto == UDPM_PROTO );
451
452

    if( idx_proto == NO_PROTO ) return;
zorglub's avatar
zorglub committed
453
454

    /* If we already have a protocol in the address, replace it */
455
456
457
458
459
460
    if( addr.contains( "://"))
    {
        if( idx_proto != UDPM_PROTO )
            addr.replace( QRegExp("^.*://@*"), proto + "://");
        else
             addr.replace( QRegExp("^.*://"), proto + "://@");
461
        ui.addressText->setText( addr );
zorglub's avatar
zorglub committed
462
463
    }
    updateMRL();
zorglub's avatar
zorglub committed
464
}
465

zorglub's avatar
zorglub committed
466
467
468
void NetOpenPanel::updateMRL() {
    QString mrl = "";
    QString addr = ui.addressText->text();
469
    addr = QUrl::toPercentEncoding( addr, ":/?#@!$&'()*+,;=" );
470
    int idx_proto = ui.protocolCombo->currentIndex();
zorglub's avatar
zorglub committed
471

472
    if( addr.contains( "://"))
473
    {
474
475
476
477
478
479
        /* Match the correct item in the comboBox */
        ui.protocolCombo->setCurrentIndex(
                ui.protocolCombo->findData( addr.section( ':', 0, 0 ) ) );

        if( idx_proto != UDP_PROTO || idx_proto != UDPM_PROTO )
            mrl = addr;
480
481
482
    }
    else
    {
483
484
        switch( idx_proto ) {
        case HTTP_PROTO:
zorglub's avatar
zorglub committed
485
            mrl = "http://" + addr;
486
487
            emit methodChanged("http-caching");
            break;
488
        case HTTPS_PROTO:
489
            mrl = "https://" + addr;
zorglub's avatar
zorglub committed
490
491
            emit methodChanged("http-caching");
            break;
492
        case MMS_PROTO:
zorglub's avatar
zorglub committed
493
494
495
            mrl = "mms://" + addr;
            emit methodChanged("mms-caching");
            break;
496
        case FTP_PROTO:
zorglub's avatar
zorglub committed
497
498
499
            mrl = "ftp://" + addr;
            emit methodChanged("ftp-caching");
            break;
500
        case RTSP_PROTO:
zorglub's avatar
zorglub committed
501
502
503
            mrl = "rtsp://" + addr;
            emit methodChanged("rtsp-caching");
            break;
504
        case UDP_PROTO:
zorglub's avatar
zorglub committed
505
            mrl = "udp://@";
506
507
            if( ui.ipv6->isEnabled() && ui.ipv6->isChecked() )
            {
zorglub's avatar
zorglub committed
508
509
                mrl += "[::]";
            }
510
            mrl += QString(":%1").arg( ui.portSpin->value() );
zorglub's avatar
zorglub committed
511
512
            emit methodChanged("udp-caching");
            break;
513
        case UDPM_PROTO: /* UDP multicast */
zorglub's avatar
zorglub committed
514
515
            mrl = "udp://@";
            /* Add [] to IPv6 */
516
517
            if ( addr.contains(':') && !addr.contains('[') )
            {
zorglub's avatar
zorglub committed
518
                mrl += "[" + addr + "]";
519
520
            }
            else mrl += addr;
521
            mrl += QString(":%1").arg( ui.portSpin->value() );
zorglub's avatar
zorglub committed
522
            emit methodChanged("udp-caching");
523
524
525
526
527
        case RTMP_PROTO:
            mrl = "rtmp://" + addr;
            emit methodChanged("rtmp-caching");
            break;

zorglub's avatar
zorglub committed
528
529
        }
    }
530
531

    // Encode the boring stuffs
532

zorglub's avatar
zorglub committed
533
534
535
    if( ui.timeShift->isEnabled() && ui.timeShift->isChecked() ) {
        mrl += " :access-filter=timeshift";
    }
536
    emit mrlUpdated( mrl );
zorglub's avatar
zorglub committed
537
}
538
539

/**************************************************************************
540
 * Open Capture device ( DVB, PVR, V4L, and similar )                     *
541
542
543
544
545
 **************************************************************************/
CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
                                OpenPanel( _parent, _p_intf )
{
    ui.setupUi( this );
546

547
548
    BUTTONACT( ui.advancedButton, advancedDialog() );

549
    /* Create two stacked layouts in the main comboBoxes */
550
551
552
553
554
555
    QStackedLayout *stackedDevLayout = new QStackedLayout;
    ui.cardBox->setLayout( stackedDevLayout );

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

556
    /* Creation and connections of the WIdgets in the stacked layout */
557
#define addModuleAndLayouts( number, name, label )                    \
558
559
    QWidget * name ## DevPage = new QWidget( this );                  \
    QWidget * name ## PropPage = new QWidget( this );                 \
560
561
    stackedDevLayout->addWidget( name ## DevPage );        \
    stackedPropLayout->addWidget( name ## PropPage );      \
562
563
564
565
    QGridLayout * name ## DevLayout = new QGridLayout;                \
    QGridLayout * name ## PropLayout = new QGridLayout;               \
    name ## DevPage->setLayout( name ## DevLayout );                  \
    name ## PropPage->setLayout( name ## PropLayout );                \
566
    ui.deviceCombo->addItem( qtr( label ), QVariant( number ) );
567
568
569

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

570
571
572
573
574
575
576
577
578
#ifdef WIN32
    /*********************
     * DirectShow Stuffs *
     *********************/
    if( module_Exists( p_intf, "dshow" ) ){
    addModuleAndLayouts( DSHOW_DEVICE, dshow, "DirectShow" );

    /* dshow Main */
    int line = 0;
579
    module_config_t *p_config =
580
        config_FindConfig( VLC_OBJECT(p_intf), "dshow-vdev" );
581
    vdevDshowW = new StringListConfigControl(
582
583
584
585
        VLC_OBJECT(p_intf), p_config, this, false, dshowDevLayout, line );
    line++;

    p_config = config_FindConfig( VLC_OBJECT(p_intf), "dshow-adev" );
586
    adevDshowW = new StringListConfigControl(
587
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
668
669
        VLC_OBJECT(p_intf), p_config, this, false, dshowDevLayout, line );
    line++;

    /* 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 */
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
703
704
    /*******
     * 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 ) );
    }

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

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

715
    v4lVideoDevice = new QLineEdit;
716
    v4lDevLayout->addWidget( v4lVideoDevice, 0, 1 );
717

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

721
    v4lAudioDevice = new QLineEdit;
722
723
    v4lDevLayout->addWidget( v4lAudioDevice, 1, 1 );

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

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

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

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

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

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

    /* Jack Main panel */
    /* Channels */
758
    QLabel *jackChannelsLabel = new QLabel( qtr( "Channels:" ) );
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
759
760
761
762
763
764
765
766
767
768
    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 */
769

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

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

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
778
    /* Caching */
779
    QLabel *jackCachingLabel = new QLabel( qtr( "Input caching:" ) );
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
780
781
782
783
784
785
786
    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 );
787

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

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

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

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

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

814
815
    pvrDevice = new QLineEdit;
    pvrDevLayout->addWidget( pvrDevice, 0, 1 );
816

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

820
821
    pvrRadioDevice = new QLineEdit;
    pvrDevLayout->addWidget( pvrRadioDevice, 1, 1 );
822

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

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

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

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

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

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

    /* PVR CONNECTs */
852
853
    CuMRL( pvrDevice, textChanged( QString ) );
    CuMRL( pvrRadioDevice, textChanged( QString ) );
854
855

    CuMRL( pvrFreq, valueChanged ( int ) );
856
    CuMRL( pvrBitr, valueChanged ( int ) );
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
918
919
    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
920
921


922
923
924
925
926
927
928
929
930
    /**********
     * 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 );

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

#undef addModule
940
941
942
}

CaptureOpenPanel::~CaptureOpenPanel()
943
944
{
}
945

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

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
951
void CaptureOpenPanel::updateMRL()
952
953
{
    QString mrl = "";
954
955
    int i_devicetype = ui.deviceCombo->itemData(
            ui.deviceCombo->currentIndex() ).toInt();
956
957
    switch( i_devicetype )
    {
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
#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://";
974
975
        mrl+= " :dshow-vdev=" + QString("\"%1\"").arg( vdevDshowW->getValue() );
        mrl+= " :dshow-adev=" + QString("\"%1\"").arg( adevDshowW->getValue() );
976
977
        if( dshowVSizeLine->isModified() )
            mrl += " :dshow-size=" + dshowVSizeLine->text();
978
979
        break;
#else
980
981
982
983
984
985
986
    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;
987
988
989
990
991
992
    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
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
    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;
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
    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;
1023
#endif
1024
1025
1026
    case SCREEN_DEVICE:
        mrl = "screen://";
        updateButtons();
1027
1028
        break;
    }
1029
1030
1031

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

1032
1033
1034
    emit mrlUpdated( mrl );
}

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