Qt4 - Open: start to use a completer, use an enum and no stupid #define.
authorJean-Baptiste Kempf <jb@videolan.org>
Tue, 9 Oct 2007 02:20:07 +0000 (02:20 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Tue, 9 Oct 2007 02:20:07 +0000 (02:20 +0000)
modules/gui/qt4/components/open.cpp
modules/gui/qt4/components/open.hpp

index 380c5fe..a7545b2 100644 (file)
@@ -37,6 +37,7 @@
 #include <QLineEdit>
 #include <QStackedLayout>
 #include <QListView>
+#include <QCompleter>
 
 /**************************************************************************
  * Open Files and subtitles                                               *
@@ -96,6 +97,12 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
 #else
     lineFileEdit = findChildren<QLineEdit*>()[3];
 #endif
+
+    QStringList fileCompleteList ;
+    QCompleter *fileCompleter = new QCompleter( fileCompleteList, this );
+
+    lineFileEdit->setCompleter( fileCompleter );
+
 //    lineFileEdit->hide();
 
     /* Make a list of QLabel inside the QFileDialog to access the good ones */
@@ -564,7 +571,7 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     jackDevLayout->addWidget( jackChannels, 1, 1 );
 
     /* Jack Props panel */
+
     /* Selected ports */
     QLabel *jackPortsLabel = new QLabel( qtr( "Selected ports :" ) );
     jackPropLayout->addWidget( jackPortsLabel, 0 , 0 );
@@ -572,7 +579,7 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     jackPortsSelected = new QLineEdit( qtr( ".*") );
     jackPortsSelected->setAlignment( Qt::AlignRight );
     jackPropLayout->addWidget( jackPortsSelected, 0, 1 );
+
     /* Caching */
     QLabel *jackCachingLabel = new QLabel( qtr( "Input caching :" ) );
     jackPropLayout->addWidget( jackCachingLabel, 1 , 0 );
@@ -582,15 +589,15 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     jackCaching->setValue(1000);
     jackCaching->setAlignment( Qt::AlignRight );
     jackPropLayout->addWidget( jackCaching, 1 , 1 );
+
     /* Pace */
     jackPace = new QCheckBox(qtr( "Use VLC pace" ));
     jackPropLayout->addWidget( jackPace, 2, 1 );
+
     /* Auto Connect */
     jackConnect = new QCheckBox( qtr( "Auto connnection" ));
     jackPropLayout->addWidget( jackConnect, 3, 1 );
+
     /* Jack CONNECTs */
     CuMRL( jackChannels, valueChanged( int ) );
     CuMRL( jackCaching, valueChanged( int ) );
index 69be347..7334491 100644 (file)
 #define setSpinBoxFreq( spinbox ){ spinbox->setRange ( 0, INT_MAX ); \
     spinbox->setAccelerated( true ); }
 
-#define V4L_DEVICE         0
-#define PVR_DEVICE         1
-#define DVB_DEVICE         2
-#define BDA_DEVICE         3
-#define DSHOW_DEVICE     4
-#define SCREEN_DEVICE      5
-#define JACK_DEVICE        6
+enum
+{
+    V4L_DEVICE,
+    PVR_DEVICE,
+    DVB_DEVICE,
+    BDA_DEVICE,
+    DSHOW_DEVICE,
+    SCREEN_DEVICE,
+    JACK_DEVICE
+};
 
 class QWidget;
 class QLineEdit;