]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs_provider.hpp
7d661a5f071bb35981eb71f1eea2b69a2f8f9ff2
[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
39 #include <QObject>
40 #include <QTimer>
41 #include <QApplication>
42
43 #define ADD_FILTER_MEDIA( string )     \
44     string += qtr( "Media Files" );    \
45     string += " ( ";                   \
46     string += EXTENSIONS_MEDIA;        \
47     string += ");;";
48 #define ADD_FILTER_VIDEO( string )     \
49     string += qtr( "Video Files" );    \
50     string += " ( ";                   \
51     string += EXTENSIONS_VIDEO;        \
52     string += ");;";
53 #define ADD_FILTER_AUDIO( string )     \
54     string += qtr( "Audio Files" );    \
55     string += " ( ";                   \
56     string += EXTENSIONS_AUDIO;        \
57     string += ");;";
58 #define ADD_FILTER_PLAYLIST( string )  \
59     string += qtr( "Playlist Files" ); \
60     string += " ( ";                   \
61     string += EXTENSIONS_PLAYLIST;     \
62     string += ");;";
63 #define ADD_FILTER_SUBTITLE( string )  \
64     string += qtr( "Subtitles Files" );\
65     string += " ( ";                   \
66     string += EXTENSIONS_SUBTITLE;     \
67     string += ");;";
68 #define ADD_FILTER_ALL( string )       \
69     string += qtr( "All Files" );      \
70     string += " (*.*)";
71
72 enum {
73     EXT_FILTER_MEDIA     =  0x01,
74     EXT_FILTER_VIDEO     =  0x02,
75     EXT_FILTER_AUDIO     =  0x04,
76     EXT_FILTER_PLAYLIST  =  0x08,
77     EXT_FILTER_SUBTITLE  =  0x10,
78 };
79
80 enum {
81     OPEN_FILE_TAB,
82     OPEN_DISC_TAB,
83     OPEN_NETWORK_TAB,
84     OPEN_CAPTURE_TAB,
85     OPEN_TAB_MAX
86 };
87
88 enum {
89     OPEN_AND_PLAY,
90     OPEN_AND_STREAM,
91     OPEN_AND_SAVE,
92     OPEN_AND_ENQUEUE,
93     SELECT
94 };
95
96 class QEvent;
97 class QSignalMapper;
98 class QVLCMenu;
99
100 class DialogsProvider : public QObject
101 {
102     Q_OBJECT;
103     friend class QVLCMenu;
104
105 public:
106     static DialogsProvider *getInstance()
107     {
108         assert( instance );
109         return instance;
110     }
111     static DialogsProvider *getInstance( intf_thread_t *p_intf )
112     {
113         if( !instance )
114             instance = new DialogsProvider( p_intf );
115         return instance;
116     }
117     static void killInstance()
118     {
119         if( instance ) delete instance;
120         instance = NULL;
121     }
122     virtual ~DialogsProvider();
123     QTimer *fixed_timer;
124
125     QStringList showSimpleOpen( QString help = QString(),
126                                 int filters = EXT_FILTER_MEDIA |
127                                 EXT_FILTER_VIDEO | EXT_FILTER_AUDIO |
128                                 EXT_FILTER_PLAYLIST,
129                                 QString path = QString() );
130 protected:
131     QSignalMapper *menusMapper;
132     QSignalMapper *menusUpdateMapper;
133     QSignalMapper *SDMapper;
134     void customEvent( QEvent *);
135
136 private:
137     DialogsProvider( intf_thread_t *);
138     intf_thread_t *p_intf;
139     static DialogsProvider *instance;
140     void addFromSimple( bool, bool );
141
142 public slots:
143     void doInteraction( intf_dialog_args_t * );
144     void menuAction( QObject *);
145     void menuUpdateAction( QObject * );
146     void SDMenuAction( QString );
147
148     void playlistDialog();
149     void bookmarksDialog();
150     void mediaInfoDialog();
151     void mediaCodecDialog();
152     void prefsDialog();
153     void extendedDialog();
154     void messagesDialog();
155 #ifdef ENABLE_VLM
156     void vlmDialog();
157 #endif
158     void helpDialog();
159 #ifdef UPDATE_CHECK
160     void updateDialog();
161 #endif
162     void aboutDialog();
163     void gotoTimeDialog();
164     void podcastConfigureDialog();
165
166     void simpleOpenDialog();
167     void simplePLAppendDialog();
168     void simpleMLAppendDialog();
169
170     void openDialog();
171     void openDialog( int );
172     void openDiscDialog();
173     void openFileDialog();
174     void openNetDialog();
175     void openCaptureDialog();
176
177     void PLAppendDialog();
178     void MLAppendDialog();
179     void PLAppendDir();
180     void MLAppendDir();
181
182     void streamingDialog( QWidget *parent, QString mrl = "",
183             bool b_stream = true );
184     void openThenStreamingDialogs();
185     void openThenTranscodingDialogs();
186
187     void openAPlaylist();
188     void saveAPlaylist();
189
190     void loadSubtitlesFile();
191
192     void quit();
193 };
194
195 #endif