]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/open_panels.cpp
Qt: do not prefix VCD chapter with 'E'
[vlc] / modules / gui / qt4 / components / open_panels.cpp
index b55b08c85279a2d6d0f17a6232dcaca4dd59c21b..d032761bae3e123081bc50e3bb17bae616a20173 100644 (file)
@@ -336,6 +336,29 @@ DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     ui.deviceCombo->setToolTip( qtr(I_DEVICE_TOOLTIP) );
     ui.deviceCombo->setInsertPolicy( QComboBox::InsertAtTop );
 
+    /* CONNECTs */
+    BUTTONACT( ui.dvdRadioButton,     updateButtons() );
+    BUTTONACT( ui.bdRadioButton,      updateButtons() );
+    BUTTONACT( ui.vcdRadioButton,     updateButtons() );
+    BUTTONACT( ui.audioCDRadioButton, updateButtons() );
+    BUTTONACT( ui.dvdsimple,          updateButtons() );
+    BUTTONACT( ui.browseDiscButton, browseDevice() );
+    BUTTON_SET_ACT_I( ui.ejectButton, "", toolbar/eject, qtr( "Eject the disc" ),
+            eject() );
+
+    CONNECT( ui.deviceCombo, editTextChanged( QString ), this, updateMRL());
+    CONNECT( ui.deviceCombo, currentIndexChanged( 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());
+
+    /* Run once the updateButtons function in order to fill correctly the comboBoxes */
+    updateButtons();
+}
+
+void DiscOpenPanel::onFocus()
+{
 #ifdef WIN32 /* Disc drives probing for Windows */
     wchar_t szDrives[512];
     szDrives[0] = '\0';
@@ -375,24 +398,7 @@ DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     POPULATE_WITH_DEVS( ppsz_discdevices, discCombo );
 #endif
 
-    /* CONNECTs */
-    BUTTONACT( ui.dvdRadioButton, updateButtons() );
-    BUTTONACT( ui.vcdRadioButton, updateButtons() );
-    BUTTONACT( ui.audioCDRadioButton, updateButtons() );
-    BUTTONACT( ui.dvdsimple, updateButtons() );
-    BUTTONACT( ui.browseDiscButton, browseDevice() );
-    BUTTON_SET_ACT_I( ui.ejectButton, "", toolbar/eject, qtr( "Eject the disc" ),
-            eject() );
-
-    CONNECT( ui.deviceCombo, editTextChanged( QString ), this, updateMRL());
-    CONNECT( ui.deviceCombo, currentIndexChanged( 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());
 
-    /* Run once the updateButtons function in order to fill correctly the comboBoxes */
-    updateButtons();
 }
 
 DiscOpenPanel::~DiscOpenPanel()
@@ -436,6 +442,19 @@ void DiscOpenPanel::updateButtons()
         ui.diskOptionBox_2->show();
         ui.dvdsimple->setEnabled( true );
     }
+    if ( ui.bdRadioButton->isChecked() )
+    {
+        if( m_discType != BRD )
+        {
+            setDrive( psz_dvddiscpath );
+            m_discType = BRD;
+        }
+        ui.titleLabel->setText( qtr("Title") );
+        ui.chapterLabel->hide();
+        ui.chapterSpin->hide();
+        ui.diskOptionBox_2->hide();
+        ui.dvdsimple->setEnabled( true );
+    }
     else if ( ui.vcdRadioButton->isChecked() )
     {
         if( m_discType != Vcd )
@@ -500,14 +519,15 @@ void DiscOpenPanel::updateMRL()
                 mrl+= QString(":%1").arg( ui.chapterSpin->value() );
             }
         }
+    } else if ( ui.bdRadioButton->isChecked() ) {
+        mrl = "bluray://" LOCALHOST + discPath;
 
     /* VCD */
     } else if ( ui.vcdRadioButton->isChecked() ) {
         mrl = "vcd://" LOCALHOST + discPath;
 
-        if( ui.titleSpin->value() > 0 ) {
-            mrl += QString("@E%1").arg( ui.titleSpin->value() );
-        }
+        if( ui.titleSpin->value() > 0 )
+            mrl += QString("@%1").arg( ui.titleSpin->value() );
 
     /* CDDA */
     } else {
@@ -565,40 +585,48 @@ NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
                                 OpenPanel( _parent, _p_intf )
 {
     ui.setupUi( this );
+    CONNECT( ui.urlComboBox, editTextChanged( const QString& ), this, updateMRL());
 
-    /* CONNECTs */
-    CONNECT( ui.urlComboBox->lineEdit(), textChanged( const QString& ), this, updateMRL());
-    CONNECT( ui.urlComboBox, currentIndexChanged( const QString& ), this, updateMRL());
-
+    /* */
     if( var_InheritBool( p_intf, "qt-recentplay" ) )
     {
-        mrlList = new QStringListModel(
-                getSettings()->value( "Open/netMRL" ).toStringList() );
-        ui.urlComboBox->setModel( mrlList );
-        ui.urlComboBox->clearEditText();
-        CONNECT( ui.urlComboBox->lineEdit(), editingFinished(), this, updateModel() );
+        b_recentList = true;
+        ui.urlComboBox->addItems( getSettings()->value( "OpenDialog/netMRL" ).toStringList() );
+        ui.urlComboBox->setMaxCount( 10 );
     }
     else
-        mrlList = NULL;
+        b_recentList = false;
 
+    /* Use a simple validator for URLs */
     ui.urlComboBox->setValidator( new UrlValidator( this ) );
     ui.urlComboBox->setFocus();
 }
 
 NetOpenPanel::~NetOpenPanel()
 {
-    if( !mrlList ) return;
-
-    QStringList tempL = mrlList->stringList();
-    while( tempL.count() > 8 ) tempL.removeFirst();
+    if( !b_recentList ) return;
 
-    getSettings()->setValue( "Open/netMRL", tempL );
+    /* Create the list with the current items */
+    QStringList mrlList;
+    for( int i = 0; i < ui.urlComboBox->count(); i++ )
+        mrlList << ui.urlComboBox->itemText( i );
 
-    delete mrlList;
+    /* Clean the list... */
+    mrlList.removeDuplicates();
+    /* ...and save the 8 last entries */
+    getSettings()->setValue( "OpenDialog/netMRL", mrlList );
 }
 
 void NetOpenPanel::clear()
-{}
+{
+    ui.urlComboBox->clear();
+}
+
+void NetOpenPanel::onAccept()
+{
+    if( ui.urlComboBox->findText( ui.urlComboBox->currentText() ) == -1 )
+        ui.urlComboBox->insertItem( 0, ui.urlComboBox->currentText());
+}
 
 void NetOpenPanel::onFocus()
 {
@@ -610,6 +638,9 @@ void NetOpenPanel::updateMRL()
 {
     QString url = ui.urlComboBox->lineEdit()->text();
 
+    if( url.isEmpty() )
+        return;
+
     emit methodChanged( qfu( "network-caching" ) );
 
     QStringList qsl;
@@ -617,20 +648,6 @@ void NetOpenPanel::updateMRL()
     emit mrlUpdated( qsl, "" );
 }
 
-void NetOpenPanel::updateModel()
-{
-    assert( mrlList );
-    QStringList tempL = mrlList->stringList();
-    if( !tempL.contains( ui.urlComboBox->lineEdit()->text() ) )
-        tempL.append( ui.urlComboBox->lineEdit()->text() );
-    mrlList->setStringList( tempL );
-}
-
-void UrlValidator::fixup( QString& str ) const
-{
-    str = str.trimmed();
-}
-
 QValidator::State UrlValidator::validate( QString& str, int& ) const
 {
     if( str.contains( ' ' ) )
@@ -640,6 +657,11 @@ QValidator::State UrlValidator::validate( QString& str, int& ) const
     return QValidator::Acceptable;
 }
 
+void UrlValidator::fixup( QString& str ) const
+{
+    str = str.trimmed();
+}
+
 /**************************************************************************
  * Open Capture device ( DVB, PVR, V4L, and similar )                     *
  **************************************************************************/
@@ -653,7 +675,6 @@ void CaptureOpenPanel::initialize()
 {
     if( isInitialized ) return;
 
-    msg_Dbg( p_intf, "Initialization of Capture device panel" );
     isInitialized = true;
 
     ui.setupUi( this );
@@ -714,6 +735,7 @@ void CaptureOpenPanel::initialize()
     CuMRL( vdevDshowW->combo, currentIndexChanged ( int ) );
     CuMRL( adevDshowW->combo, currentIndexChanged ( int ) );
     CuMRL( dshowVSizeLine, textChanged( const QString& ) );
+    configList << "dshow-vdev" << "dshow-adev" << "dshow-size";
     }
 #else /* WIN32 */
     /*******
@@ -726,12 +748,7 @@ void CaptureOpenPanel::initialize()
         "video*"
     };
 
-    char const * const ppsz_v4ladevices[] = {
-        "dsp*",
-        "radio*"
-    };
-
-    /* V4l Main panel */
+    /* V4L2 main panel */
     QLabel *v4l2VideoDeviceLabel = new QLabel( qtr( "Video device name" ) );
     v4l2DevLayout->addWidget( v4l2VideoDeviceLabel, 0, 0 );
 
@@ -746,7 +763,17 @@ void CaptureOpenPanel::initialize()
 
     v4l2AudioDevice = new QComboBox( this );
     v4l2AudioDevice->setEditable( true );
-    POPULATE_WITH_DEVS( ppsz_v4ladevices, v4l2AudioDevice );
+    {
+        QStringList patterns = QStringList();
+        patterns << QString( "pcmC*D*c" );
+
+        QStringList nodes = QDir( "/dev/snd" ).entryList( patterns,
+                                                          QDir::System );
+        QStringList names = nodes.replaceInStrings( QRegExp("^pcmC"), "hw:" )
+                                 .replaceInStrings( QRegExp("c$"), "" )
+                                 .replaceInStrings( QRegExp("D"), "," );
+        v4l2AudioDevice->addItems( names );
+    }
     v4l2AudioDevice->clearEditText();
     v4l2DevLayout->addWidget( v4l2AudioDevice, 1, 1 );
 
@@ -766,6 +793,7 @@ void CaptureOpenPanel::initialize()
     CuMRL( v4l2AudioDevice->lineEdit(), textChanged( const QString& ) );
     CuMRL( v4l2AudioDevice,  currentIndexChanged ( int ) );
     CuMRL( v4l2StdBox,  currentIndexChanged ( int ) );
+    configList << "v4l2-standard" << "v4l2-dev";
     }
 
     /*******
@@ -810,6 +838,7 @@ void CaptureOpenPanel::initialize()
     CuMRL( jackPace, stateChanged( int ) );
     CuMRL( jackConnect, stateChanged( int ) );
     CuMRL( jackPortsSelected, textChanged( const QString& ) );
+    configList << "jack-input-use-vlc-pace" << "jack-input-auto-connect";
     }
 
     /************
@@ -866,6 +895,8 @@ void CaptureOpenPanel::initialize()
     CuMRL( pvrFreq, valueChanged ( int ) );
     CuMRL( pvrBitr, valueChanged ( int ) );
     CuMRL( pvrNormBox, currentIndexChanged ( int ) );
+    configList << "pvr-device" << "pvr-radio-device" << "pvr-norm"
+               << "pvr-frequency" << "pvr-bitrate";
     }
 #endif
     /*************
@@ -984,6 +1015,8 @@ void CaptureOpenPanel::initialize()
     BUTTONACT( dvbs2, updateMRL() );
     BUTTONACT( atsc, updateMRL() );
     BUTTONACT( cqam, updateMRL() );
+    configList << "dvb-adapter" << "dvb-frequency" << "dvb-modulation"
+               << "dvb-bandwidth";
     }
 
     /**********
@@ -1052,8 +1085,9 @@ void CaptureOpenPanel::updateMRL()
 #else
     case V4L2_DEVICE:
         fileList << "v4l2://" + v4l2VideoDevice->currentText();
+        mrl += ":v4l2-standard="
+            + v4l2StdBox->itemData( v4l2StdBox->currentIndex() ).toString();
         mrl += " :input-slave=alsa://" + v4l2AudioDevice->currentText();
-        mrl += " :v4l2-standard=" + QString::number( v4l2StdBox->currentIndex() );
         break;
     case JACK_DEVICE:
         mrl = "jack://";
@@ -1225,9 +1259,15 @@ void CaptureOpenPanel::advancedDialog()
     for( int n = 0; n < (int)i_confsize; n++ )
     {
         module_config_t *p_item = p_config + n;
+        QString name = p_item->psz_name;
+
+        if( name.isEmpty() || configList.contains( name ) )
+            continue;
+
+        msg_Err( p_intf, "%s", p_item->psz_name);
         ConfigControl *config = ConfigControl::createControl(
                         VLC_OBJECT( p_intf ), p_item, advFrame, gLayout, n );
-        if ( config )
+        if( config )
             controls.append( config );
     }
 
@@ -1279,7 +1319,6 @@ void CaptureOpenPanel::advancedDialog()
         }
         advMRL = tempMRL;
         updateMRL();
-        msg_Dbg( p_intf, "%s", qtu( advMRL ) );
     }
     qDeleteAll( controls );
     delete adv;