| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
#ifndef _DIALOGS_PROVIDER_H_ |
|---|
| 26 |
#define _DIALOGS_PROVIDER_H_ |
|---|
| 27 |
|
|---|
| 28 |
#ifdef HAVE_CONFIG_H |
|---|
| 29 |
# include "config.h" |
|---|
| 30 |
#endif |
|---|
| 31 |
|
|---|
| 32 |
#include <assert.h> |
|---|
| 33 |
#include <vlc_common.h> |
|---|
| 34 |
#include <vlc_interface.h> |
|---|
| 35 |
|
|---|
| 36 |
#include "qt4.hpp" |
|---|
| 37 |
#include "dialogs/interaction.hpp" |
|---|
| 38 |
#include "dialogs/open.hpp" |
|---|
| 39 |
|
|---|
| 40 |
#include <QObject> |
|---|
| 41 |
#include <QTimer> |
|---|
| 42 |
#include <QApplication> |
|---|
| 43 |
|
|---|
| 44 |
#define ADD_FILTER_MEDIA( string ) \ |
|---|
| 45 |
string += qtr( "Media Files" ); \ |
|---|
| 46 |
string += " ( "; \ |
|---|
| 47 |
string += EXTENSIONS_MEDIA; \ |
|---|
| 48 |
string += ");;"; |
|---|
| 49 |
#define ADD_FILTER_VIDEO( string ) \ |
|---|
| 50 |
string += qtr( "Video Files" ); \ |
|---|
| 51 |
string += " ( "; \ |
|---|
| 52 |
string += EXTENSIONS_VIDEO; \ |
|---|
| 53 |
string += ");;"; |
|---|
| 54 |
#define ADD_FILTER_AUDIO( string ) \ |
|---|
| 55 |
string += qtr( "Audio Files" ); \ |
|---|
| 56 |
string += " ( "; \ |
|---|
| 57 |
string += EXTENSIONS_AUDIO; \ |
|---|
| 58 |
string += ");;"; |
|---|
| 59 |
#define ADD_FILTER_PLAYLIST( string ) \ |
|---|
| 60 |
string += qtr( "Playlist Files" ); \ |
|---|
| 61 |
string += " ( "; \ |
|---|
| 62 |
string += EXTENSIONS_PLAYLIST; \ |
|---|
| 63 |
string += ");;"; |
|---|
| 64 |
#define ADD_FILTER_SUBTITLE( string ) \ |
|---|
| 65 |
string += qtr( "Subtitles Files" );\ |
|---|
| 66 |
string += " ( "; \ |
|---|
| 67 |
string += EXTENSIONS_SUBTITLE; \ |
|---|
| 68 |
string += ");;"; |
|---|
| 69 |
#define ADD_FILTER_ALL( string ) \ |
|---|
| 70 |
string += qtr( "All Files" ); \ |
|---|
| 71 |
string += " (*.*)"; |
|---|
| 72 |
|
|---|
| 73 |
enum { |
|---|
| 74 |
EXT_FILTER_MEDIA = 0x01, |
|---|
| 75 |
EXT_FILTER_VIDEO = 0x02, |
|---|
| 76 |
EXT_FILTER_AUDIO = 0x04, |
|---|
| 77 |
EXT_FILTER_PLAYLIST = 0x08, |
|---|
| 78 |
EXT_FILTER_SUBTITLE = 0x10, |
|---|
| 79 |
}; |
|---|
| 80 |
|
|---|
| 81 |
class QEvent; |
|---|
| 82 |
class QSignalMapper; |
|---|
| 83 |
class QVLCMenu; |
|---|
| 84 |
|
|---|
| 85 |
class DialogsProvider : public QObject |
|---|
| 86 |
{ |
|---|
| 87 |
Q_OBJECT; |
|---|
| 88 |
friend class QVLCMenu; |
|---|
| 89 |
|
|---|
| 90 |
public: |
|---|
| 91 |
static DialogsProvider *getInstance() |
|---|
| 92 |
{ |
|---|
| 93 |
assert( instance ); |
|---|
| 94 |
return instance; |
|---|
| 95 |
} |
|---|
| 96 |
static DialogsProvider *getInstance( intf_thread_t *p_intf ) |
|---|
| 97 |
{ |
|---|
| 98 |
if( !instance ) |
|---|
| 99 |
instance = new DialogsProvider( p_intf ); |
|---|
| 100 |
return instance; |
|---|
| 101 |
} |
|---|
| 102 |
static void killInstance() |
|---|
| 103 |
{ |
|---|
| 104 |
if( instance ) delete instance; |
|---|
| 105 |
instance = NULL; |
|---|
| 106 |
} |
|---|
| 107 |
static bool isAlive() |
|---|
| 108 |
{ |
|---|
| 109 |
return ( instance != NULL ); |
|---|
| 110 |
} |
|---|
| 111 |
virtual ~DialogsProvider(); |
|---|
| 112 |
QTimer *fixed_timer; |
|---|
| 113 |
|
|---|
| 114 |
QStringList showSimpleOpen( QString help = QString(), |
|---|
| 115 |
int filters = EXT_FILTER_MEDIA | |
|---|
| 116 |
EXT_FILTER_VIDEO | EXT_FILTER_AUDIO | |
|---|
| 117 |
EXT_FILTER_PLAYLIST, |
|---|
| 118 |
QString path = QString() ); |
|---|
| 119 |
bool isDying() { return b_isDying; } |
|---|
| 120 |
protected: |
|---|
| 121 |
QSignalMapper *menusMapper; |
|---|
| 122 |
QSignalMapper *menusUpdateMapper; |
|---|
| 123 |
QSignalMapper *SDMapper; |
|---|
| 124 |
void customEvent( QEvent *); |
|---|
| 125 |
|
|---|
| 126 |
private: |
|---|
| 127 |
DialogsProvider( intf_thread_t *); |
|---|
| 128 |
intf_thread_t *p_intf; |
|---|
| 129 |
static DialogsProvider *instance; |
|---|
| 130 |
void addFromSimple( bool, bool ); |
|---|
| 131 |
bool b_isDying; |
|---|
| 132 |
|
|---|
| 133 |
public slots: |
|---|
| 134 |
void doInteraction( intf_dialog_args_t * ); |
|---|
| 135 |
void menuAction( QObject *); |
|---|
| 136 |
void menuUpdateAction( QObject * ); |
|---|
| 137 |
void SDMenuAction( QString ); |
|---|
| 138 |
|
|---|
| 139 |
void playlistDialog(); |
|---|
| 140 |
void bookmarksDialog(); |
|---|
| 141 |
void mediaInfoDialog(); |
|---|
| 142 |
void mediaCodecDialog(); |
|---|
| 143 |
void prefsDialog(); |
|---|
| 144 |
void extendedDialog(); |
|---|
| 145 |
void messagesDialog(); |
|---|
| 146 |
#ifdef ENABLE_VLM |
|---|
| 147 |
void vlmDialog(); |
|---|
| 148 |
#endif |
|---|
| 149 |
void helpDialog(); |
|---|
| 150 |
#ifdef UPDATE_CHECK |
|---|
| 151 |
void updateDialog(); |
|---|
| 152 |
#endif |
|---|
| 153 |
void aboutDialog(); |
|---|
| 154 |
void gotoTimeDialog(); |
|---|
| 155 |
void podcastConfigureDialog(); |
|---|
| 156 |
|
|---|
| 157 |
void simpleOpenDialog(); |
|---|
| 158 |
void simplePLAppendDialog(); |
|---|
| 159 |
void simpleMLAppendDialog(); |
|---|
| 160 |
|
|---|
| 161 |
void openDialog(); |
|---|
| 162 |
void openDialog( int ); |
|---|
| 163 |
void openFileGenericDialog( intf_dialog_args_t * ); |
|---|
| 164 |
void openDiscDialog(); |
|---|
| 165 |
void openFileDialog(); |
|---|
| 166 |
void openNetDialog(); |
|---|
| 167 |
void openCaptureDialog(); |
|---|
| 168 |
|
|---|
| 169 |
void PLAppendDialog(); |
|---|
| 170 |
void MLAppendDialog(); |
|---|
| 171 |
void PLOpenDir(); |
|---|
| 172 |
void PLAppendDir(); |
|---|
| 173 |
void MLAppendDir(); |
|---|
| 174 |
|
|---|
| 175 |
void streamingDialog( QWidget *parent, QString mrl = "", |
|---|
| 176 |
bool b_stream = true ); |
|---|
| 177 |
void openThenStreamingDialogs(); |
|---|
| 178 |
void openThenTranscodingDialogs(); |
|---|
| 179 |
|
|---|
| 180 |
void openAPlaylist(); |
|---|
| 181 |
void saveAPlaylist(); |
|---|
| 182 |
|
|---|
| 183 |
void loadSubtitlesFile(); |
|---|
| 184 |
|
|---|
| 185 |
void quit(); |
|---|
| 186 |
}; |
|---|
| 187 |
|
|---|
| 188 |
#endif |
|---|