demux: avi: check chunk size
[vlc.git] / modules / gui / qt / dialogs_provider.hpp
blob13862edbdb5fdfef1e1fed36e3e6c564106e6fad
1 /*****************************************************************************
2 * dialogs_provider.hpp : Dialogs provider
3 ****************************************************************************
4 * Copyright (C) 2006-2008 the VideoLAN team
5 * $Id$
7 * Authors: Clément Stenac <zorglub@videolan.org>
8 * Jean-Baptiste Kempf <jb@videolan.org>
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.
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.
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 *****************************************************************************/
25 #ifndef QVLC_DIALOGS_PROVIDER_H_
26 #define QVLC_DIALOGS_PROVIDER_H_
28 #ifdef HAVE_CONFIG_H
29 # include "config.h"
30 #endif
32 #include <assert.h>
34 #include "qt.hpp"
36 #include "dialogs/open.hpp"
37 #include <QObject>
38 #include <QStringList>
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 ) );
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,
60 class QEvent;
61 class QSignalMapper;
62 class VLCMenuBar;
64 class DialogsProvider : public QObject
66 Q_OBJECT
67 friend class VLCMenuBar;
69 public:
70 static DialogsProvider *getInstance()
72 assert( instance );
73 return instance;
75 static DialogsProvider *getInstance( intf_thread_t *p_intf )
77 if( !instance )
78 instance = new DialogsProvider( p_intf );
79 return instance;
81 static void killInstance()
83 delete instance;
84 instance = NULL;
87 QStringList showSimpleOpen( const QString& help = QString(),
88 int filters = EXT_FILTER_MEDIA |
89 EXT_FILTER_VIDEO | EXT_FILTER_AUDIO |
90 EXT_FILTER_PLAYLIST,
91 const QString& path = QString() );
92 bool isDying() { return b_isDying; }
93 static QString getDirectoryDialog( intf_thread_t *p_intf);
94 static QStringList getOpenURL(intf_thread_t* p_intf, QWidget *parent = NULL,
95 const QString &caption = QString(),
96 const QString &dir = QString(),
97 const QString &filter = QString(),
98 QString *selectedFilter = NULL );
99 static QString getSaveFileName( QWidget *parent = NULL,
100 const QString &caption = QString(),
101 const QString &dir = QString(),
102 const QString &filter = QString(),
103 QString *selectedFilter = NULL );
105 protected:
106 QSignalMapper *menusMapper;
107 QSignalMapper *menusUpdateMapper;
108 void customEvent( QEvent *);
110 private:
111 DialogsProvider( intf_thread_t *);
112 virtual ~DialogsProvider();
113 static DialogsProvider *instance;
115 intf_thread_t *p_intf;
117 QMenu* popupMenu;
118 QMenu* videoPopupMenu;
119 QMenu* audioPopupMenu;
120 QMenu* miscPopupMenu;
122 QWidget* root;
123 bool b_isDying;
125 void openDialog( int );
126 void addFromSimple( bool, bool );
128 public slots:
129 void playlistDialog();
130 void bookmarksDialog();
131 void mediaInfoDialog();
132 void mediaCodecDialog();
133 void prefsDialog();
134 void extendedDialog();
135 void synchroDialog();
136 void messagesDialog();
137 void sendKey( int key );
138 #ifdef ENABLE_VLM
139 void vlmDialog();
140 #endif
141 void helpDialog();
142 #ifdef UPDATE_CHECK
143 void updateDialog();
144 #endif
145 void aboutDialog();
146 void gotoTimeDialog();
147 void podcastConfigureDialog();
148 void toolbarDialog();
149 void pluginDialog();
150 void epgDialog();
151 void setPopupMenu();
152 void destroyPopupMenu();
154 void openFileGenericDialog( intf_dialog_args_t * );
156 void simpleOpenDialog();
158 void openDialog();
159 void openDiscDialog();
160 void openFileDialog();
161 void openUrlDialog();
162 void openNetDialog();
163 void openCaptureDialog();
165 void PLAppendDialog( int tab = OPEN_FILE_TAB );
166 void MLAppendDialog( int tab = OPEN_FILE_TAB );
168 void PLOpenDir();
169 void PLAppendDir();
171 void streamingDialog( QWidget *parent, const QStringList& mrls, bool b_stream = true,
172 QStringList options = QStringList("") );
173 void openAndStreamingDialogs();
174 void openAndTranscodingDialogs();
176 void openAPlaylist();
177 void savePlayingToPlaylist();
179 void loadSubtitlesFile();
181 void quit();
182 private slots:
183 void menuAction( QObject *);
184 void menuUpdateAction( QObject * );
185 signals:
186 void toolBarConfUpdated();
189 class DialogEvent : public QEvent
191 public:
192 static const QEvent::Type DialogEvent_Type;
193 DialogEvent( int _i_dialog, int _i_arg, intf_dialog_args_t *_p_arg ) :
194 QEvent( DialogEvent_Type )
196 i_dialog = _i_dialog;
197 i_arg = _i_arg;
198 p_arg = _p_arg;
201 int i_arg, i_dialog;
202 intf_dialog_args_t *p_arg;
206 #endif