dialogs_provider.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef QVLC_DIALOGS_PROVIDER_H_
00026 #define QVLC_DIALOGS_PROVIDER_H_
00027
00028 #ifdef HAVE_CONFIG_H
00029 # include "config.h"
00030 #endif
00031
00032 #include <assert.h>
00033
00034 #include "qt4.hpp"
00035
00036 #include "dialogs/open.hpp"
00037 #include <QObject>
00038 #include <QStringList>
00039
00040 #define ADD_FILTER_MEDIA( string ) \
00041 string += qtr( "Media Files" ); \
00042 string += " ( "; \
00043 string += EXTENSIONS_MEDIA; \
00044 string += ");;";
00045 #define ADD_FILTER_VIDEO( string ) \
00046 string += qtr( "Video Files" ); \
00047 string += " ( "; \
00048 string += EXTENSIONS_VIDEO; \
00049 string += ");;";
00050 #define ADD_FILTER_AUDIO( string ) \
00051 string += qtr( "Audio Files" ); \
00052 string += " ( "; \
00053 string += EXTENSIONS_AUDIO; \
00054 string += ");;";
00055 #define ADD_FILTER_PLAYLIST( string ) \
00056 string += qtr( "Playlist Files" ); \
00057 string += " ( "; \
00058 string += EXTENSIONS_PLAYLIST; \
00059 string += ");;";
00060 #define ADD_FILTER_SUBTITLE( string ) \
00061 string += qtr( "Subtitles Files" );\
00062 string += " ( "; \
00063 string += EXTENSIONS_SUBTITLE; \
00064 string += ");;";
00065 #define ADD_FILTER_ALL( string ) \
00066 string += qtr( "All Files" ); \
00067 string += " (*)";
00068
00069 enum {
00070 EXT_FILTER_MEDIA = 0x01,
00071 EXT_FILTER_VIDEO = 0x02,
00072 EXT_FILTER_AUDIO = 0x04,
00073 EXT_FILTER_PLAYLIST = 0x08,
00074 EXT_FILTER_SUBTITLE = 0x10,
00075 };
00076
00077 enum {
00078 DialogEvent_Type = QEvent::User + DialogEventType + 1,
00079
00080
00081 SetVideoOnTopEvent_Type = QEvent::User + DialogEventType + 4,
00082 };
00083
00084 class QEvent;
00085 class QSignalMapper;
00086 class QVLCMenu;
00087
00088 class DialogsProvider : public QObject
00089 {
00090 Q_OBJECT
00091 friend class QVLCMenu;
00092
00093 public:
00094 static DialogsProvider *getInstance()
00095 {
00096 assert( instance );
00097 return instance;
00098 }
00099 static DialogsProvider *getInstance( intf_thread_t *p_intf )
00100 {
00101 if( !instance )
00102 instance = new DialogsProvider( p_intf );
00103 return instance;
00104 }
00105 static void killInstance()
00106 {
00107 delete instance;
00108 instance = NULL;
00109 }
00110 static bool isAlive()
00111 {
00112 return ( instance != NULL );
00113 }
00114
00115 QStringList showSimpleOpen( const QString& help = QString(),
00116 int filters = EXT_FILTER_MEDIA |
00117 EXT_FILTER_VIDEO | EXT_FILTER_AUDIO |
00118 EXT_FILTER_PLAYLIST,
00119 const QString& path = QString() );
00120 bool isDying() { return b_isDying; }
00121 protected:
00122 QSignalMapper *menusMapper;
00123 QSignalMapper *menusUpdateMapper;
00124 QSignalMapper *SDMapper;
00125 void customEvent( QEvent *);
00126
00127 private:
00128 DialogsProvider( intf_thread_t *);
00129 virtual ~DialogsProvider();
00130 static DialogsProvider *instance;
00131
00132 intf_thread_t *p_intf;
00133 QWidget* root;
00134 bool b_isDying;
00135
00136 void openDialog( int );
00137 void addFromSimple( bool, bool );
00138
00139 public slots:
00140 void playMRL( const QString & );
00141
00142 void playlistDialog();
00143 void bookmarksDialog();
00144 void mediaInfoDialog();
00145 void mediaCodecDialog();
00146 void prefsDialog();
00147 void extendedDialog();
00148 void synchroDialog();
00149 void messagesDialog();
00150 #ifdef ENABLE_VLM
00151 void vlmDialog();
00152 #endif
00153 void helpDialog();
00154 #ifdef UPDATE_CHECK
00155 void updateDialog();
00156 #endif
00157 void aboutDialog();
00158 void gotoTimeDialog();
00159 void podcastConfigureDialog();
00160 void toolbarDialog();
00161 void pluginDialog();
00162 void epgDialog();
00163
00164 void openFileGenericDialog( intf_dialog_args_t * );
00165
00166 void simpleOpenDialog();
00167 void simplePLAppendDialog();
00168 void simpleMLAppendDialog();
00169
00170 void openDialog();
00171 void openDiscDialog();
00172 void openFileDialog();
00173 void openUrlDialog();
00174 void openNetDialog();
00175 void openCaptureDialog();
00176
00177 void PLAppendDialog( int tab = OPEN_FILE_TAB );
00178 void MLAppendDialog( int tab = OPEN_FILE_TAB );
00179
00180 void PLOpenDir();
00181 void PLAppendDir();
00182 void MLAppendDir();
00183
00184 void streamingDialog( QWidget *parent, const QString& mrl, bool b_stream = true,
00185 QStringList options = QStringList("") );
00186 void openAndStreamingDialogs();
00187 void openAndTranscodingDialogs();
00188
00189 void openAPlaylist();
00190 void saveAPlaylist();
00191
00192 void loadSubtitlesFile();
00193
00194 void quit();
00195 private slots:
00196 void menuAction( QObject *);
00197 void menuUpdateAction( QObject * );
00198 void SDMenuAction( const QString& );
00199 signals:
00200 void toolBarConfUpdated();
00201 };
00202
00203 class DialogEvent : public QEvent
00204 {
00205 public:
00206 DialogEvent( int _i_dialog, int _i_arg, intf_dialog_args_t *_p_arg ) :
00207 QEvent( (QEvent::Type)(DialogEvent_Type) )
00208 {
00209 i_dialog = _i_dialog;
00210 i_arg = _i_arg;
00211 p_arg = _p_arg;
00212 };
00213 virtual ~DialogEvent() { };
00214
00215 int i_arg, i_dialog;
00216 intf_dialog_args_t *p_arg;
00217 };
00218
00219
00220 #endif