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