]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs_provider.hpp
770a64e4cd98487fee5073767ee5aee106190ee6
[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 #define OPEN_FILE_TAB           0x0
72 #define OPEN_DISC_TAB           0x1
73 #define OPEN_NETWORK_TAB        0x2
74 #define OPEN_CAPTURE_TAB        0x3
75
76 #define OPEN_AND_PLAY           0x0
77 #define OPEN_AND_STREAM         0x1
78 #define OPEN_AND_SAVE           0x2
79
80 class QEvent;
81 class QSignalMapper;
82 class QVLCMenu;
83
84 class DialogsProvider : public QObject
85 {
86     Q_OBJECT;
87 public:
88     static DialogsProvider *getInstance()
89     {
90         assert( instance );
91         return instance;
92     }
93     static DialogsProvider *getInstance( intf_thread_t *p_intf )
94     {
95         if( !instance )
96             instance = new DialogsProvider( p_intf );
97         return instance;
98     }
99     static void killInstance()
100     {
101         if( instance ) delete instance;
102         instance=NULL;
103     }
104     virtual ~DialogsProvider();
105     QTimer *fixed_timer;
106
107     QStringList showSimpleOpen( QString help = QString(),
108                                 int filters = EXT_FILTER_MEDIA |
109                                 EXT_FILTER_VIDEO | EXT_FILTER_AUDIO |
110                                 EXT_FILTER_PLAYLIST,
111                                 QString path = QString() );
112 protected:
113     friend class QVLCMenu;
114     QSignalMapper *menusMapper;
115     QSignalMapper *menusUpdateMapper;
116     QSignalMapper *SDMapper;
117     void customEvent( QEvent *);
118 private:
119     DialogsProvider( intf_thread_t *);
120     intf_thread_t *p_intf;
121     static DialogsProvider *instance;
122     void addFromSimple( bool, bool );
123
124 public slots:
125     void playlistDialog();
126     void bookmarksDialog();
127     void mediaInfoDialog();
128     void mediaCodecDialog();
129     void prefsDialog();
130     void extendedDialog();
131     void messagesDialog();
132     void simplePLAppendDialog();
133     void simpleMLAppendDialog();
134     void simpleOpenDialog();
135     void openDialog();
136     void openDialog(int );
137     void openFileDialog();
138     void openNetDialog();
139     void openCaptureDialog();
140     void openDiscDialog();
141     void PLAppendDialog();
142     void MLAppendDialog();
143     void doInteraction( intf_dialog_args_t * );
144     void menuAction( QObject *);
145     void menuUpdateAction( QObject *);
146     void SDMenuAction( QString );
147     void streamingDialog( QString mrl = "", bool b_stream = true );
148     void openThenStreamingDialogs();
149     void openThenTranscodingDialogs();
150     void openPlaylist();
151     void savePlaylist();
152     void PLAppendDir();
153     void MLAppendDir();
154     void quit();
155     void switchToSkins();
156     void gotoTimeDialog();
157     void helpDialog();
158     void aboutDialog();
159 };
160
161 #endif