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