c2673f2f88ff86239358b69b93cf00c7d176050f
[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 #define EXT_FILTER_MEDIA        0x01
68 #define EXT_FILTER_VIDEO        0x02
69 #define EXT_FILTER_AUDIO        0x04
70 #define EXT_FILTER_PLAYLIST     0x08
71 #define EXT_FILTER_SUBTITLE     0x10
72
73 enum {
74     OPEN_FILE_TAB,
75     OPEN_DISC_TAB,
76     OPEN_NETWORK_TAB,
77     OPEN_CAPTURE_TAB,
78     OPEN_TAB_MAX
79 };
80
81 enum {
82     OPEN_AND_PLAY,
83     OPEN_AND_STREAM,
84     OPEN_AND_SAVE,
85     OPEN_AND_ENQUEUE
86 };
87
88 class QEvent;
89 class QSignalMapper;
90 class QVLCMenu;
91
92 class DialogsProvider : public QObject
93 {
94     Q_OBJECT;
95 public:
96     static DialogsProvider *getInstance()
97     {
98         assert( instance );
99         return instance;
100     }
101     static DialogsProvider *getInstance( intf_thread_t *p_intf )
102     {
103         if( !instance )
104             instance = new DialogsProvider( p_intf );
105         return instance;
106     }
107     static void killInstance()
108     {
109         if( instance ) delete instance;
110         instance=NULL;
111     }
112     virtual ~DialogsProvider();
113     QTimer *fixed_timer;
114
115     QStringList showSimpleOpen( QString help = QString(),
116                                 int filters = EXT_FILTER_MEDIA |
117                                 EXT_FILTER_VIDEO | EXT_FILTER_AUDIO |
118                                 EXT_FILTER_PLAYLIST,
119                                 QString path = QString() );
120 protected:
121     friend class QVLCMenu;
122     QSignalMapper *menusMapper;
123     QSignalMapper *menusUpdateMapper;
124     QSignalMapper *SDMapper;
125     void customEvent( QEvent *);
126 private:
127     DialogsProvider( intf_thread_t *);
128     intf_thread_t *p_intf;
129     static DialogsProvider *instance;
130     void addFromSimple( bool, bool );
131
132 public slots:
133     void doInteraction( intf_dialog_args_t * );
134     void menuAction( QObject *);
135     void menuUpdateAction( QObject * );
136     void SDMenuAction( QString );
137
138     void playlistDialog();
139     void bookmarksDialog();
140     void mediaInfoDialog();
141     void mediaCodecDialog();
142     void prefsDialog();
143     void extendedDialog();
144     void messagesDialog();
145     void vlmDialog();
146     void helpDialog();
147     void updateDialog();
148     void aboutDialog();
149     void gotoTimeDialog();
150     void podcastConfigureDialog();
151
152     void simpleOpenDialog();
153     void simplePLAppendDialog();
154     void simpleMLAppendDialog();
155
156     void openDialog();
157     void openDialog( int );
158     void openDiscDialog();
159     void openFileDialog();
160     void openNetDialog();
161     void openCaptureDialog();
162
163     void PLAppendDialog();
164     void MLAppendDialog();
165     void PLAppendDir();
166     void MLAppendDir();
167
168     void streamingDialog( QString mrl = "", bool b_stream = true );
169     void openThenStreamingDialogs();
170     void openThenTranscodingDialogs();
171
172     void openAPlaylist();
173     void saveAPlaylist();
174
175     void switchToSkins();
176     void quit();
177 };
178
179 #endif