]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/open.hpp
83ed6e9035a0c89b87012a4c7a099878a8c39394
[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 #include "ui/open_file.h"
33 #include "ui/open_disk.h"
34 #include "ui/open_net.h"
35 #include "ui/open_capture.h"
36
37 class QLineEdit;
38
39 class OpenPanel: public QWidget
40 {
41     Q_OBJECT;
42 public:
43     OpenPanel( QWidget *p, intf_thread_t *_p_intf ) : QWidget( p )
44     {
45         p_intf = _p_intf;
46     }
47     virtual ~OpenPanel() {};
48     virtual void clear() = 0;
49 protected:
50     intf_thread_t *p_intf;
51 public slots:
52     virtual void updateMRL() = 0;
53 signals:
54     void mrlUpdated(QString);
55     void methodChanged( QString method );
56 };
57
58 class FileOpenBox: public QFileDialog
59 {
60     Q_OBJECT;
61 public:
62     FileOpenBox( QWidget *parent, const QString &caption,
63         const QString &directory, const QString &filter ):
64         QFileDialog( parent, caption, directory, filter ) {}
65 public slots:
66     void accept();
67 };
68
69 class FileOpenPanel: public OpenPanel
70 {
71     Q_OBJECT;
72 public:
73     FileOpenPanel( QWidget *, intf_thread_t * );
74     virtual ~FileOpenPanel();
75     virtual void clear() ;
76     virtual void accept() ;
77 private:
78     Ui::OpenFile ui;
79     QStringList browse( QString );
80     FileOpenBox *dialogBox;
81     QLineEdit *lineFileEdit;
82 public slots:
83     virtual void updateMRL();
84 private slots:
85     void browseFile();
86     void browseFileSub();
87     void toggleSubtitleFrame();
88 };
89
90 class NetOpenPanel: public OpenPanel
91 {
92     Q_OBJECT;
93 public:
94     NetOpenPanel( QWidget *, intf_thread_t * );
95     virtual ~NetOpenPanel();
96     virtual void clear() ;
97 private:
98     Ui::OpenNetwork ui;
99 public slots:
100     virtual void updateMRL();
101 private slots:
102     void updateProtocol(int);
103     void updateAddress();
104 };
105
106 class DiskOpenPanel: public OpenPanel
107 {
108     Q_OBJECT;
109 public:
110     DiskOpenPanel( QWidget *, intf_thread_t * );
111     virtual ~DiskOpenPanel();
112     virtual void clear() ;
113 private:
114     Ui::OpenDisk ui;
115 public slots:
116     virtual void updateMRL() ;
117 };
118
119
120 class CaptureOpenPanel: public OpenPanel
121 {
122     Q_OBJECT;
123 public:
124     CaptureOpenPanel( QWidget *, intf_thread_t * );
125     virtual ~CaptureOpenPanel();
126     virtual void clear() ;
127 private:
128     Ui::OpenCapture ui;
129 public slots:
130     virtual void updateMRL();
131 };
132
133 #endif