Qt4 - Open and Streaming Dialogs.
[vlc.git] / modules / gui / qt4 / dialogs_provider.hpp
1 /*****************************************************************************
2  * dialogs_provider.hpp : Dialogs provider
3  ****************************************************************************
4  * Copyright (C) 2006 the VideoLAN team
5  * $Id$
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/
22
23 #ifndef _DIALOGS_PROVIDER_H_
24 #define _DIALOGS_PROVIDER_H_
25
26 #include <QObject>
27 #include <QTimer>
28 #include <QApplication>
29
30 #include "dialogs/interaction.hpp"
31
32 #include <assert.h>
33 #include <vlc/vlc.h>
34 #include <vlc_interface.h>
35
36 #define EXT_FILTER_MEDIA        0x01
37 #define EXT_FILTER_VIDEO        0x02
38 #define EXT_FILTER_AUDIO        0x04
39 #define EXT_FILTER_PLAYLIST     0x08
40 #define EXT_FILTER_SUBTITLE     0x10
41
42 #define ADD_FILTER_MEDIA( string )   \
43     string += _("Media Files");      \
44     string += " ( ";                 \
45     string += EXTENSIONS_MEDIA;      \
46     string += ");;";
47 #define ADD_FILTER_VIDEO( string )   \
48     string += _("Video Files");      \
49     string += " ( ";                 \
50     string += EXTENSIONS_VIDEO;      \
51     string += ");;";
52 #define ADD_FILTER_AUDIO( string )   \
53     string += _("Audio Files");      \
54     string += " ( ";                 \
55     string += EXTENSIONS_AUDIO;      \
56     string += ");;";
57 #define ADD_FILTER_PLAYLIST( string )\
58     string += _("Playlist Files");   \
59     string += " ( ";                 \
60     string += EXTENSIONS_PLAYLIST;   \
61     string += ");;";
62 #define ADD_FILTER_SUBTITLE( string )\
63     string += _("Subtitles Files");   \
64     string += " ( ";                 \
65     string += EXTENSIONS_SUBTITLE;   \
66     string += ");;";
67 #define ADD_FILTER_ALL( string )     \
68     string += _("All Files");        \
69     string += " (*.*)";
70
71
72 class QEvent;
73 class QSignalMapper;
74 class QVLCMenu;
75
76 class DialogsProvider : public QObject
77 {
78     Q_OBJECT;
79 public:
80     static DialogsProvider *getInstance()
81     {
82         assert( instance );
83         return instance;
84     }
85     static DialogsProvider *getInstance( intf_thread_t *p_intf )
86     {
87         if( !instance )
88             instance = new DialogsProvider( p_intf );
89         return instance;
90     }
91     static void killInstance()
92     {
93         if( instance ) delete instance;
94         instance=NULL;
95     }
96     virtual ~DialogsProvider();
97     QTimer *fixed_timer;
98
99     QStringList showSimpleOpen( QString help = QString(),
100                                 int filters = EXT_FILTER_MEDIA |
101                                 EXT_FILTER_VIDEO | EXT_FILTER_AUDIO |
102                                 EXT_FILTER_PLAYLIST,
103                                 QString path = QString() );
104 protected:
105     friend class QVLCMenu;
106     QSignalMapper *menusMapper;
107     QSignalMapper *menusUpdateMapper;
108     QSignalMapper *SDMapper;
109     void customEvent( QEvent *);
110 private:
111     DialogsProvider( intf_thread_t *);
112     intf_thread_t *p_intf;
113     static DialogsProvider *instance;
114     void addFromSimple( bool, bool );
115
116 public slots:
117     void playlistDialog();
118     void bookmarksDialog();
119     void mediaInfoDialog();
120     void mediaCodecDialog();
121     void prefsDialog();
122     void extendedDialog();
123     void messagesDialog();
124     void simplePLAppendDialog();
125     void simpleMLAppendDialog();
126     void simpleOpenDialog();
127     void openDialog();
128     void openDialog(int );
129     void openFileDialog();
130     void openNetDialog();
131     void openCaptureDialog();
132     void openDiscDialog();
133     void PLAppendDialog();
134     void MLAppendDialog();
135     void popupMenu( int );
136     void doInteraction( intf_dialog_args_t * );
137     void menuAction( QObject *);
138     void menuUpdateAction( QObject *);
139     void SDMenuAction( QString );
140     void streamingDialog( QString mrl = "");
141     void openThenStreamingDialogs();
142     void openPlaylist();
143     void savePlaylist();
144     void PLAppendDir();
145     void MLAppendDir();
146     void quit();
147     void switchToSkins();
148     void gotoTimeDialog();
149     void helpDialog();
150     void aboutDialog();
151 };
152
153 #endif