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 ADD_FILTER_MEDIA( string ) \
41 string += qtr( "Media Files" ); \
43 string += EXTENSIONS_MEDIA; \
45 #define ADD_FILTER_VIDEO( string ) \
46 string += qtr( "Video Files" ); \
48 string += EXTENSIONS_VIDEO; \
50 #define ADD_FILTER_AUDIO( string ) \
51 string += qtr( "Audio Files" ); \
53 string += EXTENSIONS_AUDIO; \
55 #define ADD_FILTER_PLAYLIST( string ) \
56 string += qtr( "Playlist Files" ); \
58 string += EXTENSIONS_PLAYLIST; \
60 #define ADD_FILTER_SUBTITLE( string ) \
61 string += qtr( "Subtitles Files" );\
63 string += EXTENSIONS_SUBTITLE; \
65 #define ADD_FILTER_ALL( string ) \
66 string += qtr( "All Files" ); \
70 EXT_FILTER_MEDIA
= 0x01,
71 EXT_FILTER_VIDEO
= 0x02,
72 EXT_FILTER_AUDIO
= 0x04,
73 EXT_FILTER_PLAYLIST
= 0x08,
74 EXT_FILTER_SUBTITLE
= 0x10,
78 DialogEvent_Type
= QEvent::User
+ DialogEventType
+ 1,
79 //PLUndockEvent_Type = QEvent::User + DialogEventType + 2;
80 //PLDockEvent_Type = QEvent::User + DialogEventType + 3;
81 SetVideoOnTopEvent_Type
= QEvent::User
+ DialogEventType
+ 4,
88 class DialogsProvider
: public QObject
91 friend class QVLCMenu
;
94 static DialogsProvider
*getInstance()
99 static DialogsProvider
*getInstance( intf_thread_t
*p_intf
)
102 instance
= new DialogsProvider( p_intf
);
105 static void killInstance()
110 static bool isAlive()
112 return ( instance
!= NULL
);
115 QStringList
showSimpleOpen( const QString
& help
= QString(),
116 int filters
= EXT_FILTER_MEDIA
|
117 EXT_FILTER_VIDEO
| EXT_FILTER_AUDIO
|
119 const QString
& path
= QString() );
120 bool isDying() { return b_isDying
; }
122 QSignalMapper
*menusMapper
;
123 QSignalMapper
*menusUpdateMapper
;
124 QSignalMapper
*SDMapper
;
125 void customEvent( QEvent
*);
128 DialogsProvider( intf_thread_t
*);
129 virtual ~DialogsProvider();
130 static DialogsProvider
*instance
;
132 intf_thread_t
*p_intf
;
136 void openDialog( int );
137 void addFromSimple( bool, bool );
140 void playMRL( const QString
& );
142 void playlistDialog();
143 void bookmarksDialog();
144 void mediaInfoDialog();
145 void mediaCodecDialog();
147 void extendedDialog();
148 void synchroDialog();
149 void messagesDialog();
158 void gotoTimeDialog();
159 void podcastConfigureDialog();
160 void toolbarDialog();
164 void openFileGenericDialog( intf_dialog_args_t
* );
166 void simpleOpenDialog();
167 void simplePLAppendDialog();
168 void simpleMLAppendDialog();
171 void openDiscDialog();
172 void openFileDialog();
173 void openUrlDialog();
174 void openNetDialog();
175 void openCaptureDialog();
177 void PLAppendDialog( int tab
= OPEN_FILE_TAB
);
178 void MLAppendDialog( int tab
= OPEN_FILE_TAB
);
184 void streamingDialog( QWidget
*parent
, const QString
& mrl
, bool b_stream
= true,
185 QStringList options
= QStringList("") );
186 void openAndStreamingDialogs();
187 void openAndTranscodingDialogs();
189 void openAPlaylist();
190 void saveAPlaylist();
192 void loadSubtitlesFile();
196 void menuAction( QObject
*);
197 void menuUpdateAction( QObject
* );
198 void SDMenuAction( const QString
& );
200 void toolBarConfUpdated();
203 class DialogEvent
: public QEvent
206 DialogEvent( int _i_dialog
, int _i_arg
, intf_dialog_args_t
*_p_arg
) :
207 QEvent( (QEvent::Type
)(DialogEvent_Type
) )
209 i_dialog
= _i_dialog
;
213 virtual ~DialogEvent() { }
216 intf_dialog_args_t
*p_arg
;