1 /*****************************************************************************
2 * dialogs_provider.hpp : Dialogs provider
3 ****************************************************************************
4 * Copyright (C) 2006-2008 the VideoLAN team
6 * Authors: Clément Stenac <zorglub@videolan.org>
7 * Jean-Baptiste Kempf <jb@videolan.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 #ifndef QVLC_DIALOGS_PROVIDER_H_
25 #define QVLC_DIALOGS_PROVIDER_H_
35 #include "dialogs/open.hpp"
37 #include <QStringList>
39 #define TITLE_EXTENSIONS_MEDIA qtr( "Media Files" )
40 #define TITLE_EXTENSIONS_VIDEO qtr( "Video Files" )
41 #define TITLE_EXTENSIONS_AUDIO qtr( "Audio Files" )
42 #define TITLE_EXTENSIONS_PLAYLIST qtr( "Playlist Files" )
43 #define TITLE_EXTENSIONS_SUBTITLE qtr( "Subtitle Files" )
44 #define TITLE_EXTENSIONS_ALL qtr( "All Files" )
45 #define EXTENSIONS_ALL "*"
46 #define ADD_EXT_FILTER( string, type ) \
47 string = string + QString("%1 ( %2 );;") \
48 .arg( TITLE_##type ) \
49 .arg( QString( type ) );
52 EXT_FILTER_MEDIA
= 0x01,
53 EXT_FILTER_VIDEO
= 0x02,
54 EXT_FILTER_AUDIO
= 0x04,
55 EXT_FILTER_PLAYLIST
= 0x08,
56 EXT_FILTER_SUBTITLE
= 0x10,
63 class DialogsProvider
: public QObject
66 friend class VLCMenuBar
;
69 static DialogsProvider
*getInstance()
74 static DialogsProvider
*getInstance( intf_thread_t
*p_intf
)
77 instance
= new DialogsProvider( p_intf
);
80 static void killInstance()
86 QStringList
showSimpleOpen( const QString
& help
= QString(),
87 int filters
= EXT_FILTER_MEDIA
|
88 EXT_FILTER_VIDEO
| EXT_FILTER_AUDIO
|
90 const QUrl
& path
= QUrl() );
91 bool isDying() { return b_isDying
; }
92 static QString
getDirectoryDialog( intf_thread_t
*p_intf
);
94 static QString
getSaveFileName(QWidget
*parent
= NULL
,
95 const QString
&caption
= QString(),
96 const QUrl
&dir
= QUrl(),
97 const QString
&filter
= QString(),
98 QString
*selectedFilter
= NULL
);
101 QSignalMapper
*menusMapper
;
102 QSignalMapper
*menusUpdateMapper
;
103 void customEvent( QEvent
*);
106 DialogsProvider( intf_thread_t
*);
107 virtual ~DialogsProvider();
108 static DialogsProvider
*instance
;
110 intf_thread_t
*p_intf
;
113 QMenu
* videoPopupMenu
;
114 QMenu
* audioPopupMenu
;
115 QMenu
* miscPopupMenu
;
120 void openDialog( int );
123 void playlistDialog();
124 void bookmarksDialog();
125 void mediaInfoDialog();
126 void mediaCodecDialog();
128 void extendedDialog();
129 void synchroDialog();
130 void messagesDialog();
131 void sendKey( int key
);
140 void gotoTimeDialog();
141 void podcastConfigureDialog();
142 void toolbarDialog();
146 void destroyPopupMenu();
148 void openFileGenericDialog( intf_dialog_args_t
* );
150 void simpleOpenDialog();
153 void openDiscDialog();
154 void openFileDialog();
155 void openUrlDialog();
156 void openNetDialog();
157 void openCaptureDialog();
159 void PLAppendDialog( int tab
= OPEN_FILE_TAB
);
164 void streamingDialog( QWidget
*parent
, const QStringList
& mrls
, bool b_stream
= true,
165 QStringList options
= QStringList("") );
166 void openAndStreamingDialogs();
167 void openAndTranscodingDialogs();
169 void openAPlaylist();
170 void savePlayingToPlaylist();
172 void loadSubtitlesFile();
176 void menuAction( QObject
*);
177 void menuUpdateAction( QObject
* );
179 void toolBarConfUpdated();
180 void releaseMouseEvents();
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
;