]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/open.hpp
7c83364733b1131ace5ab46d3d359d6a9b6bbf81
[vlc] / modules / gui / qt4 / components / open.hpp
1 /*****************************************************************************
2  * open.hpp : Panels for the open dialogs
3  ****************************************************************************
4  * Copyright (C) 2006 the VideoLAN team
5  * $Id$
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
8  *          Jean-Baptiste Kempf <jb@videolan.org>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 #ifndef _OPENPANELS_H_
26 #define _OPENPANELS_H_
27
28 #include <vlc/vlc.h>
29 #include <QWidget>
30 #include <QString>
31 #include <QFileDialog>
32
33 #include "ui/open_file.h"
34 #include "ui/open_disk.h"
35 #include "ui/open_net.h"
36 #include "ui/open_capture.h"
37
38 class QLineEdit;
39
40 class OpenPanel: public QWidget
41 {
42     Q_OBJECT;
43 public:
44     OpenPanel( QWidget *p, intf_thread_t *_p_intf ) : QWidget( p )
45     {
46         p_intf = _p_intf;
47     }
48     virtual ~OpenPanel() {};
49     virtual void clear() = 0;
50 protected:
51     intf_thread_t *p_intf;
52 public slots:
53     virtual void updateMRL() = 0;
54 signals:
55     void mrlUpdated( QString );
56     void methodChanged( QString method );
57 };
58
59 class FileOpenBox: public QFileDialog
60 {
61     Q_OBJECT;
62 public:
63     FileOpenBox( QWidget *parent, const QString &caption,
64         const QString &directory, const QString &filter ):
65         QFileDialog( parent, caption, directory, filter ) {}
66 public slots:
67     void accept();
68 };
69
70 class FileOpenPanel: public OpenPanel
71 {
72     Q_OBJECT;
73 public:
74     FileOpenPanel( QWidget *, intf_thread_t * );
75     virtual ~FileOpenPanel();
76     virtual void clear() ;
77     virtual void accept() ;
78 private:
79     Ui::OpenFile ui;
80     QStringList browse( QString );
81     FileOpenBox *dialogBox;
82     QLineEdit *lineFileEdit;
83 public slots:
84     virtual void updateMRL();
85 private slots:
86     void browseFile();
87     void browseFileSub();
88     void toggleSubtitleFrame();
89 };
90
91 class NetOpenPanel: public OpenPanel
92 {
93     Q_OBJECT;
94 public:
95     NetOpenPanel( QWidget *, intf_thread_t * );
96     virtual ~NetOpenPanel();
97     virtual void clear() ;
98 private:
99     Ui::OpenNetwork ui;
100 public slots:
101     virtual void updateMRL();
102 private slots:
103     void updateProtocol(int);
104     void updateAddress();
105 };
106
107 class DiscOpenPanel: public OpenPanel
108 {
109     Q_OBJECT;
110 public:
111     DiscOpenPanel( QWidget *, intf_thread_t * );
112     virtual ~DiscOpenPanel();
113     virtual void clear() ;
114 private:
115     Ui::OpenDisk ui;
116 public slots:
117     virtual void updateMRL() ;
118 };
119
120
121 class CaptureOpenPanel: public OpenPanel
122 {
123     Q_OBJECT;
124 public:
125     CaptureOpenPanel( QWidget *, intf_thread_t * );
126     virtual ~CaptureOpenPanel();
127     virtual void clear() ;
128 private:
129     Ui::OpenCapture ui;
130 public slots:
131     virtual void updateMRL();
132 };
133
134 #endif