]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/open_panels.hpp
Qt4 - Open Capture: work on DirectShow Capture cards.
[vlc] / modules / gui / qt4 / components / open_panels.hpp
1 /*****************************************************************************
2  * open.hpp : Panels for the open dialogs
3  ****************************************************************************
4  * Copyright (C) 2006-2007 the VideoLAN team
5  * Copyright (C) 2007 Société des arts technologiques
6  * Copyright (C) 2007 Savoir-faire Linux
7  * $Id$
8  *
9  * Authors: Clément Stenac <zorglub@videolan.org>
10  *          Jean-Baptiste Kempf <jb@videolan.org>
11  *          Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
12  *
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 2 of the License, or
16  * (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
26  *****************************************************************************/
27
28 #ifndef _OPENPANELS_H_
29 #define _OPENPANELS_H_
30
31 #include <vlc/vlc.h>
32
33 #include <QFileDialog>
34
35 #include "ui/open_file.h"
36 #include "ui/open_disk.h"
37 #include "ui/open_net.h"
38 #include "ui/open_capture.h"
39
40 #include "components/preferences_widgets.hpp"
41
42 #ifdef HAVE_LIMITS_H
43 #   include <limits.h>
44 #endif
45
46 #define setSpinBoxFreq( spinbox ){ spinbox->setRange ( 0, INT_MAX ); \
47     spinbox->setAccelerated( true ); }
48
49 enum
50 {
51     V4L_DEVICE,
52     V4L2_DEVICE,
53     PVR_DEVICE,
54     DVB_DEVICE,
55     BDA_DEVICE,
56     DSHOW_DEVICE,
57     SCREEN_DEVICE,
58     JACK_DEVICE
59 };
60
61 class QWidget;
62 class QLineEdit;
63 class QString;
64
65 class OpenPanel: public QWidget
66 {
67     Q_OBJECT;
68 public:
69     OpenPanel( QWidget *p, intf_thread_t *_p_intf ) : QWidget( p )
70     {
71         p_intf = _p_intf;
72     }
73     virtual ~OpenPanel() {};
74     virtual void clear() = 0;
75 protected:
76     intf_thread_t *p_intf;
77 public slots:
78     virtual void updateMRL() = 0;
79 signals:
80     void mrlUpdated( QString );
81     void methodChanged( QString method );
82 };
83
84 class FileOpenBox: public QFileDialog
85 {
86     Q_OBJECT;
87 public:
88     FileOpenBox( QWidget *parent, const QString &caption,
89         const QString &directory, const QString &filter ):
90         QFileDialog( parent, caption, directory, filter ) {}
91 public slots:
92     void accept();
93 };
94
95 class FileOpenPanel: public OpenPanel
96 {
97     Q_OBJECT;
98 public:
99     FileOpenPanel( QWidget *, intf_thread_t * );
100     virtual ~FileOpenPanel();
101     virtual void clear() ;
102     virtual void accept() ;
103 private:
104     Ui::OpenFile ui;
105     QStringList browse( QString );
106     FileOpenBox *dialogBox;
107     QLineEdit *lineFileEdit;
108     QStringList fileCompleteList ;
109 public slots:
110     virtual void updateMRL();
111 private slots:
112     void browseFileSub();
113     void toggleSubtitleFrame();
114 };
115
116 class NetOpenPanel: public OpenPanel
117 {
118     Q_OBJECT;
119 public:
120     NetOpenPanel( QWidget *, intf_thread_t * );
121     virtual ~NetOpenPanel();
122     virtual void clear() ;
123 private:
124     Ui::OpenNetwork ui;
125 public slots:
126     virtual void updateMRL();
127 private slots:
128     void updateProtocol( int );
129 };
130
131 class DiscOpenPanel: public OpenPanel
132 {
133     Q_OBJECT;
134 public:
135     DiscOpenPanel( QWidget *, intf_thread_t * );
136     virtual ~DiscOpenPanel();
137     virtual void clear() ;
138     virtual void accept() ;
139 private:
140     Ui::OpenDisk ui;
141     char *psz_dvddiscpath, *psz_vcddiscpath, *psz_cddadiscpath;
142     bool b_firstdvd, b_firstvcd, b_firstcdda;
143 public slots:
144     virtual void updateMRL() ;
145 private slots:
146     void browseDevice();
147     void updateButtons() ;
148 };
149
150
151 class CaptureOpenPanel: public OpenPanel
152 {
153     Q_OBJECT;
154 public:
155     CaptureOpenPanel( QWidget *, intf_thread_t * );
156     virtual ~CaptureOpenPanel();
157     virtual void clear() ;
158 private:
159     Ui::OpenCapture ui;
160 #ifdef WIN32
161     QRadioButton *bdas, *bdat, *bdac;
162     QSpinBox *bdaCard, *bdaFreq, *bdaSrate;
163     QLabel *bdaSrateLabel, *bdaBandLabel;
164     QComboBox *bdaBandBox;
165     StringListConfigControl *vdevDshowW, *adevDshowW;
166     QLineEdit *dshowVSizeLine;
167 #else
168     QRadioButton *dvbs, *dvbt, *dvbc;
169     QSpinBox  *v4lFreq, *pvrFreq, *pvrBitr;
170     QLineEdit *v4lVideoDevice, *v4lAudioDevice;
171     QLineEdit *v4l2VideoDevice, *v4l2AudioDevice;
172     QLineEdit *pvrDevice, *pvrRadioDevice;
173     QComboBox *v4lNormBox, *v4l2StdBox, *pvrNormBox;
174     QSpinBox *dvbCard, *dvbFreq, *dvbSrate;
175     QSpinBox *jackChannels, *jackCaching;
176     QCheckBox *jackPace, *jackConnect;
177     QLineEdit *jackPortsSelected;
178 #endif
179
180 public slots:
181     virtual void updateMRL();
182 private slots:
183     void updateButtons();
184 };
185
186 #endif