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