]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs_provider.hpp
correct a compilation error specific to QT4.3
[vlc] / modules / gui / qt4 / dialogs_provider.hpp
1 /*****************************************************************************
2  * dialogs_provider.hpp : Dialogs provider
3  ****************************************************************************
4  * Copyright (C) 2006-2008 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 QVLC_DIALOGS_PROVIDER_H_
26 #define QVLC_DIALOGS_PROVIDER_H_
27
28 #ifdef HAVE_CONFIG_H
29 # include "config.h"
30 #endif
31
32 #include <assert.h>
33
34 #include "qt4.hpp"
35
36 #include <QObject>
37
38 #define ADD_FILTER_MEDIA( string )     \
39     string += qtr( "Media Files" );    \
40     string += " ( ";                   \
41     string += EXTENSIONS_MEDIA;        \
42     string += ");;";
43 #define ADD_FILTER_VIDEO( string )     \
44     string += qtr( "Video Files" );    \
45     string += " ( ";                   \
46     string += EXTENSIONS_VIDEO;        \
47     string += ");;";
48 #define ADD_FILTER_AUDIO( string )     \
49     string += qtr( "Audio Files" );    \
50     string += " ( ";                   \
51     string += EXTENSIONS_AUDIO;        \
52     string += ");;";
53 #define ADD_FILTER_PLAYLIST( string )  \
54     string += qtr( "Playlist Files" ); \
55     string += " ( ";                   \
56     string += EXTENSIONS_PLAYLIST;     \
57     string += ");;";
58 #define ADD_FILTER_SUBTITLE( string )  \
59     string += qtr( "Subtitles Files" );\
60     string += " ( ";                   \
61     string += EXTENSIONS_SUBTITLE;     \
62     string += ");;";
63 #define ADD_FILTER_ALL( string )       \
64     string += qtr( "All Files" );      \
65     string += " (*)";
66
67 enum {
68     EXT_FILTER_MEDIA     =  0x01,
69     EXT_FILTER_VIDEO     =  0x02,
70     EXT_FILTER_AUDIO     =  0x04,
71     EXT_FILTER_PLAYLIST  =  0x08,
72     EXT_FILTER_SUBTITLE  =  0x10,
73 };
74
75 enum {
76     DialogEvent_Type = QEvent::User + DialogEventType + 1,
77     //PLUndockEvent_Type = QEvent::User + DialogEventType + 2;
78     //PLDockEvent_Type = QEvent::User + DialogEventType + 3;
79     SetVideoOnTopEvent_Type = QEvent::User + DialogEventType + 4,
80 };
81
82 class QEvent;
83 class QSignalMapper;
84 class QVLCMenu;
85 #include <QStringList>
86
87 class DialogsProvider : public QObject
88 {
89     Q_OBJECT;
90     friend class QVLCMenu;
91
92 public:
93     static DialogsProvider *getInstance()
94     {
95         assert( instance );
96         return instance;
97     }
98     static DialogsProvider *getInstance( intf_thread_t *p_intf )
99     {
100         if( !instance )
101             instance = new DialogsProvider( p_intf );
102         return instance;
103     }
104     static void killInstance()
105     {
106         delete instance;
107         instance = NULL;
108     }
109     static bool isAlive()
110     {
111         return ( instance != NULL );
112     }
113
114     QStringList showSimpleOpen( QString help = QString(),
115                                 int filters = EXT_FILTER_MEDIA |
116                                 EXT_FILTER_VIDEO | EXT_FILTER_AUDIO |
117                                 EXT_FILTER_PLAYLIST,
118                                 QString path = QString() );
119     bool isDying() { return b_isDying; }
120 protected:
121     QSignalMapper *menusMapper;
122     QSignalMapper *menusUpdateMapper;
123     QSignalMapper *SDMapper;
124     void customEvent( QEvent *);
125
126 private:
127     DialogsProvider( intf_thread_t *);
128     virtual ~DialogsProvider();
129     static DialogsProvider *instance;
130
131     intf_thread_t *p_intf;
132     bool b_isDying;
133
134     void openDialog( int );
135     void addFromSimple( bool, bool );
136
137 public slots:
138     void playMRL( const QString & );
139
140     void playlistDialog();
141     void bookmarksDialog();
142     void mediaInfoDialog();
143     void mediaCodecDialog();
144     void prefsDialog();
145     void extendedDialog();
146     void synchroDialog();
147     void messagesDialog();
148 #ifdef ENABLE_VLM
149     void vlmDialog();
150 #endif
151     void helpDialog();
152 #ifdef UPDATE_CHECK
153     void updateDialog();
154 #endif
155     void aboutDialog();
156     void gotoTimeDialog();
157     void podcastConfigureDialog();
158     void toolbarDialog();
159     void pluginDialog();
160
161     void openFileGenericDialog( intf_dialog_args_t * );
162
163     void simpleOpenDialog();
164     void simplePLAppendDialog();
165     void simpleMLAppendDialog();
166
167     void openDialog();
168     void openDiscDialog();
169     void openFileDialog();
170     void openUrlDialog();
171     void openNetDialog();
172     void openCaptureDialog();
173
174     void PLAppendDialog();
175     void MLAppendDialog();
176
177     void PLOpenDir();
178     void PLAppendDir();
179     void MLAppendDir();
180
181     void streamingDialog( QWidget *parent, QString mrl, bool b_stream = true,
182                           QStringList options = QStringList("") );
183     void openAndStreamingDialogs();
184     void openAndTranscodingDialogs();
185
186     void openAPlaylist();
187     void saveAPlaylist();
188
189     void loadSubtitlesFile();
190
191     void quit();
192 private slots:
193     void menuAction( QObject *);
194     void menuUpdateAction( QObject * );
195     void SDMenuAction( QString );
196 };
197
198 class DialogEvent : public QEvent
199 {
200 public:
201     DialogEvent( int _i_dialog, int _i_arg, intf_dialog_args_t *_p_arg ) :
202                  QEvent( (QEvent::Type)(DialogEvent_Type) )
203     {
204         i_dialog = _i_dialog;
205         i_arg = _i_arg;
206         p_arg = _p_arg;
207     };
208     virtual ~DialogEvent() { };
209
210     int i_arg, i_dialog;
211     intf_dialog_args_t *p_arg;
212 };
213
214
215 #endif