]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/open_panels.hpp
Qt: Kill more warnings.
[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 class QWidget;
75 class QLineEdit;
76 class QString;
77 class QStringListModel;
78
79 class OpenPanel: public QWidget
80 {
81     Q_OBJECT;
82 public:
83     OpenPanel( QWidget *p, intf_thread_t *_p_intf ) : QWidget( p )
84     {
85         p_intf = _p_intf;
86     }
87     virtual ~OpenPanel() {};
88     virtual void clear() = 0;
89 protected:
90     intf_thread_t *p_intf;
91 public slots:
92     virtual void updateMRL() = 0;
93 signals:
94     void mrlUpdated( QString );
95     void methodChanged( QString method );
96 };
97
98 class FileOpenBox: public QFileDialog
99 {
100     Q_OBJECT;
101 public:
102     FileOpenBox( QWidget *parent, const QString &caption,
103         const QString &directory, const QString &filter ):
104         QFileDialog( parent, caption, directory, filter ) {}
105 public slots:
106     void accept();
107     void reject();
108 };
109
110 class FileOpenPanel: public OpenPanel
111 {
112     Q_OBJECT;
113 public:
114     FileOpenPanel( QWidget *, intf_thread_t * );
115     virtual ~FileOpenPanel();
116     virtual void clear() ;
117     virtual void accept() ;
118 private:
119     Ui::OpenFile ui;
120     QStringList browse( QString );
121     FileOpenBox *dialogBox;
122     QLineEdit *lineFileEdit;
123     QStringList fileCompleteList ;
124 public slots:
125     virtual void updateMRL();
126 private slots:
127     void browseFileSub();
128     void toggleSubtitleFrame();
129 };
130
131 class NetOpenPanel: public OpenPanel
132 {
133     Q_OBJECT;
134 public:
135     NetOpenPanel( QWidget *, intf_thread_t * );
136     virtual ~NetOpenPanel();
137     virtual void clear() ;
138 private:
139     Ui::OpenNetwork ui;
140     QStringListModel *mrlList;
141 public slots:
142     virtual void updateMRL();
143 private slots:
144     void updateProtocol( int );
145     void updateCompleter();
146 };
147
148 class DiscOpenPanel: public OpenPanel
149 {
150     Q_OBJECT;
151 public:
152     DiscOpenPanel( QWidget *, intf_thread_t * );
153     virtual ~DiscOpenPanel();
154     virtual void clear() ;
155     virtual void accept() ;
156 private:
157     Ui::OpenDisk ui;
158     char *psz_dvddiscpath, *psz_vcddiscpath, *psz_cddadiscpath;
159     bool b_firstdvd, b_firstvcd, b_firstcdda;
160 public slots:
161     virtual void updateMRL() ;
162 private slots:
163     void browseDevice();
164     void updateButtons() ;
165     void eject();
166 };
167
168
169 class CaptureOpenPanel: public OpenPanel
170 {
171     Q_OBJECT;
172 public:
173     CaptureOpenPanel( QWidget *, intf_thread_t * );
174     virtual ~CaptureOpenPanel();
175     virtual void clear() ;
176 private:
177     Ui::OpenCapture ui;
178     bool isInitialized;
179
180     QString advMRL;
181     QDialog *adv;
182 #ifdef WIN32
183     QRadioButton *bdas, *bdat, *bdac, *bdaa;
184     QSpinBox *bdaCard, *bdaFreq, *bdaSrate;
185     QLabel *bdaSrateLabel, *bdaBandLabel;
186     QComboBox *bdaBandBox;
187     StringListConfigControl *vdevDshowW, *adevDshowW;
188     QLineEdit *dshowVSizeLine;
189 #else
190     QRadioButton *dvbs, *dvbt, *dvbc;
191     QSpinBox  *v4lFreq, *pvrFreq, *pvrBitr;
192     QLineEdit *v4lVideoDevice, *v4lAudioDevice;
193     QLineEdit *v4l2VideoDevice, *v4l2AudioDevice;
194     QLineEdit *pvrDevice, *pvrRadioDevice;
195     QComboBox *v4lNormBox, *v4l2StdBox, *pvrNormBox;
196     QSpinBox *dvbCard, *dvbFreq, *dvbSrate;
197     QSpinBox *jackChannels, *jackCaching;
198     QCheckBox *jackPace, *jackConnect;
199     QLineEdit *jackPortsSelected;
200 #endif
201     QSpinBox *screenFPS;
202
203 public slots:
204     virtual void updateMRL();
205     void initialize();
206 private slots:
207     void updateButtons();
208     void advancedDialog();
209 };
210
211 #endif