3a6b86fb6c9638077925d77cebde9c83616bc37a
[vlc.git] / 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 #include <assert.h>
29 #include <vlc/vlc.h>
30 #include <vlc_interface.h>
31
32 #include "dialogs/interaction.hpp"
33
34 #include <QObject>
35 #include <QTimer>
36 #include <QApplication>
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     OPEN_FILE_TAB,
77     OPEN_DISC_TAB,
78     OPEN_NETWORK_TAB,
79     OPEN_CAPTURE_TAB,
80     OPEN_TAB_MAX
81 };
82
83 enum {
84     OPEN_AND_PLAY,
85     OPEN_AND_STREAM,
86     OPEN_AND_SAVE,
87     OPEN_AND_ENQUEUE,
88     SELECT
89 };
90
91 class QEvent;
92 class QSignalMapper;
93 class QVLCMenu;
94
95 class DialogsProvider : public QObject
96 {
97     Q_OBJECT;
98     friend class QVLCMenu;
99
100 public:
101     static DialogsProvider *getInstance()
102     {
103         assert( instance );
104         return instance;
105     }
106     static DialogsProvider *getInstance( intf_thread_t *p_intf )
107     {
108         if( !instance )
109             instance = new DialogsProvider( p_intf );
110         return instance;
111     }
112     static void killInstance()
113     {
114         if( instance ) delete instance;
115         instance=NULL;
116     }
117     virtual ~DialogsProvider();
118     QTimer *fixed_timer;
119
120     QStringList showSimpleOpen( QString help = QString(),
121                                 int filters = EXT_FILTER_MEDIA |
122                                 EXT_FILTER_VIDEO | EXT_FILTER_AUDIO |
123                                 EXT_FILTER_PLAYLIST,
124                                 QString path = QString() );
125 protected:
126     QSignalMapper *menusMapper;
127     QSignalMapper *menusUpdateMapper;
128     QSignalMapper *SDMapper;
129     void customEvent( QEvent *);
130
131 private:
132     DialogsProvider( intf_thread_t *);
133     intf_thread_t *p_intf;
134     static DialogsProvider *instance;
135     void addFromSimple( bool, bool );
136
137 public slots:
138     void doInteraction( intf_dialog_args_t * );
139     void menuAction( QObject *);
140     void menuUpdateAction( QObject * );
141     void SDMenuAction( QString );
142
143     void playlistDialog();
144     void bookmarksDialog();
145     void mediaInfoDialog();
146     void mediaCodecDialog();
147     void prefsDialog();
148     void extendedDialog();
149     void messagesDialog();
150 #ifdef ENABLE_VLM
151     void vlmDialog();
152 #endif
153     void helpDialog();
154 #ifdef UPDATE_CHECK
155     void updateDialog();
156 #endif
157     void aboutDialog();
158     void gotoTimeDialog();
159     void podcastConfigureDialog();
160
161     void simpleOpenDialog();
162     void simplePLAppendDialog();
163     void simpleMLAppendDialog();
164
165     void openDialog();
166     void openDialog( int );
167     void openDiscDialog();
168     void openFileDialog();
169     void openNetDialog();
170     void openCaptureDialog();
171
172     void PLAppendDialog();
173     void MLAppendDialog();
174     void PLAppendDir();
175     void MLAppendDir();
176
177     void streamingDialog( QWidget *parent, QString mrl = "",
178             bool b_stream = true );
179     void openThenStreamingDialogs();
180     void openThenTranscodingDialogs();
181
182     void openAPlaylist();
183     void saveAPlaylist();
184
185     void switchToSkins();
186     void quit();
187 };
188
189 #endif