]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs_provider.hpp
225fe6b80c1598b379df11ed8b3b0cdbd8113435
[vlc] / modules / gui / qt4 / dialogs_provider.hpp
1 /*****************************************************************************
2  * dialogs_provider.hpp : Dialogs provider
3  ****************************************************************************
4  * Copyright (C) 2006-2007 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 _DIALOGS_PROVIDER_H_
26 #define _DIALOGS_PROVIDER_H_
27
28 #ifdef HAVE_CONFIG_H
29 # include "config.h"
30 #endif
31
32 #include <assert.h>
33 #include <vlc_common.h>
34 #include <vlc_interface.h>
35
36 #include "qt4.hpp"
37 #include "dialogs/interaction.hpp"
38 #include "dialogs/open.hpp"
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 class QEvent;
78 class QSignalMapper;
79 class QVLCMenu;
80
81 class DialogsProvider : public QObject
82 {
83     Q_OBJECT;
84     friend class QVLCMenu;
85
86 public:
87     static DialogsProvider *getInstance()
88     {
89         assert( instance );
90         return instance;
91     }
92     static DialogsProvider *getInstance( intf_thread_t *p_intf )
93     {
94         if( !instance )
95             instance = new DialogsProvider( p_intf );
96         return instance;
97     }
98     static void killInstance()
99     {
100         if( instance ) delete instance;
101         instance = NULL;
102     }
103     static bool isAlive()
104     {
105         return ( instance != NULL );
106     }
107     virtual ~DialogsProvider();
108
109     QStringList showSimpleOpen( QString help = QString(),
110                                 int filters = EXT_FILTER_MEDIA |
111                                 EXT_FILTER_VIDEO | EXT_FILTER_AUDIO |
112                                 EXT_FILTER_PLAYLIST,
113                                 QString path = QString() );
114     bool isDying() { return b_isDying; }
115 protected:
116     QSignalMapper *menusMapper;
117     QSignalMapper *menusUpdateMapper;
118     QSignalMapper *SDMapper;
119     void customEvent( QEvent *);
120
121 private:
122     DialogsProvider( intf_thread_t *);
123     intf_thread_t *p_intf;
124     static DialogsProvider *instance;
125     bool b_isDying;
126
127     void openDialog( int );
128     void addFromSimple( bool, bool );
129
130 public slots:
131     void doInteraction( intf_dialog_args_t * );
132     void playMRL( const QString & );
133
134     void playlistDialog();
135     void bookmarksDialog();
136     void mediaInfoDialog();
137     void mediaCodecDialog();
138     void prefsDialog();
139     void extendedDialog();
140     void messagesDialog();
141 #ifdef ENABLE_VLM
142     void vlmDialog();
143 #endif
144     void helpDialog();
145 #ifdef UPDATE_CHECK
146     void updateDialog();
147 #endif
148     void aboutDialog();
149     void gotoTimeDialog();
150     void podcastConfigureDialog();
151
152     void openFileGenericDialog( intf_dialog_args_t * );
153
154     void simpleOpenDialog();
155     void simplePLAppendDialog();
156     void simpleMLAppendDialog();
157
158     void openDialog();
159     void openDiscDialog();
160     void openFileDialog();
161     void openNetDialog();
162     void openCaptureDialog();
163
164     void PLAppendDialog();
165     void MLAppendDialog();
166
167     void PLOpenDir();
168     void PLAppendDir();
169     void MLAppendDir();
170
171     void streamingDialog( QWidget *parent, QString mrl = "",
172             bool b_stream = true );
173     void openAndStreamingDialogs();
174     void openAndTranscodingDialogs();
175
176     void openAPlaylist();
177     void saveAPlaylist();
178
179     void loadSubtitlesFile();
180
181     void quit();
182 private slots:
183     void menuAction( QObject *);
184     void menuUpdateAction( QObject * );
185     void SDMenuAction( QString );
186 };
187
188 #endif