open_panels.hpp 4.95 KB
Newer Older
zorglub's avatar
zorglub committed
1
2
3
/*****************************************************************************
 * open.hpp : Panels for the open dialogs
 ****************************************************************************
4
 * Copyright (C) 2006-2007 the VideoLAN team
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
5
6
 * Copyright (C) 2007 Société des arts technologiques
 * Copyright (C) 2007 Savoir-faire Linux
7
 * $Id$
zorglub's avatar
zorglub committed
8
9
 *
 * Authors: Clément Stenac <zorglub@videolan.org>
zorglub's avatar
zorglub committed
10
 *          Jean-Baptiste Kempf <jb@videolan.org>
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
11
 *          Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
zorglub's avatar
zorglub committed
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

#ifndef _OPENPANELS_H_
#define _OPENPANELS_H_

Christophe Mutricy's avatar
Christophe Mutricy committed
31
32
33
34
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

zorglub's avatar
zorglub committed
35
#include <vlc/vlc.h>
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
36

37
#include <QFileDialog>
38

39
#include "ui/open_file.h"
40
41
#include "ui/open_disk.h"
#include "ui/open_net.h"
42
#include "ui/open_capture.h"
zorglub's avatar
zorglub committed
43

44
45
#include "components/preferences_widgets.hpp"

46
#include <limits.h>
47

48
49
#define setSpinBoxFreq( spinbox ){ spinbox->setRange ( 0, INT_MAX ); \
    spinbox->setAccelerated( true ); }
50

51
52
53
enum
{
    V4L_DEVICE,
54
    V4L2_DEVICE,
55
56
57
58
59
60
61
    PVR_DEVICE,
    DVB_DEVICE,
    BDA_DEVICE,
    DSHOW_DEVICE,
    SCREEN_DEVICE,
    JACK_DEVICE
};
62

63
64
65
66
static const char *psz_devModule[] = { "v4l", "v4l2", "pvr", "dvb", "bda",
                                       "dshow", "screen", "jack" };


67
class QWidget;
68
class QLineEdit;
69
class QString;
70

zorglub's avatar
zorglub committed
71
72
73
74
75
76
77
78
class OpenPanel: public QWidget
{
    Q_OBJECT;
public:
    OpenPanel( QWidget *p, intf_thread_t *_p_intf ) : QWidget( p )
    {
        p_intf = _p_intf;
    }
zorglub's avatar
zorglub committed
79
80
81
    virtual ~OpenPanel() {};
    virtual void clear() = 0;
protected:
zorglub's avatar
zorglub committed
82
83
    intf_thread_t *p_intf;
public slots:
zorglub's avatar
zorglub committed
84
85
    virtual void updateMRL() = 0;
signals:
86
    void mrlUpdated( QString );
zorglub's avatar
zorglub committed
87
    void methodChanged( QString method );
zorglub's avatar
zorglub committed
88
89
};

90
91
92
93
94
95
96
97
class FileOpenBox: public QFileDialog
{
    Q_OBJECT;
public:
    FileOpenBox( QWidget *parent, const QString &caption,
        const QString &directory, const QString &filter ):
        QFileDialog( parent, caption, directory, filter ) {}
public slots:
98
    void accept();
99
100
};

zorglub's avatar
zorglub committed
101
102
103
104
105
106
class FileOpenPanel: public OpenPanel
{
    Q_OBJECT;
public:
    FileOpenPanel( QWidget *, intf_thread_t * );
    virtual ~FileOpenPanel();
zorglub's avatar
zorglub committed
107
    virtual void clear() ;
108
    virtual void accept() ;
zorglub's avatar
zorglub committed
109
private:
110
    Ui::OpenFile ui;
zorglub's avatar
zorglub committed
111
    QStringList browse( QString );
112
    FileOpenBox *dialogBox;
113
    QLineEdit *lineFileEdit;
114
    QStringList fileCompleteList ;
zorglub's avatar
zorglub committed
115
public slots:
zorglub's avatar
zorglub committed
116
117
    virtual void updateMRL();
private slots:
118
    void browseFileSub();
119
    void toggleSubtitleFrame();
zorglub's avatar
zorglub committed
120
121
};

122
123
124
125
126
127
class NetOpenPanel: public OpenPanel
{
    Q_OBJECT;
public:
    NetOpenPanel( QWidget *, intf_thread_t * );
    virtual ~NetOpenPanel();
zorglub's avatar
zorglub committed
128
    virtual void clear() ;
129
private:
130
    Ui::OpenNetwork ui;
131
public slots:
zorglub's avatar
zorglub committed
132
133
    virtual void updateMRL();
private slots:
134
    void updateProtocol( int );
135
136
};

137
class DiscOpenPanel: public OpenPanel
138
139
140
{
    Q_OBJECT;
public:
141
142
    DiscOpenPanel( QWidget *, intf_thread_t * );
    virtual ~DiscOpenPanel();
zorglub's avatar
zorglub committed
143
    virtual void clear() ;
144
    virtual void accept() ;
145
146
private:
    Ui::OpenDisk ui;
147
148
    char *psz_dvddiscpath, *psz_vcddiscpath, *psz_cddadiscpath;
    bool b_firstdvd, b_firstvcd, b_firstcdda;
149
public slots:
zorglub's avatar
zorglub committed
150
    virtual void updateMRL() ;
151
152
private slots:
    void browseDevice();
153
    void updateButtons() ;
154
    void eject();
155
156
};

157
158
159
160
161
162
163
164
165
166

class CaptureOpenPanel: public OpenPanel
{
    Q_OBJECT;
public:
    CaptureOpenPanel( QWidget *, intf_thread_t * );
    virtual ~CaptureOpenPanel();
    virtual void clear() ;
private:
    Ui::OpenCapture ui;
167
168
    QString advMRL;
    QDialog *adv;
169
#ifdef WIN32
170
    QRadioButton *bdas, *bdat, *bdac;
171
172
173
    QSpinBox *bdaCard, *bdaFreq, *bdaSrate;
    QLabel *bdaSrateLabel, *bdaBandLabel;
    QComboBox *bdaBandBox;
174
175
    StringListConfigControl *vdevDshowW, *adevDshowW;
    QLineEdit *dshowVSizeLine;
176
177
#else
    QRadioButton *dvbs, *dvbt, *dvbc;
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
178
    QSpinBox  *v4lFreq, *pvrFreq, *pvrBitr;
179
    QLineEdit *v4lVideoDevice, *v4lAudioDevice;
180
    QLineEdit *v4l2VideoDevice, *v4l2AudioDevice;
181
    QLineEdit *pvrDevice, *pvrRadioDevice;
182
    QComboBox *v4lNormBox, *v4l2StdBox, *pvrNormBox;
183
    QSpinBox *dvbCard, *dvbFreq, *dvbSrate;
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
184
185
186
    QSpinBox *jackChannels, *jackCaching;
    QCheckBox *jackPace, *jackConnect;
    QLineEdit *jackPortsSelected;
187
#endif
188

189
190
public slots:
    virtual void updateMRL();
191
192
private slots:
    void updateButtons();
193
    void advancedDialog();
194
195
};

zorglub's avatar
zorglub committed
196
#endif