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