]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs_provider.hpp
* Use subtitles file extension filter for the "Open subtitles file" dialog.
[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 ADD_FILTER_MEDIA( string )   \
37     string += _("Media Files");      \
38     string += " ( ";                 \
39     string += EXTENSIONS_MEDIA;      \
40     string += ");;";
41 #define ADD_FILTER_VIDEO( string )   \
42     string += _("Video Files");      \
43     string += " ( ";                 \
44     string += EXTENSIONS_VIDEO;      \
45     string += ");;";
46 #define ADD_FILTER_AUDIO( string )   \
47     string += _("Audio Files");      \
48     string += " ( ";                 \
49     string += EXTENSIONS_AUDIO;      \
50     string += ");;";
51 #define ADD_FILTER_PLAYLIST( string )\
52     string += _("Playlist Files");   \
53     string += " ( ";                 \
54     string += EXTENSIONS_PLAYLIST;   \
55     string += ");;";
56 #define ADD_FILTER_SUBTITLE( string )\
57     string += _("Subtitles Files");   \
58     string += " ( ";                 \
59     string += EXTENSIONS_SUBTITLE;   \
60     string += ");;";
61 #define ADD_FILTER_ALL( string )     \
62     string += _("All Files");        \
63     string += " (*.*)";
64
65
66 class QEvent;
67 class QSignalMapper;
68 class QVLCMenu;
69
70 class DialogsProvider : public QObject
71 {
72     Q_OBJECT;
73 public:
74     static DialogsProvider *getInstance()
75     {
76         assert( instance );
77         return instance;
78     }
79     static DialogsProvider *getInstance( intf_thread_t *p_intf )
80     {
81         if( !instance )
82             instance = new DialogsProvider( p_intf );
83         return instance;
84     }
85     static void killInstance()
86     {
87         if( instance ) delete instance;
88         instance=NULL;
89     }
90     virtual ~DialogsProvider();
91     QTimer *fixed_timer;
92
93     QStringList showSimpleOpen( QString help = QString(), bool all = true,
94                                 bool video = true, bool audio = true,
95                                 bool subs = false, bool pls = true );
96 protected:
97     friend class QVLCMenu;
98     QSignalMapper *menusMapper;
99     QSignalMapper *menusUpdateMapper;
100     QSignalMapper *SDMapper;
101     void customEvent( QEvent *);
102 private:
103     DialogsProvider( intf_thread_t *);
104     intf_thread_t *p_intf;
105     static DialogsProvider *instance;
106     void addFromSimple( bool, bool );
107
108 public slots:
109     void playlistDialog();
110     void bookmarksDialog();
111     void mediaInfoDialog();
112     void mediaCodecDialog();
113     void prefsDialog();
114     void extendedDialog();
115     void messagesDialog();
116     void simplePLAppendDialog();
117     void simpleMLAppendDialog();
118     void simpleOpenDialog();
119     void openDialog();
120     void openDialog(int );
121     void openFileDialog();
122     void openNetDialog();
123     void openCaptureDialog();
124     void openDiscDialog();
125     void PLAppendDialog();
126     void MLAppendDialog();
127     void popupMenu( int );
128     void doInteraction( intf_dialog_args_t * );
129     void menuAction( QObject *);
130     void menuUpdateAction( QObject *);
131     void SDMenuAction( QString );
132     void streamingDialog();
133     void openPlaylist();
134     void savePlaylist();
135     void PLAppendDir();
136     void MLAppendDir();
137     void quit();
138     void switchToSkins();
139     void helpDialog();
140     void aboutDialog();
141 };
142
143 #endif