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
9 * Authors: Clément Stenac <zorglub@videolan.org>
10 * Jean-Baptiste Kempf <jb@videolan.org>
11 * Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
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.
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.
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 *****************************************************************************/
28 #ifndef _OPENPANELS_H_
29 #define _OPENPANELS_H_
35 #include "components/preferences_widgets.hpp"
37 #include "ui/open_file.h"
38 #include "ui/open_disk.h"
39 #include "ui/open_net.h"
40 #include "ui/open_capture.h"
42 #include <QFileDialog>
46 #define setSpinBoxFreq( spinbox ){ spinbox->setRange ( 0, INT_MAX ); \
47 spinbox->setAccelerated( true ); }
62 class QStringListModel;
65 class OpenPanel: public QWidget
69 OpenPanel( QWidget *p, intf_thread_t *_p_intf ) : QWidget( p )
73 virtual ~OpenPanel() {};
74 virtual void clear() = 0;
75 virtual void onFocus() {}
76 virtual void onAccept() {}
78 intf_thread_t *p_intf;
80 virtual void updateMRL() = 0;
82 void mrlUpdated( const QStringList&, const QString& );
83 void methodChanged( const QString& method );
86 class FileOpenBox: public QFileDialog
90 FileOpenBox( QWidget *parent, const QString &caption,
91 const QString &directory, const QString &filter ):
92 QFileDialog( parent, caption, directory, filter ) {}
99 class FileOpenPanel: public OpenPanel
103 FileOpenPanel( QWidget *, intf_thread_t * );
104 virtual ~FileOpenPanel();
105 virtual void clear() ;
106 virtual void accept() ;
108 bool eventFilter(QObject *, QEvent *event)
110 if( event->type() == QEvent::Hide ||
111 event->type() == QEvent::HideToParent )
118 virtual void dropEvent( QDropEvent *);
119 virtual void dragEnterEvent( QDragEnterEvent * );
120 virtual void dragMoveEvent( QDragMoveEvent * );
121 virtual void dragLeaveEvent( QDragLeaveEvent * );
124 FileOpenBox *dialogBox;
125 void BuildOldPanel();
127 virtual void updateMRL();
129 void browseFileSub();
132 void updateButtons();
133 void toggleSubtitleFrame( bool );
136 class NetOpenPanel: public OpenPanel
140 NetOpenPanel( QWidget *, intf_thread_t * );
141 virtual ~NetOpenPanel();
142 virtual void clear() ;
149 virtual void updateMRL();
152 class UrlValidator : public QValidator
156 UrlValidator( QObject *parent ) : QValidator( parent ) { }
157 void fixup( QString& ) const;
158 QValidator::State validate( QString&, int& ) const;
161 class DiscOpenPanel: public OpenPanel
173 DiscOpenPanel( QWidget *, intf_thread_t * );
174 virtual ~DiscOpenPanel();
175 virtual void clear() ;
176 virtual void accept() ;
180 char *psz_dvddiscpath, *psz_vcddiscpath, *psz_cddadiscpath;
183 virtual void updateMRL() ;
186 void updateButtons() ;
191 class CaptureOpenPanel: public OpenPanel
195 CaptureOpenPanel( QWidget *, intf_thread_t * );
196 virtual ~CaptureOpenPanel();
197 virtual void clear() ;
205 StringListConfigControl *vdevDshowW, *adevDshowW;
206 QLineEdit *dshowVSizeLine;
208 QSpinBox *pvrFreq, *pvrBitr;
209 QComboBox *v4l2VideoDevice, *v4l2AudioDevice;
210 QLineEdit *pvrDevice, *pvrRadioDevice;
211 QComboBox *v4l2StdBox, *pvrNormBox;
212 QSpinBox *jackChannels;
213 QCheckBox *jackPace, *jackConnect;
214 QLineEdit *jackPortsSelected;
216 QRadioButton *dvbc, *dvbs, *dvbs2, *dvbt, *dvbt2, *atsc, *cqam;
217 QLabel *dvbBandLabel, *dvbSrateLabel, *dvbModLabel;
218 QComboBox *dvbQamBox, *dvbPskBox, *dvbBandBox;
219 QSpinBox *dvbCard, *dvbFreq, *dvbSrate;
220 QDoubleSpinBox *screenFPS;
223 virtual void updateMRL();
226 void updateButtons();
227 void advancedDialog();