]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/open_panels.hpp
Qt4 - Open: management of advanced options in capture cards. Mainly finish the open...
[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 static const char *psz_devModule[] = { "v4l", "v4l2", "pvr", "dvb", "bda",
62                                        "dshow", "screen", "jack" };
63
64
65 class QWidget;
66 class QLineEdit;
67 class QString;
68
69 class OpenPanel: public QWidget
70 {
71     Q_OBJECT;
72 public:
73     OpenPanel( QWidget *p, intf_thread_t *_p_intf ) : QWidget( p )
74     {
75         p_intf = _p_intf;
76     }
77     virtual ~OpenPanel() {};
78     virtual void clear() = 0;
79 protected:
80     intf_thread_t *p_intf;
81 public slots:
82     virtual void updateMRL() = 0;
83 signals:
84     void mrlUpdated( QString );
85     void methodChanged( QString method );
86 };
87
88 class FileOpenBox: public QFileDialog
89 {
90     Q_OBJECT;
91 public:
92     FileOpenBox( QWidget *parent, const QString &caption,
93         const QString &directory, const QString &filter ):
94         QFileDialog( parent, caption, directory, filter ) {}
95 public slots:
96     void accept();
97 };
98
99 class FileOpenPanel: public OpenPanel
100 {
101     Q_OBJECT;
102 public:
103     FileOpenPanel( QWidget *, intf_thread_t * );
104     virtual ~FileOpenPanel();
105     virtual void clear() ;
106     virtual void accept() ;
107 private:
108     Ui::OpenFile ui;
109     QStringList browse( QString );
110     FileOpenBox *dialogBox;
111     QLineEdit *lineFileEdit;
112     QStringList fileCompleteList ;
113 public slots:
114     virtual void updateMRL();
115 private slots:
116     void browseFileSub();
117     void toggleSubtitleFrame();
118 };
119
120 class NetOpenPanel: public OpenPanel
121 {
122     Q_OBJECT;
123 public:
124     NetOpenPanel( QWidget *, intf_thread_t * );
125     virtual ~NetOpenPanel();
126     virtual void clear() ;
127 private:
128     Ui::OpenNetwork ui;
129 public slots:
130     virtual void updateMRL();
131 private slots:
132     void updateProtocol( int );
133 };
134
135 class DiscOpenPanel: public OpenPanel
136 {
137     Q_OBJECT;
138 public:
139     DiscOpenPanel( QWidget *, intf_thread_t * );
140     virtual ~DiscOpenPanel();
141     virtual void clear() ;
142     virtual void accept() ;
143 private:
144     Ui::OpenDisk ui;
145     char *psz_dvddiscpath, *psz_vcddiscpath, *psz_cddadiscpath;
146     bool b_firstdvd, b_firstvcd, b_firstcdda;
147 public slots:
148     virtual void updateMRL() ;
149 private slots:
150     void browseDevice();
151     void updateButtons() ;
152 };
153
154
155 class CaptureOpenPanel: public OpenPanel
156 {
157     Q_OBJECT;
158 public:
159     CaptureOpenPanel( QWidget *, intf_thread_t * );
160     virtual ~CaptureOpenPanel();
161     virtual void clear() ;
162 private:
163     Ui::OpenCapture ui;
164     QString advMRL;
165     QDialog *adv;
166 #ifdef WIN32
167     QRadioButton *bdas, *bdat, *bdac;
168     QSpinBox *bdaCard, *bdaFreq, *bdaSrate;
169     QLabel *bdaSrateLabel, *bdaBandLabel;
170     QComboBox *bdaBandBox;
171     StringListConfigControl *vdevDshowW, *adevDshowW;
172     QLineEdit *dshowVSizeLine;
173 #else
174     QRadioButton *dvbs, *dvbt, *dvbc;
175     QSpinBox  *v4lFreq, *pvrFreq, *pvrBitr;
176     QLineEdit *v4lVideoDevice, *v4lAudioDevice;
177     QLineEdit *v4l2VideoDevice, *v4l2AudioDevice;
178     QLineEdit *pvrDevice, *pvrRadioDevice;
179     QComboBox *v4lNormBox, *v4l2StdBox, *pvrNormBox;
180     QSpinBox *dvbCard, *dvbFreq, *dvbSrate;
181     QSpinBox *jackChannels, *jackCaching;
182     QCheckBox *jackPace, *jackConnect;
183     QLineEdit *jackPortsSelected;
184 #endif
185
186 public slots:
187     virtual void updateMRL();
188 private slots:
189     void updateButtons();
190     void advancedDialog();
191 };
192
193 #endif