]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/open_panels.hpp
Qt: NetOpenPanel: add drop-down list
[vlc] / modules / gui / qt4 / components / open_panels.hpp
index ee973472bc13b5eba315af4f8c6a59775f102180..bef2c8c6a3ea7259bf138fb5a3a5acd9e0d528ea 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * open.hpp : Panels for the open dialogs
  ****************************************************************************
- * Copyright (C) 2006-2007 the VideoLAN team
+ * Copyright (C) 2006-2009 the VideoLAN team
  * Copyright (C) 2007 Société des arts technologiques
  * Copyright (C) 2007 Savoir-faire Linux
  * $Id$
 # include "config.h"
 #endif
 
-#include <vlc_common.h>
-
-#include <QFileDialog>
+#include "components/preferences_widgets.hpp"
 
 #include "ui/open_file.h"
 #include "ui/open_disk.h"
 #include "ui/open_net.h"
 #include "ui/open_capture.h"
 
-#include "components/preferences_widgets.hpp"
+#include <QFileDialog>
 
 #include <limits.h>
 
 #define setSpinBoxFreq( spinbox ){ spinbox->setRange ( 0, INT_MAX ); \
     spinbox->setAccelerated( true ); }
 
-enum
-{
-    NO_PROTO,
-    HTTP_PROTO,
-    HTTPS_PROTO,
-    MMS_PROTO,
-    FTP_PROTO,
-    RTSP_PROTO,
-    RTP_PROTO,
-    UDP_PROTO,
-    RTMP_PROTO
-};
-
-
 enum
 {
     V4L_DEVICE,
@@ -74,17 +58,15 @@ enum
     JACK_DEVICE
 };
 
-static const char *psz_devModule[] = { "v4l", "v4l2", "pvr", "dvb", "bda",
-                                       "dshow", "screen", "jack" };
-
-
 class QWidget;
 class QLineEdit;
 class QString;
+class QStringListModel;
+class QEvent;
 
 class OpenPanel: public QWidget
 {
-    Q_OBJECT;
+    Q_OBJECT
 public:
     OpenPanel( QWidget *p, intf_thread_t *_p_intf ) : QWidget( p )
     {
@@ -97,61 +79,95 @@ protected:
 public slots:
     virtual void updateMRL() = 0;
 signals:
-    void mrlUpdated( QString );
-    void methodChanged( QString method );
+    void mrlUpdated( const QStringList&, const QString& );
+    void methodChanged( const QString& method );
 };
 
 class FileOpenBox: public QFileDialog
 {
-    Q_OBJECT;
+    Q_OBJECT
 public:
     FileOpenBox( QWidget *parent, const QString &caption,
-        const QString &directory, const QString &filter ):
-        QFileDialog( parent, caption, directory, filter ) {}
+                 const QString &directory, const QString &filter ):
+                QFileDialog( parent, caption, directory, filter ) {}
 public slots:
-    void accept();
-    void reject();
+    void accept(){}
+    void reject(){}
 };
 
+
 class FileOpenPanel: public OpenPanel
 {
-    Q_OBJECT;
+    Q_OBJECT
 public:
     FileOpenPanel( QWidget *, intf_thread_t * );
     virtual ~FileOpenPanel();
     virtual void clear() ;
     virtual void accept() ;
+protected:
+    bool eventFilter(QObject *obj, QEvent *event)
+    {
+        if( event->type() == QEvent::Hide ||
+            event->type() == QEvent::HideToParent )
+        {
+            event->accept();
+            return true;
+        }
+        return false;
+    }
+    virtual void dropEvent( QDropEvent *);
+    virtual void dragEnterEvent( QDragEnterEvent * );
+    virtual void dragMoveEvent( QDragMoveEvent * );
+    virtual void dragLeaveEvent( QDragLeaveEvent * );
 private:
     Ui::OpenFile ui;
-    QStringList browse( QString );
     FileOpenBox *dialogBox;
-    QLineEdit *lineFileEdit;
-    QStringList fileCompleteList ;
+    void BuildOldPanel();
 public slots:
     virtual void updateMRL();
 private slots:
     void browseFileSub();
-    void toggleSubtitleFrame();
+    void browseFile();
+    void removeFile();
+    void updateButtons();
+    void toggleSubtitleFrame( bool );
 };
 
 class NetOpenPanel: public OpenPanel
 {
-    Q_OBJECT;
+    Q_OBJECT
 public:
     NetOpenPanel( QWidget *, intf_thread_t * );
     virtual ~NetOpenPanel();
     virtual void clear() ;
 private:
     Ui::OpenNetwork ui;
+    QStringListModel *mrlList;
 public slots:
     virtual void updateMRL();
 private slots:
-    void updateProtocol( int );
+    void updateModel();
+};
+
+class UrlValidator : public QValidator
+{
+   Q_OBJECT
+public:
+   UrlValidator( QObject *parent ) : QValidator( parent ) { }
+   void fixup( QString& ) const;
+   QValidator::State validate( QString&, int& ) const;
 };
 
 class DiscOpenPanel: public OpenPanel
 {
-    Q_OBJECT;
+    Q_OBJECT
+    enum    DiscType
+    {
+        None,
+        Dvd,
+        Vcd,
+        Cdda
+    };
 public:
     DiscOpenPanel( QWidget *, intf_thread_t * );
     virtual ~DiscOpenPanel();
@@ -160,7 +176,7 @@ public:
 private:
     Ui::OpenDisk ui;
     char *psz_dvddiscpath, *psz_vcddiscpath, *psz_cddadiscpath;
-    bool b_firstdvd, b_firstvcd, b_firstcdda;
+    DiscType    m_discType;
 public slots:
     virtual void updateMRL() ;
 private slots:
@@ -172,17 +188,19 @@ private slots:
 
 class CaptureOpenPanel: public OpenPanel
 {
-    Q_OBJECT;
+    Q_OBJECT
 public:
     CaptureOpenPanel( QWidget *, intf_thread_t * );
     virtual ~CaptureOpenPanel();
     virtual void clear() ;
 private:
     Ui::OpenCapture ui;
+    bool isInitialized;
+
     QString advMRL;
     QDialog *adv;
 #ifdef WIN32
-    QRadioButton *bdas, *bdat, *bdac;
+    QRadioButton *bdas, *bdat, *bdac, *bdaa, *bdaq;
     QSpinBox *bdaCard, *bdaFreq, *bdaSrate;
     QLabel *bdaSrateLabel, *bdaBandLabel;
     QComboBox *bdaBandBox;
@@ -190,19 +208,22 @@ private:
     QLineEdit *dshowVSizeLine;
 #else
     QRadioButton *dvbs, *dvbt, *dvbc;
+    QLabel *dvbBandLabel, *dvbSrateLabel;
     QSpinBox  *v4lFreq, *pvrFreq, *pvrBitr;
     QLineEdit *v4lVideoDevice, *v4lAudioDevice;
     QLineEdit *v4l2VideoDevice, *v4l2AudioDevice;
     QLineEdit *pvrDevice, *pvrRadioDevice;
-    QComboBox *v4lNormBox, *v4l2StdBox, *pvrNormBox;
+    QComboBox *v4lNormBox, *v4l2StdBox, *pvrNormBox, *dvbBandBox;
     QSpinBox *dvbCard, *dvbFreq, *dvbSrate;
     QSpinBox *jackChannels, *jackCaching;
     QCheckBox *jackPace, *jackConnect;
     QLineEdit *jackPortsSelected;
 #endif
+    QDoubleSpinBox *screenFPS;
 
 public slots:
     virtual void updateMRL();
+    void initialize();
 private slots:
     void updateButtons();
     void advancedDialog();