]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs_provider.hpp
Rework a bit the OpenDialog calls in order to fix the double-click issue when transco...
[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 <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     virtual ~DialogsProvider();
108     QTimer *fixed_timer;
109
110     QStringList showSimpleOpen( QString help = QString(),
111                                 int filters = EXT_FILTER_MEDIA |
112                                 EXT_FILTER_VIDEO | EXT_FILTER_AUDIO |
113                                 EXT_FILTER_PLAYLIST,
114                                 QString path = QString() );
115 protected:
116     QSignalMapper *menusMapper;
117     QSignalMapper *menusUpdateMapper;
118     QSignalMapper *SDMapper;
119     void customEvent( QEvent *);
120
121 private:
122     DialogsProvider( intf_thread_t *);
123     intf_thread_t *p_intf;
124     static DialogsProvider *instance;
125     void addFromSimple( bool, bool );
126
127 public slots:
128     void doInteraction( intf_dialog_args_t * );
129     void menuAction( QObject *);
130     void menuUpdateAction( QObject * );
131     void SDMenuAction( QString );
132
133     void playlistDialog();
134     void bookmarksDialog();
135     void mediaInfoDialog();
136     void mediaCodecDialog();
137     void prefsDialog();
138     void extendedDialog();
139     void messagesDialog();
140 #ifdef ENABLE_VLM
141     void vlmDialog();
142 #endif
143     void helpDialog();
144 #ifdef UPDATE_CHECK
145     void updateDialog();
146 #endif
147     void aboutDialog();
148     void gotoTimeDialog();
149     void podcastConfigureDialog();
150
151     void simpleOpenDialog();
152     void simplePLAppendDialog();
153     void simpleMLAppendDialog();
154
155     void openDialog();
156     void openDialog( int );
157     void openDiscDialog();
158     void openFileDialog();
159     void openNetDialog();
160     void openCaptureDialog();
161
162     void PLAppendDialog();
163     void MLAppendDialog();
164     void PLAppendDir();
165     void MLAppendDir();
166
167     void streamingDialog( QWidget *parent, QString mrl = "",
168             bool b_stream = true );
169     void openThenStreamingDialogs();
170     void openThenTranscodingDialogs();
171
172     void openAPlaylist();
173     void saveAPlaylist();
174
175     void loadSubtitlesFile();
176
177     void quit();
178 };
179
180 #endif