]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/open_panels.hpp
Qt: add a --qt-embedded-open option to have the 0.9 integration of open panel using...
[vlc] / modules / gui / qt4 / components / open_panels.hpp
1 /*****************************************************************************
2  * open.hpp : Panels for the open dialogs
3  ****************************************************************************
4  * Copyright (C) 2006-2009 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( QStringList, 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
111 class FileOpenPanel: public OpenPanel
112 {
113     Q_OBJECT;
114 public:
115     FileOpenPanel( QWidget *, intf_thread_t * );
116     virtual ~FileOpenPanel();
117     virtual void clear() ;
118     virtual void accept() ;
119 protected:
120     bool eventFilter(QObject *obj, QEvent *event)
121     {
122         if( event->type() == QEvent::Hide ||
123             event->type() == QEvent::HideToParent )
124         {
125             msg_Warn( p_intf, "here" );
126             event->accept();
127             return true;
128         }
129         return false;
130     }
131 private:
132     Ui::OpenFile ui;
133     FileOpenBox *dialogBox;
134     void BuildOldPanel();
135 public slots:
136     virtual void updateMRL();
137 private slots:
138     void browseFileSub();
139     void browseFile();
140     void deleteFile();
141     void toggleSubtitleFrame( bool );
142 };
143
144 class NetOpenPanel: public OpenPanel
145 {
146     Q_OBJECT;
147 public:
148     NetOpenPanel( QWidget *, intf_thread_t * );
149     virtual ~NetOpenPanel();
150     virtual void clear() ;
151 private:
152     Ui::OpenNetwork ui;
153     QStringListModel *mrlList;
154 public slots:
155     virtual void updateMRL();
156 private slots:
157     void updateProtocol( int );
158     void updateCompleter();
159 };
160
161 class DiscOpenPanel: public OpenPanel
162 {
163     Q_OBJECT;
164 public:
165     DiscOpenPanel( QWidget *, intf_thread_t * );
166     virtual ~DiscOpenPanel();
167     virtual void clear() ;
168     virtual void accept() ;
169 private:
170     Ui::OpenDisk ui;
171     char *psz_dvddiscpath, *psz_vcddiscpath, *psz_cddadiscpath;
172     bool b_firstdvd, b_firstvcd, b_firstcdda;
173 public slots:
174     virtual void updateMRL() ;
175 private slots:
176     void browseDevice();
177     void updateButtons() ;
178     void eject();
179 };
180
181
182 class CaptureOpenPanel: public OpenPanel
183 {
184     Q_OBJECT;
185 public:
186     CaptureOpenPanel( QWidget *, intf_thread_t * );
187     virtual ~CaptureOpenPanel();
188     virtual void clear() ;
189 private:
190     Ui::OpenCapture ui;
191     bool isInitialized;
192
193     QString advMRL;
194     QDialog *adv;
195 #ifdef WIN32
196     QRadioButton *bdas, *bdat, *bdac, *bdaa;
197     QSpinBox *bdaCard, *bdaFreq, *bdaSrate;
198     QLabel *bdaSrateLabel, *bdaBandLabel;
199     QComboBox *bdaBandBox;
200     StringListConfigControl *vdevDshowW, *adevDshowW;
201     QLineEdit *dshowVSizeLine;
202 #else
203     QRadioButton *dvbs, *dvbt, *dvbc;
204     QSpinBox  *v4lFreq, *pvrFreq, *pvrBitr;
205     QLineEdit *v4lVideoDevice, *v4lAudioDevice;
206     QLineEdit *v4l2VideoDevice, *v4l2AudioDevice;
207     QLineEdit *pvrDevice, *pvrRadioDevice;
208     QComboBox *v4lNormBox, *v4l2StdBox, *pvrNormBox;
209     QSpinBox *dvbCard, *dvbFreq, *dvbSrate;
210     QSpinBox *jackChannels, *jackCaching;
211     QCheckBox *jackPace, *jackConnect;
212     QLineEdit *jackPortsSelected;
213 #endif
214     QSpinBox *screenFPS;
215
216 public slots:
217     virtual void updateMRL();
218     void initialize();
219 private slots:
220     void updateButtons();
221     void advancedDialog();
222 };
223
224 #endif