]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs_provider.hpp
Qt4 - Menus. Add the missing dialogs calls. If someone wants to write VLM and Bookmar...
[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 #include <QObject>
29 #include <QTimer>
30 #include <QApplication>
31
32 #include "dialogs/interaction.hpp"
33
34 #include <assert.h>
35 #include <vlc/vlc.h>
36 #include <vlc_interface.h>
37
38 #define EXT_FILTER_MEDIA        0x01
39 #define EXT_FILTER_VIDEO        0x02
40 #define EXT_FILTER_AUDIO        0x04
41 #define EXT_FILTER_PLAYLIST     0x08
42 #define EXT_FILTER_SUBTITLE     0x10
43
44 #define ADD_FILTER_MEDIA( string )   \
45     string += _("Media Files");      \
46     string += " ( ";                 \
47     string += EXTENSIONS_MEDIA;      \
48     string += ");;";
49 #define ADD_FILTER_VIDEO( string )   \
50     string += _("Video Files");      \
51     string += " ( ";                 \
52     string += EXTENSIONS_VIDEO;      \
53     string += ");;";
54 #define ADD_FILTER_AUDIO( string )   \
55     string += _("Audio Files");      \
56     string += " ( ";                 \
57     string += EXTENSIONS_AUDIO;      \
58     string += ");;";
59 #define ADD_FILTER_PLAYLIST( string )\
60     string += _("Playlist Files");   \
61     string += " ( ";                 \
62     string += EXTENSIONS_PLAYLIST;   \
63     string += ");;";
64 #define ADD_FILTER_SUBTITLE( string )\
65     string += _("Subtitles Files");   \
66     string += " ( ";                 \
67     string += EXTENSIONS_SUBTITLE;   \
68     string += ");;";
69 #define ADD_FILTER_ALL( string )     \
70     string += _("All Files");        \
71     string += " (*.*)";
72
73 #define OPEN_FILE_TAB           0x0
74 #define OPEN_DISC_TAB           0x1
75 #define OPEN_NETWORK_TAB        0x2
76 #define OPEN_CAPTURE_TAB        0x3
77
78 #define OPEN_AND_PLAY           0x0
79 #define OPEN_AND_STREAM         0x1
80 #define OPEN_AND_SAVE           0x2
81
82 class QEvent;
83 class QSignalMapper;
84 class QVLCMenu;
85
86 class DialogsProvider : public QObject
87 {
88     Q_OBJECT;
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     virtual ~DialogsProvider();
107     QTimer *fixed_timer;
108
109     QStringList showSimpleOpen( QString help = QString(),
110                                 int filters = EXT_FILTER_MEDIA |
111                                 EXT_FILTER_VIDEO | EXT_FILTER_AUDIO |
112                                 EXT_FILTER_PLAYLIST,
113                                 QString path = QString() );
114 protected:
115     friend class QVLCMenu;
116     QSignalMapper *menusMapper;
117     QSignalMapper *menusUpdateMapper;
118     QSignalMapper *SDMapper;
119     void customEvent( QEvent *);
120 private:
121     DialogsProvider( intf_thread_t *);
122     intf_thread_t *p_intf;
123     static DialogsProvider *instance;
124     void addFromSimple( bool, bool );
125
126 public slots:
127     void playlistDialog();
128     void bookmarksDialog();
129     void mediaInfoDialog();
130     void mediaCodecDialog();
131     void prefsDialog();
132     void extendedDialog();
133     void messagesDialog();
134     void simplePLAppendDialog();
135     void simpleMLAppendDialog();
136     void simpleOpenDialog();
137     void openDialog();
138     void openDialog(int );
139     void openFileDialog();
140     void openNetDialog();
141     void openCaptureDialog();
142     void openDiscDialog();
143     void PLAppendDialog();
144     void MLAppendDialog();
145     void doInteraction( intf_dialog_args_t * );
146     void menuAction( QObject *);
147     void menuUpdateAction( QObject *);
148     void SDMenuAction( QString );
149     void streamingDialog( QString mrl = "", bool b_stream = true );
150     void openThenStreamingDialogs();
151     void openThenTranscodingDialogs();
152     void openPlaylist();
153     void savePlaylist();
154     void PLAppendDir();
155     void MLAppendDir();
156     void quit();
157     void hideMenus();
158     void switchToSkins();
159     void gotoTimeDialog();
160     void vlmDialog();
161     void helpDialog();
162     void aboutDialog();
163 };
164
165 #endif