]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs_provider.hpp
New recently played menu.
[vlc] / modules / gui / qt4 / dialogs_provider.hpp
1 /*****************************************************************************
2  * dialogs_provider.hpp : Dialogs provider
3  ****************************************************************************
4  * Copyright (C) 2006-2007 the VideoLAN team
5  * $Id$
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
8  *          Jean-Baptiste Kempf <jb@videolan.org>
9  *
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.
14  *
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.
19  *
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  *****************************************************************************/
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 <QApplication>
42
43 #define ADD_FILTER_MEDIA( string )     \
44     string += qtr( "Media Files" );    \
45     string += " ( ";                   \
46     string += EXTENSIONS_MEDIA;        \
47     string += ");;";
48 #define ADD_FILTER_VIDEO( string )     \
49     string += qtr( "Video Files" );    \
50     string += " ( ";                   \
51     string += EXTENSIONS_VIDEO;        \
52     string += ");;";
53 #define ADD_FILTER_AUDIO( string )     \
54     string += qtr( "Audio Files" );    \
55     string += " ( ";                   \
56     string += EXTENSIONS_AUDIO;        \
57     string += ");;";
58 #define ADD_FILTER_PLAYLIST( string )  \
59     string += qtr( "Playlist Files" ); \
60     string += " ( ";                   \
61     string += EXTENSIONS_PLAYLIST;     \
62     string += ");;";
63 #define ADD_FILTER_SUBTITLE( string )  \
64     string += qtr( "Subtitles Files" );\
65     string += " ( ";                   \
66     string += EXTENSIONS_SUBTITLE;     \
67     string += ");;";
68 #define ADD_FILTER_ALL( string )       \
69     string += qtr( "All Files" );      \
70     string += " (*)";
71
72 enum {
73     EXT_FILTER_MEDIA     =  0x01,
74     EXT_FILTER_VIDEO     =  0x02,
75     EXT_FILTER_AUDIO     =  0x04,
76     EXT_FILTER_PLAYLIST  =  0x08,
77     EXT_FILTER_SUBTITLE  =  0x10,
78 };
79
80 class QEvent;
81 class QSignalMapper;
82 class QVLCMenu;
83
84 class DialogsProvider : public QObject
85 {
86     Q_OBJECT;
87     friend class QVLCMenu;
88
89 public:
90     static DialogsProvider *getInstance()
91     {
92         assert( instance );
93         return instance;
94     }
95     static DialogsProvider *getInstance( intf_thread_t *p_intf )
96     {
97         if( !instance )
98             instance = new DialogsProvider( p_intf );
99         return instance;
100     }
101     static void killInstance()
102     {
103         if( instance ) delete instance;
104         instance = NULL;
105     }
106     static bool isAlive()
107     {
108         return ( instance != NULL );
109     }
110     virtual ~DialogsProvider();
111
112     QStringList showSimpleOpen( QString help = QString(),
113                                 int filters = EXT_FILTER_MEDIA |
114                                 EXT_FILTER_VIDEO | EXT_FILTER_AUDIO |
115                                 EXT_FILTER_PLAYLIST,
116                                 QString path = QString() );
117     bool isDying() { return b_isDying; }
118 protected:
119     QSignalMapper *menusMapper;
120     QSignalMapper *menusUpdateMapper;
121     QSignalMapper *SDMapper;
122     void customEvent( QEvent *);
123
124 private:
125     DialogsProvider( intf_thread_t *);
126     intf_thread_t *p_intf;
127     static DialogsProvider *instance;
128     void addFromSimple( bool, bool );
129     bool b_isDying;
130
131 public slots:
132     void doInteraction( intf_dialog_args_t * );
133     void menuAction( QObject *);
134     void menuUpdateAction( QObject * );
135     void SDMenuAction( QString );
136     void playMRL( const QString & );
137
138     void playlistDialog();
139     void bookmarksDialog();
140     void mediaInfoDialog();
141     void mediaCodecDialog();
142     void prefsDialog();
143     void extendedDialog();
144     void messagesDialog();
145 #ifdef ENABLE_VLM
146     void vlmDialog();
147 #endif
148     void helpDialog();
149 #ifdef UPDATE_CHECK
150     void updateDialog();
151 #endif
152     void aboutDialog();
153     void gotoTimeDialog();
154     void podcastConfigureDialog();
155
156     void simpleOpenDialog();
157     void simplePLAppendDialog();
158     void simpleMLAppendDialog();
159
160     void openDialog();
161     void openDialog( int );
162     void openFileGenericDialog( intf_dialog_args_t * );
163     void openDiscDialog();
164     void openFileDialog();
165     void openNetDialog();
166     void openCaptureDialog();
167
168     void PLAppendDialog();
169     void MLAppendDialog();
170     void PLOpenDir();
171     void PLAppendDir();
172     void MLAppendDir();
173
174     void streamingDialog( QWidget *parent, QString mrl = "",
175             bool b_stream = true );
176     void openThenStreamingDialogs();
177     void openThenTranscodingDialogs();
178
179     void openAPlaylist();
180     void saveAPlaylist();
181
182     void loadSubtitlesFile();
183
184     void quit();
185 };
186
187 #endif