1 /*****************************************************************************
2 * dialogs_provider.hpp : Dialogs provider
3 ****************************************************************************
4 * Copyright (C) 2006-2008 the VideoLAN team
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_
36 #include "dialogs/open.hpp"
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 ) );
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,
64 class DialogsProvider : public QObject
67 friend class VLCMenuBar;
70 static DialogsProvider *getInstance()
75 static DialogsProvider *getInstance( intf_thread_t *p_intf )
78 instance = new DialogsProvider( p_intf );
81 static void killInstance()
87 QStringList showSimpleOpen( const QString& help = QString(),
88 int filters = EXT_FILTER_MEDIA |
89 EXT_FILTER_VIDEO | EXT_FILTER_AUDIO |
91 const QString& path = QString() );
92 bool isDying() { return b_isDying; }
93 static QString getDirectoryDialog( intf_thread_t *p_intf);
96 QSignalMapper *menusMapper;
97 QSignalMapper *menusUpdateMapper;
98 QSignalMapper *SDMapper;
99 void customEvent( QEvent *);
102 DialogsProvider( intf_thread_t *);
103 virtual ~DialogsProvider();
104 static DialogsProvider *instance;
106 intf_thread_t *p_intf;
109 QMenu* videoPopupMenu;
110 QMenu* audioPopupMenu;
111 QMenu* miscPopupMenu;
116 void openDialog( int );
117 void addFromSimple( bool, bool );
118 void saveAPlaylist(playlist_t *p_playlist, playlist_item_t *p_node);
121 void playlistDialog();
122 void bookmarksDialog();
123 void mediaInfoDialog();
124 void mediaCodecDialog();
126 void extendedDialog();
127 void synchroDialog();
128 void messagesDialog();
129 void sendKey( int key );
138 void gotoTimeDialog();
139 void podcastConfigureDialog();
140 void toolbarDialog();
144 void destroyPopupMenu();
146 void openFileGenericDialog( intf_dialog_args_t * );
148 void simpleOpenDialog();
151 void openDiscDialog();
152 void openFileDialog();
153 void openUrlDialog();
154 void openNetDialog();
155 void openCaptureDialog();
157 void PLAppendDialog( int tab = OPEN_FILE_TAB );
158 void MLAppendDialog( int tab = OPEN_FILE_TAB );
163 void streamingDialog( QWidget *parent, const QString& mrl, bool b_stream = true,
164 QStringList options = QStringList("") );
165 void openAndStreamingDialogs();
166 void openAndTranscodingDialogs();
168 void openAPlaylist();
169 void savePlayingToPlaylist();
170 void saveRecentsToPlaylist();
172 void loadSubtitlesFile();
176 void menuAction( QObject *);
177 void menuUpdateAction( QObject * );
178 void SDMenuAction( const QString& );
180 void toolBarConfUpdated();
183 class DialogEvent : public QEvent
186 static const QEvent::Type DialogEvent_Type;
187 DialogEvent( int _i_dialog, int _i_arg, intf_dialog_args_t *_p_arg ) :
188 QEvent( DialogEvent_Type )
190 i_dialog = _i_dialog;
196 intf_dialog_args_t *p_arg;