]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/open_panels.hpp
34a8c018abfb464ef632e919ce8e18ce651922e4
[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 FileOpenPanel: public OpenPanel
99 {
100     Q_OBJECT;
101 public:
102     FileOpenPanel( QWidget *, intf_thread_t * );
103     virtual ~FileOpenPanel();
104     virtual void clear() ;
105     virtual void accept() ;
106 private:
107     Ui::OpenFile ui;
108 public slots:
109     virtual void updateMRL();
110 private slots:
111     void browseFileSub();
112     void browseFile();
113     void deleteFile();
114     void toggleSubtitleFrame( bool );
115 };
116
117 class NetOpenPanel: public OpenPanel
118 {
119     Q_OBJECT;
120 public:
121     NetOpenPanel( QWidget *, intf_thread_t * );
122     virtual ~NetOpenPanel();
123     virtual void clear() ;
124 private:
125     Ui::OpenNetwork ui;
126     QStringListModel *mrlList;
127 public slots:
128     virtual void updateMRL();
129 private slots:
130     void updateProtocol( int );
131     void updateCompleter();
132 };
133
134 class DiscOpenPanel: public OpenPanel
135 {
136     Q_OBJECT;
137 public:
138     DiscOpenPanel( QWidget *, intf_thread_t * );
139     virtual ~DiscOpenPanel();
140     virtual void clear() ;
141     virtual void accept() ;
142 private:
143     Ui::OpenDisk ui;
144     char *psz_dvddiscpath, *psz_vcddiscpath, *psz_cddadiscpath;
145     bool b_firstdvd, b_firstvcd, b_firstcdda;
146 public slots:
147     virtual void updateMRL() ;
148 private slots:
149     void browseDevice();
150     void updateButtons() ;
151     void eject();
152 };
153
154
155 class CaptureOpenPanel: public OpenPanel
156 {
157     Q_OBJECT;
158 public:
159     CaptureOpenPanel( QWidget *, intf_thread_t * );
160     virtual ~CaptureOpenPanel();
161     virtual void clear() ;
162 private:
163     Ui::OpenCapture ui;
164     bool isInitialized;
165
166     QString advMRL;
167     QDialog *adv;
168 #ifdef WIN32
169     QRadioButton *bdas, *bdat, *bdac, *bdaa;
170     QSpinBox *bdaCard, *bdaFreq, *bdaSrate;
171     QLabel *bdaSrateLabel, *bdaBandLabel;
172     QComboBox *bdaBandBox;
173     StringListConfigControl *vdevDshowW, *adevDshowW;
174     QLineEdit *dshowVSizeLine;
175 #else
176     QRadioButton *dvbs, *dvbt, *dvbc;
177     QSpinBox  *v4lFreq, *pvrFreq, *pvrBitr;
178     QLineEdit *v4lVideoDevice, *v4lAudioDevice;
179     QLineEdit *v4l2VideoDevice, *v4l2AudioDevice;
180     QLineEdit *pvrDevice, *pvrRadioDevice;
181     QComboBox *v4lNormBox, *v4l2StdBox, *pvrNormBox;
182     QSpinBox *dvbCard, *dvbFreq, *dvbSrate;
183     QSpinBox *jackChannels, *jackCaching;
184     QCheckBox *jackPace, *jackConnect;
185     QLineEdit *jackPortsSelected;
186 #endif
187     QSpinBox *screenFPS;
188
189 public slots:
190     virtual void updateMRL();
191     void initialize();
192 private slots:
193     void updateButtons();
194     void advancedDialog();
195 };
196
197 #endif