]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/open.hpp
Try to fix memleaks
[vlc] / modules / gui / qt4 / components / open.hpp
1 /*****************************************************************************
2  * open.hpp : Panels for the open dialogs
3  ****************************************************************************
4  * Copyright (C) 2006-2007 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 #include <vlc/vlc.h>
32
33 #include <QFileDialog>
34
35 #include "ui/open_file.h"
36 #include "ui/open_disk.h"
37 #include "ui/open_net.h"
38 #include "ui/open_capture.h"
39
40 #ifdef HAVE_LIMITS_H
41 #   include <limits.h>
42 #endif
43
44 #define setSpinBoxFreq( spinbox ){ spinbox->setRange ( 0, INT_MAX ); \
45     spinbox->setAccelerated( true ); }
46
47 #define V4L_DEVICE         0
48 #define PVR_DEVICE         1
49 #define DVB_DEVICE         2
50 #define BDA_DEVICE         3
51 #define DSHOW_DEVICE     4
52 #define SCREEN_DEVICE      5
53 #define JACK_DEVICE        6
54
55 class QWidget;
56 class QLineEdit;
57 class QString;
58
59 class OpenPanel: public QWidget
60 {
61     Q_OBJECT;
62 public:
63     OpenPanel( QWidget *p, intf_thread_t *_p_intf ) : QWidget( p )
64     {
65         p_intf = _p_intf;
66     }
67     virtual ~OpenPanel() {};
68     virtual void clear() = 0;
69 protected:
70     intf_thread_t *p_intf;
71 public slots:
72     virtual void updateMRL() = 0;
73 signals:
74     void mrlUpdated( QString );
75     void methodChanged( QString method );
76 };
77
78 class FileOpenBox: public QFileDialog
79 {
80     Q_OBJECT;
81 public:
82     FileOpenBox( QWidget *parent, const QString &caption,
83         const QString &directory, const QString &filter ):
84         QFileDialog( parent, caption, directory, filter ) {}
85 public slots:
86     void accept();
87 };
88
89 class FileOpenPanel: public OpenPanel
90 {
91     Q_OBJECT;
92 public:
93     FileOpenPanel( QWidget *, intf_thread_t * );
94     virtual ~FileOpenPanel();
95     virtual void clear() ;
96     virtual void accept() ;
97 private:
98     Ui::OpenFile ui;
99     QStringList browse( QString );
100     FileOpenBox *dialogBox;
101     QLineEdit *lineFileEdit;
102 public slots:
103     virtual void updateMRL();
104 private slots:
105     void browseFile();
106     void browseFileSub();
107     void toggleSubtitleFrame();
108 };
109
110 class NetOpenPanel: public OpenPanel
111 {
112     Q_OBJECT;
113 public:
114     NetOpenPanel( QWidget *, intf_thread_t * );
115     virtual ~NetOpenPanel();
116     virtual void clear() ;
117 private:
118     Ui::OpenNetwork ui;
119 public slots:
120     virtual void updateMRL();
121 private slots:
122     void updateProtocol(int);
123     void updateAddress();
124 };
125
126 class DiscOpenPanel: public OpenPanel
127 {
128     Q_OBJECT;
129 public:
130     DiscOpenPanel( QWidget *, intf_thread_t * );
131     virtual ~DiscOpenPanel();
132     virtual void clear() ;
133 private:
134     Ui::OpenDisk ui;
135 public slots:
136     virtual void updateMRL() ;
137     virtual void updateButtons() ;
138 };
139
140
141 class CaptureOpenPanel: public OpenPanel
142 {
143     Q_OBJECT;
144 public:
145     CaptureOpenPanel( QWidget *, intf_thread_t * );
146     virtual ~CaptureOpenPanel();
147     virtual void clear() ;
148 private:
149     Ui::OpenCapture ui;
150     QRadioButton *dvbs, *dvbt, *dvbc;
151     QRadioButton *bdas, *bdat, *bdac;
152     QSpinBox  *v4lFreq, *pvrFreq, *pvrBitr;
153     QLineEdit *v4lVideoDevice, *v4lAudioDevice;
154     QLineEdit *pvrDevice, *pvrRadioDevice;
155     QComboBox *v4lNormBox, *pvrNormBox, *bdaBandBox;
156     QSpinBox *dvbCard, *dvbFreq, *dvbSrate;
157     QSpinBox *bdaCard, *bdaFreq, *bdaSrate;
158     QSpinBox *jackChannels, *jackCaching;
159     QCheckBox *jackPace, *jackConnect;
160     QLineEdit *jackPortsSelected;
161
162     QLabel *bdaSrateLabel, *bdaBandLabel;
163
164 public slots:
165     virtual void updateMRL();
166 private slots:
167     void updateButtons();
168 };
169
170 #endif