]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs_provider.hpp
* use an int to select extension filters
[vlc] / 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 protected:
104     friend class QVLCMenu;
105     QSignalMapper *menusMapper;
106     QSignalMapper *menusUpdateMapper;
107     QSignalMapper *SDMapper;
108     void customEvent( QEvent *);
109 private:
110     DialogsProvider( intf_thread_t *);
111     intf_thread_t *p_intf;
112     static DialogsProvider *instance;
113     void addFromSimple( bool, bool );
114
115 public slots:
116     void playlistDialog();
117     void bookmarksDialog();
118     void mediaInfoDialog();
119     void mediaCodecDialog();
120     void prefsDialog();
121     void extendedDialog();
122     void messagesDialog();
123     void simplePLAppendDialog();
124     void simpleMLAppendDialog();
125     void simpleOpenDialog();
126     void openDialog();
127     void openDialog(int );
128     void openFileDialog();
129     void openNetDialog();
130     void openCaptureDialog();
131     void openDiscDialog();
132     void PLAppendDialog();
133     void MLAppendDialog();
134     void popupMenu( int );
135     void doInteraction( intf_dialog_args_t * );
136     void menuAction( QObject *);
137     void menuUpdateAction( QObject *);
138     void SDMenuAction( QString );
139     void streamingDialog();
140     void openPlaylist();
141     void savePlaylist();
142     void PLAppendDir();
143     void MLAppendDir();
144     void quit();
145     void switchToSkins();
146     void helpDialog();
147     void aboutDialog();
148 };
149
150 #endif