]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/open_panels.cpp
Qt: NetOpenPanel: add drop-down list
[vlc] / modules / gui / qt4 / components / open_panels.cpp
index a32d77e22741ac93e5ce6380764c9c75d805a68e..ae75fc6b2e362fa19cab554387be2be37b2bb876 100644 (file)
@@ -36,6 +36,7 @@
 #include "dialogs_provider.hpp" /* Open Subtitle file */
 #include "util/qt_dirs.hpp"
 #include <vlc_intf_strings.h>
+#include <vlc_modules.h>
 
 #include <QFileDialog>
 #include <QDialogButtonBox>
@@ -538,21 +539,22 @@ NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     ui.setupUi( this );
 
     /* CONNECTs */
-    CONNECT( ui.urlText, textChanged( const QString& ), this, updateMRL());
+    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() );
-        QCompleter *completer = new QCompleter( mrlList, this );
-        ui.urlText->setCompleter( completer );
-
-        CONNECT( ui.urlText, editingFinished(), this, updateCompleter() );
+        ui.urlComboBox->setModel( mrlList );
+        ui.urlComboBox->clearEditText();
+        CONNECT( ui.urlComboBox->lineEdit(), editingFinished(), this, updateModel() );
     }
     else
         mrlList = NULL;
 
-    ui.urlText->setValidator( new UrlValidator( this ) );
+    ui.urlComboBox->setValidator( new UrlValidator( this ) );
+    ui.urlComboBox->setFocus();
 }
 
 NetOpenPanel::~NetOpenPanel()
@@ -600,7 +602,7 @@ void NetOpenPanel::updateMRL()
         { "udp",   "udp"   },
     };
 
-    QString url = ui.urlText->text();
+    QString url = ui.urlComboBox->lineEdit()->text();
     if( !url.contains( "://") )
         return; /* nothing to do this far */
 
@@ -617,12 +619,12 @@ void NetOpenPanel::updateMRL()
     emit mrlUpdated( qsl, "" );
 }
 
-void NetOpenPanel::updateCompleter()
+void NetOpenPanel::updateModel()
 {
     assert( mrlList );
     QStringList tempL = mrlList->stringList();
-    if( !tempL.contains( ui.urlText->text() ) )
-        tempL.append( ui.urlText->text() );
+    if( !tempL.contains( ui.urlComboBox->lineEdit()->text() ) )
+        tempL.append( ui.urlComboBox->lineEdit()->text() );
     mrlList->setStringList( tempL );
 }
 
@@ -730,12 +732,14 @@ void CaptureOpenPanel::initialize()
     bdac = new QRadioButton( "DVB-C" );
     bdat = new QRadioButton( "DVB-T" );
     bdaa = new QRadioButton( "ATSC" );
+    bdaq = new QRadioButton( "Clear QAM" );
 
     bdaDevLayout->addWidget( bdaTypeLabel, 0, 0 );
     bdaDevLayout->addWidget( bdas, 0, 1 );
     bdaDevLayout->addWidget( bdac, 0, 2 );
     bdaDevLayout->addWidget( bdat, 0, 3 );
     bdaDevLayout->addWidget( bdaa, 0, 4 );
+    bdaDevLayout->addWidget( bdaq, 0, 5 );
 
     /* bda Props */
     QLabel *bdaFreqLabel =
@@ -778,10 +782,12 @@ void CaptureOpenPanel::initialize()
     BUTTONACT( bdat, updateButtons() );
     BUTTONACT( bdac, updateButtons() );
     BUTTONACT( bdaa, updateButtons() );
+    BUTTONACT( bdaq, updateButtons() );
     BUTTONACT( bdas, updateMRL() );
     BUTTONACT( bdat, updateMRL() );
     BUTTONACT( bdac, updateMRL() );
     BUTTONACT( bdaa, updateMRL() );
+    BUTTONACT( bdaq, updateMRL() );
     }
 
 #else /* WIN32 */
@@ -1120,6 +1126,7 @@ void CaptureOpenPanel::updateMRL()
         else if(  bdat->isChecked() ) mrl = "dvb-t://";
         else if(  bdac->isChecked() ) mrl = "dvb-c://";
         else if(  bdaa->isChecked() ) mrl = "atsc://";
+        else if(  bdaq->isChecked() ) mrl = "cqam://";
         else return;
         mrl += "frequency=" + QString::number( bdaFreq->value() );
         if( bdac->isChecked() || bdat->isChecked() || bdaa->isChecked() )
@@ -1243,6 +1250,13 @@ void CaptureOpenPanel::updateButtons()
             bdaBandBox->show();
             bdaBandLabel->show();
         }
+        else if( bdaq->isChecked() )
+        {
+            bdaSrate->hide();
+            bdaSrateLabel->hide();
+            bdaBandBox->hide();
+            bdaBandLabel->hide();
+        }
         break;
 #else
     case DVB_DEVICE: