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