]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/open_panels.hpp
This reverts commit bc9de538a898afed013b5367f64440965e073b22.
[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 #ifdef HAVE_CONFIG_H
32 # include "config.h"
33 #endif
34
35 #include <vlc_common.h>
36
37 #include <QFileDialog>
38
39 #include "ui/open_file.h"
40 #include "ui/open_disk.h"
41 #include "ui/open_net.h"
42 #include "ui/open_capture.h"
43
44 #include "components/preferences_widgets.hpp"
45
46 #include <limits.h>
47
48 #define setSpinBoxFreq( spinbox ){ spinbox->setRange ( 0, INT_MAX ); \
49     spinbox->setAccelerated( true ); }
50
51 enum
52 {
53     NO_PROTO,
54     HTTP_PROTO,
55     HTTPS_PROTO,
56     MMS_PROTO,
57     FTP_PROTO,
58     RTSP_PROTO,
59     RTP_PROTO,
60     UDP_PROTO,
61     RTMP_PROTO
62 };
63
64
65 enum
66 {
67     V4L_DEVICE,
68     V4L2_DEVICE,
69     PVR_DEVICE,
70     DVB_DEVICE,
71     BDA_DEVICE,
72     DSHOW_DEVICE,
73     SCREEN_DEVICE,
74     JACK_DEVICE
75 };
76
77 static const char *psz_devModule[] = { "v4l", "v4l2", "pvr", "dvb", "bda",
78                                        "dshow", "screen", "jack" };
79
80
81 class QWidget;
82 class QLineEdit;
83 class QString;
84
85 class OpenPanel: public QWidget
86 {
87     Q_OBJECT;
88 public:
89     OpenPanel( QWidget *p, intf_thread_t *_p_intf ) : QWidget( p )
90     {
91         p_intf = _p_intf;
92     }
93     virtual ~OpenPanel() {};
94     virtual void clear() = 0;
95 protected:
96     intf_thread_t *p_intf;
97 public slots:
98     virtual void updateMRL() = 0;
99 signals:
100     void mrlUpdated( QString );
101     void methodChanged( QString method );
102 };
103
104 class FileOpenBox: public QFileDialog
105 {
106     Q_OBJECT;
107 public:
108     FileOpenBox( QWidget *parent, const QString &caption,
109         const QString &directory, const QString &filter ):
110         QFileDialog( parent, caption, directory, filter ) {}
111 public slots:
112     void accept();
113 };
114
115 class FileOpenPanel: public OpenPanel
116 {
117     Q_OBJECT;
118 public:
119     FileOpenPanel( QWidget *, intf_thread_t * );
120     virtual ~FileOpenPanel();
121     virtual void clear() ;
122     virtual void accept() ;
123 private:
124     Ui::OpenFile ui;
125     QStringList browse( QString );
126     FileOpenBox *dialogBox;
127     QLineEdit *lineFileEdit;
128     QStringList fileCompleteList ;
129 public slots:
130     virtual void updateMRL();
131 private slots:
132     void browseFileSub();
133     void toggleSubtitleFrame();
134 };
135
136 class NetOpenPanel: public OpenPanel
137 {
138     Q_OBJECT;
139 public:
140     NetOpenPanel( QWidget *, intf_thread_t * );
141     virtual ~NetOpenPanel();
142     virtual void clear() ;
143 private:
144     Ui::OpenNetwork ui;
145 public slots:
146     virtual void updateMRL();
147 private slots:
148     void updateProtocol( int );
149 };
150
151 class DiscOpenPanel: public OpenPanel
152 {
153     Q_OBJECT;
154 public:
155     DiscOpenPanel( QWidget *, intf_thread_t * );
156     virtual ~DiscOpenPanel();
157     virtual void clear() ;
158     virtual void accept() ;
159 private:
160     Ui::OpenDisk ui;
161     char *psz_dvddiscpath, *psz_vcddiscpath, *psz_cddadiscpath;
162     bool b_firstdvd, b_firstvcd, b_firstcdda;
163 public slots:
164     virtual void updateMRL() ;
165 private slots:
166     void browseDevice();
167     void updateButtons() ;
168     void eject();
169 };
170
171
172 class CaptureOpenPanel: public OpenPanel
173 {
174     Q_OBJECT;
175 public:
176     CaptureOpenPanel( QWidget *, intf_thread_t * );
177     virtual ~CaptureOpenPanel();
178     virtual void clear() ;
179 private:
180     Ui::OpenCapture ui;
181     QString advMRL;
182     QDialog *adv;
183 #ifdef WIN32
184     QRadioButton *bdas, *bdat, *bdac;
185     QSpinBox *bdaCard, *bdaFreq, *bdaSrate;
186     QLabel *bdaSrateLabel, *bdaBandLabel;
187     QComboBox *bdaBandBox;
188     StringListConfigControl *vdevDshowW, *adevDshowW;
189     QLineEdit *dshowVSizeLine;
190 #else
191     QRadioButton *dvbs, *dvbt, *dvbc;
192     QSpinBox  *v4lFreq, *pvrFreq, *pvrBitr;
193     QLineEdit *v4lVideoDevice, *v4lAudioDevice;
194     QLineEdit *v4l2VideoDevice, *v4l2AudioDevice;
195     QLineEdit *pvrDevice, *pvrRadioDevice;
196     QComboBox *v4lNormBox, *v4l2StdBox, *pvrNormBox;
197     QSpinBox *dvbCard, *dvbFreq, *dvbSrate;
198     QSpinBox *jackChannels, *jackCaching;
199     QCheckBox *jackPace, *jackConnect;
200     QLineEdit *jackPortsSelected;
201 #endif
202
203 public slots:
204     virtual void updateMRL();
205 private slots:
206     void updateButtons();
207     void advancedDialog();
208 };
209
210 #endif