]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/open_panels.hpp
Qt: Simplify includes.
[vlc] / modules / gui / qt4 / components / open_panels.hpp
1 /*****************************************************************************
2  * open.hpp : Panels for the open dialogs
3  ****************************************************************************
4  * Copyright (C) 2006-2008 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 "components/preferences_widgets.hpp"
36
37 #include "ui/open_file.h"
38 #include "ui/open_disk.h"
39 #include "ui/open_net.h"
40 #include "ui/open_capture.h"
41
42 #include <QFileDialog>
43
44 #include <limits.h>
45
46 #define setSpinBoxFreq( spinbox ){ spinbox->setRange ( 0, INT_MAX ); \
47     spinbox->setAccelerated( true ); }
48
49 enum
50 {
51     NO_PROTO,
52     HTTP_PROTO,
53     HTTPS_PROTO,
54     MMS_PROTO,
55     FTP_PROTO,
56     RTSP_PROTO,
57     RTP_PROTO,
58     UDP_PROTO,
59     RTMP_PROTO
60 };
61
62 enum
63 {
64     V4L_DEVICE,
65     V4L2_DEVICE,
66     PVR_DEVICE,
67     DVB_DEVICE,
68     BDA_DEVICE,
69     DSHOW_DEVICE,
70     SCREEN_DEVICE,
71     JACK_DEVICE
72 };
73
74 static const char *psz_devModule[] = { "v4l", "v4l2", "pvr", "dvb", "bda",
75                                        "dshow", "screen", "jack" };
76
77 class QWidget;
78 class QLineEdit;
79 class QString;
80 class QStringListModel;
81
82 class OpenPanel: public QWidget
83 {
84     Q_OBJECT;
85 public:
86     OpenPanel( QWidget *p, intf_thread_t *_p_intf ) : QWidget( p )
87     {
88         p_intf = _p_intf;
89     }
90     virtual ~OpenPanel() {};
91     virtual void clear() = 0;
92 protected:
93     intf_thread_t *p_intf;
94 public slots:
95     virtual void updateMRL() = 0;
96 signals:
97     void mrlUpdated( QString );
98     void methodChanged( QString method );
99 };
100
101 class FileOpenBox: public QFileDialog
102 {
103     Q_OBJECT;
104 public:
105     FileOpenBox( QWidget *parent, const QString &caption,
106         const QString &directory, const QString &filter ):
107         QFileDialog( parent, caption, directory, filter ) {}
108 public slots:
109     void accept();
110     void reject();
111 };
112
113 class FileOpenPanel: public OpenPanel
114 {
115     Q_OBJECT;
116 public:
117     FileOpenPanel( QWidget *, intf_thread_t * );
118     virtual ~FileOpenPanel();
119     virtual void clear() ;
120     virtual void accept() ;
121 private:
122     Ui::OpenFile ui;
123     QStringList browse( QString );
124     FileOpenBox *dialogBox;
125     QLineEdit *lineFileEdit;
126     QStringList fileCompleteList ;
127 public slots:
128     virtual void updateMRL();
129 private slots:
130     void browseFileSub();
131     void toggleSubtitleFrame();
132 };
133
134 class NetOpenPanel: public OpenPanel
135 {
136     Q_OBJECT;
137 public:
138     NetOpenPanel( QWidget *, intf_thread_t * );
139     virtual ~NetOpenPanel();
140     virtual void clear() ;
141 private:
142     Ui::OpenNetwork ui;
143     QStringListModel *mrlList;
144 public slots:
145     virtual void updateMRL();
146 private slots:
147     void updateProtocol( int );
148     void updateCompleter();
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     bool isInitialized;
182
183     QString advMRL;
184     QDialog *adv;
185 #ifdef WIN32
186     QRadioButton *bdas, *bdat, *bdac, *bdaa;
187     QSpinBox *bdaCard, *bdaFreq, *bdaSrate;
188     QLabel *bdaSrateLabel, *bdaBandLabel;
189     QComboBox *bdaBandBox;
190     StringListConfigControl *vdevDshowW, *adevDshowW;
191     QLineEdit *dshowVSizeLine;
192 #else
193     QRadioButton *dvbs, *dvbt, *dvbc;
194     QSpinBox  *v4lFreq, *pvrFreq, *pvrBitr;
195     QLineEdit *v4lVideoDevice, *v4lAudioDevice;
196     QLineEdit *v4l2VideoDevice, *v4l2AudioDevice;
197     QLineEdit *pvrDevice, *pvrRadioDevice;
198     QComboBox *v4lNormBox, *v4l2StdBox, *pvrNormBox;
199     QSpinBox *dvbCard, *dvbFreq, *dvbSrate;
200     QSpinBox *jackChannels, *jackCaching;
201     QCheckBox *jackPace, *jackConnect;
202     QLineEdit *jackPortsSelected;
203 #endif
204     QSpinBox *screenFPS;
205
206 public slots:
207     virtual void updateMRL();
208     void initialize();
209 private slots:
210     void updateButtons();
211     void advancedDialog();
212 };
213
214 #endif