]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/open_panels.hpp
Qt: respect font sizes
[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     V4L_DEVICE,
52     V4L2_DEVICE,
53     PVR_DEVICE,
54     DVB_DEVICE,
55     BDA_DEVICE,
56     DSHOW_DEVICE,
57     SCREEN_DEVICE,
58     JACK_DEVICE
59 };
60
61 class QWidget;
62 class QLineEdit;
63 class QString;
64 class QStringListModel;
65
66 class OpenPanel: public QWidget
67 {
68     Q_OBJECT;
69 public:
70     OpenPanel( QWidget *p, intf_thread_t *_p_intf ) : QWidget( p )
71     {
72         p_intf = _p_intf;
73     }
74     virtual ~OpenPanel() {};
75     virtual void clear() = 0;
76 protected:
77     intf_thread_t *p_intf;
78 public slots:
79     virtual void updateMRL() = 0;
80 signals:
81     void mrlUpdated( const QStringList&, const QString& );
82     void methodChanged( const QString& method );
83 };
84
85 class FileOpenBox: public QFileDialog
86 {
87     Q_OBJECT;
88 public:
89     FileOpenBox( QWidget *parent, const QString &caption,
90                  const QString &directory, const QString &filter ):
91                 QFileDialog( parent, caption, directory, filter ) {}
92 public slots:
93     void accept(){}
94     void reject(){}
95 };
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 protected:
107     bool eventFilter(QObject *obj, QEvent *event)
108     {
109         if( event->type() == QEvent::Hide ||
110             event->type() == QEvent::HideToParent )
111         {
112             event->accept();
113             return true;
114         }
115         return false;
116     }
117 private:
118     Ui::OpenFile ui;
119     FileOpenBox *dialogBox;
120     void BuildOldPanel();
121 public slots:
122     virtual void updateMRL();
123 private slots:
124     void browseFileSub();
125     void browseFile();
126     void removeFile();
127     void updateButtons();
128     void toggleSubtitleFrame( bool );
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 updateCompleter();
145 };
146
147 class DiscOpenPanel: public OpenPanel
148 {
149     Q_OBJECT;
150 public:
151     DiscOpenPanel( QWidget *, intf_thread_t * );
152     virtual ~DiscOpenPanel();
153     virtual void clear() ;
154     virtual void accept() ;
155 private:
156     Ui::OpenDisk ui;
157     char *psz_dvddiscpath, *psz_vcddiscpath, *psz_cddadiscpath;
158     bool b_firstdvd, b_firstvcd, b_firstcdda;
159 public slots:
160     virtual void updateMRL() ;
161 private slots:
162     void browseDevice();
163     void updateButtons() ;
164     void eject();
165 };
166
167
168 class CaptureOpenPanel: public OpenPanel
169 {
170     Q_OBJECT;
171 public:
172     CaptureOpenPanel( QWidget *, intf_thread_t * );
173     virtual ~CaptureOpenPanel();
174     virtual void clear() ;
175 private:
176     Ui::OpenCapture ui;
177     bool isInitialized;
178
179     QString advMRL;
180     QDialog *adv;
181 #ifdef WIN32
182     QRadioButton *bdas, *bdat, *bdac, *bdaa;
183     QSpinBox *bdaCard, *bdaFreq, *bdaSrate;
184     QLabel *bdaSrateLabel, *bdaBandLabel;
185     QComboBox *bdaBandBox;
186     StringListConfigControl *vdevDshowW, *adevDshowW;
187     QLineEdit *dshowVSizeLine;
188 #else
189     QRadioButton *dvbs, *dvbt, *dvbc;
190     QLabel *dvbBandLabel, *dvbSrateLabel;
191     QSpinBox  *v4lFreq, *pvrFreq, *pvrBitr;
192     QLineEdit *v4lVideoDevice, *v4lAudioDevice;
193     QLineEdit *v4l2VideoDevice, *v4l2AudioDevice;
194     QLineEdit *pvrDevice, *pvrRadioDevice;
195     QComboBox *v4lNormBox, *v4l2StdBox, *pvrNormBox, *dvbBandBox;
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