Qt: correctly display the right treeView columns
[vlc.git] / modules / gui / qt4 / dialogs_provider.hpp
blob279f83bdcdebd0db7282ec79f0eaa86c40a7e204
1 /*****************************************************************************
2 * dialogs_provider.hpp : Dialogs provider
3 ****************************************************************************
4 * Copyright (C) 2006-2008 the VideoLAN team
5 * $Id$
7 * Authors: Clément Stenac <zorglub@videolan.org>
8 * Jean-Baptiste Kempf <jb@videolan.org>
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.
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.
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 *****************************************************************************/
25 #ifndef QVLC_DIALOGS_PROVIDER_H_
26 #define QVLC_DIALOGS_PROVIDER_H_
28 #ifdef HAVE_CONFIG_H
29 # include "config.h"
30 #endif
32 #include <assert.h>
34 #include "qt4.hpp"
36 #include "dialogs/open.hpp"
37 #include <QObject>
38 #include <QStringList>
40 #define ADD_FILTER_MEDIA( string ) \
41 string += qtr( "Media Files" ); \
42 string += " ( "; \
43 string += EXTENSIONS_MEDIA; \
44 string += ");;";
45 #define ADD_FILTER_VIDEO( string ) \
46 string += qtr( "Video Files" ); \
47 string += " ( "; \
48 string += EXTENSIONS_VIDEO; \
49 string += ");;";
50 #define ADD_FILTER_AUDIO( string ) \
51 string += qtr( "Audio Files" ); \
52 string += " ( "; \
53 string += EXTENSIONS_AUDIO; \
54 string += ");;";
55 #define ADD_FILTER_PLAYLIST( string ) \
56 string += qtr( "Playlist Files" ); \
57 string += " ( "; \
58 string += EXTENSIONS_PLAYLIST; \
59 string += ");;";
60 #define ADD_FILTER_SUBTITLE( string ) \
61 string += qtr( "Subtitles Files" );\
62 string += " ( "; \
63 string += EXTENSIONS_SUBTITLE; \
64 string += ");;";
65 #define ADD_FILTER_ALL( string ) \
66 string += qtr( "All Files" ); \
67 string += " (*)";
69 enum {
70 EXT_FILTER_MEDIA = 0x01,
71 EXT_FILTER_VIDEO = 0x02,
72 EXT_FILTER_AUDIO = 0x04,
73 EXT_FILTER_PLAYLIST = 0x08,
74 EXT_FILTER_SUBTITLE = 0x10,
77 enum {
78 DialogEvent_Type = QEvent::User + DialogEventType + 1,
79 //PLUndockEvent_Type = QEvent::User + DialogEventType + 2;
80 //PLDockEvent_Type = QEvent::User + DialogEventType + 3;
81 SetVideoOnTopEvent_Type = QEvent::User + DialogEventType + 4,
84 class QEvent;
85 class QSignalMapper;
86 class QVLCMenu;
88 class DialogsProvider : public QObject
90 Q_OBJECT
91 friend class QVLCMenu;
93 public:
94 static DialogsProvider *getInstance()
96 assert( instance );
97 return instance;
99 static DialogsProvider *getInstance( intf_thread_t *p_intf )
101 if( !instance )
102 instance = new DialogsProvider( p_intf );
103 return instance;
105 static void killInstance()
107 delete instance;
108 instance = NULL;
110 static bool isAlive()
112 return ( instance != NULL );
115 QStringList showSimpleOpen( const QString& help = QString(),
116 int filters = EXT_FILTER_MEDIA |
117 EXT_FILTER_VIDEO | EXT_FILTER_AUDIO |
118 EXT_FILTER_PLAYLIST,
119 const QString& path = QString() );
120 bool isDying() { return b_isDying; }
121 protected:
122 QSignalMapper *menusMapper;
123 QSignalMapper *menusUpdateMapper;
124 QSignalMapper *SDMapper;
125 void customEvent( QEvent *);
127 private:
128 DialogsProvider( intf_thread_t *);
129 virtual ~DialogsProvider();
130 static DialogsProvider *instance;
132 intf_thread_t *p_intf;
133 QWidget* root;
134 bool b_isDying;
136 void openDialog( int );
137 void addFromSimple( bool, bool );
139 public slots:
140 void playMRL( const QString & );
142 void playlistDialog();
143 void bookmarksDialog();
144 void mediaInfoDialog();
145 void mediaCodecDialog();
146 void prefsDialog();
147 void extendedDialog();
148 void synchroDialog();
149 void messagesDialog();
150 #ifdef ENABLE_VLM
151 void vlmDialog();
152 #endif
153 void helpDialog();
154 #ifdef UPDATE_CHECK
155 void updateDialog();
156 #endif
157 void aboutDialog();
158 void gotoTimeDialog();
159 void podcastConfigureDialog();
160 void toolbarDialog();
161 void pluginDialog();
162 void epgDialog();
164 void openFileGenericDialog( intf_dialog_args_t * );
166 void simpleOpenDialog();
167 void simplePLAppendDialog();
168 void simpleMLAppendDialog();
170 void openDialog();
171 void openDiscDialog();
172 void openFileDialog();
173 void openUrlDialog();
174 void openNetDialog();
175 void openCaptureDialog();
177 void PLAppendDialog( int tab = OPEN_FILE_TAB );
178 void MLAppendDialog( int tab = OPEN_FILE_TAB );
180 void PLOpenDir();
181 void PLAppendDir();
182 void MLAppendDir();
184 void streamingDialog( QWidget *parent, const QString& mrl, bool b_stream = true,
185 QStringList options = QStringList("") );
186 void openAndStreamingDialogs();
187 void openAndTranscodingDialogs();
189 void openAPlaylist();
190 void saveAPlaylist();
192 void loadSubtitlesFile();
194 void quit();
195 private slots:
196 void menuAction( QObject *);
197 void menuUpdateAction( QObject * );
198 void SDMenuAction( const QString& );
199 signals:
200 void toolBarConfUpdated();
203 class DialogEvent : public QEvent
205 public:
206 DialogEvent( int _i_dialog, int _i_arg, intf_dialog_args_t *_p_arg ) :
207 QEvent( (QEvent::Type)(DialogEvent_Type) )
209 i_dialog = _i_dialog;
210 i_arg = _i_arg;
211 p_arg = _p_arg;
213 virtual ~DialogEvent() { }
215 int i_arg, i_dialog;
216 intf_dialog_args_t *p_arg;
220 #endif