gui: qt: use float for rate
[vlc.git] / modules / gui / qt / dialogs_provider.hpp
blobc234a1b32a37e51d6deadb230bb11cb8df07cd52
1 /*****************************************************************************
2 * dialogs_provider.hpp : Dialogs provider
3 ****************************************************************************
4 * Copyright (C) 2006-2008 the VideoLAN team
6 * Authors: Clément Stenac <zorglub@videolan.org>
7 * Jean-Baptiste Kempf <jb@videolan.org>
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.
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.
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 *****************************************************************************/
24 #ifndef QVLC_DIALOGS_PROVIDER_H_
25 #define QVLC_DIALOGS_PROVIDER_H_
27 #ifdef HAVE_CONFIG_H
28 # include "config.h"
29 #endif
31 #include <assert.h>
33 #include "qt.hpp"
35 #include "dialogs/open.hpp"
36 #include <QObject>
37 #include <QStringList>
39 #define TITLE_EXTENSIONS_MEDIA qtr( "Media Files" )
40 #define TITLE_EXTENSIONS_VIDEO qtr( "Video Files" )
41 #define TITLE_EXTENSIONS_AUDIO qtr( "Audio Files" )
42 #define TITLE_EXTENSIONS_PLAYLIST qtr( "Playlist Files" )
43 #define TITLE_EXTENSIONS_SUBTITLE qtr( "Subtitle Files" )
44 #define TITLE_EXTENSIONS_ALL qtr( "All Files" )
45 #define EXTENSIONS_ALL "*"
46 #define ADD_EXT_FILTER( string, type ) \
47 string = string + QString("%1 ( %2 );;") \
48 .arg( TITLE_##type ) \
49 .arg( QString( type ) );
51 enum {
52 EXT_FILTER_MEDIA = 0x01,
53 EXT_FILTER_VIDEO = 0x02,
54 EXT_FILTER_AUDIO = 0x04,
55 EXT_FILTER_PLAYLIST = 0x08,
56 EXT_FILTER_SUBTITLE = 0x10,
59 class QEvent;
60 class QSignalMapper;
61 class VLCMenuBar;
63 class DialogsProvider : public QObject
65 Q_OBJECT
66 friend class VLCMenuBar;
68 public:
69 static DialogsProvider *getInstance()
71 assert( instance );
72 return instance;
74 static DialogsProvider *getInstance( intf_thread_t *p_intf )
76 if( !instance )
77 instance = new DialogsProvider( p_intf );
78 return instance;
80 static void killInstance()
82 delete instance;
83 instance = NULL;
86 QStringList showSimpleOpen( const QString& help = QString(),
87 int filters = EXT_FILTER_MEDIA |
88 EXT_FILTER_VIDEO | EXT_FILTER_AUDIO |
89 EXT_FILTER_PLAYLIST,
90 const QUrl& path = QUrl() );
91 bool isDying() { return b_isDying; }
92 static QString getDirectoryDialog( intf_thread_t *p_intf);
94 static QString getSaveFileName(QWidget *parent = NULL,
95 const QString &caption = QString(),
96 const QUrl &dir = QUrl(),
97 const QString &filter = QString(),
98 QString *selectedFilter = NULL );
100 protected:
101 QSignalMapper *menusMapper;
102 QSignalMapper *menusUpdateMapper;
103 void customEvent( QEvent *);
105 private:
106 DialogsProvider( intf_thread_t *);
107 virtual ~DialogsProvider();
108 static DialogsProvider *instance;
110 intf_thread_t *p_intf;
112 QMenu* popupMenu;
113 QMenu* videoPopupMenu;
114 QMenu* audioPopupMenu;
115 QMenu* miscPopupMenu;
117 QWidget* root;
118 bool b_isDying;
120 void openDialog( int );
122 public slots:
123 void playlistDialog();
124 void bookmarksDialog();
125 void mediaInfoDialog();
126 void mediaCodecDialog();
127 void prefsDialog();
128 void extendedDialog();
129 void synchroDialog();
130 void messagesDialog();
131 void sendKey( int key );
132 #ifdef ENABLE_VLM
133 void vlmDialog();
134 #endif
135 void helpDialog();
136 #ifdef UPDATE_CHECK
137 void updateDialog();
138 #endif
139 void aboutDialog();
140 void gotoTimeDialog();
141 void podcastConfigureDialog();
142 void toolbarDialog();
143 void pluginDialog();
144 void epgDialog();
145 void setPopupMenu();
146 void destroyPopupMenu();
148 void openFileGenericDialog( intf_dialog_args_t * );
150 void simpleOpenDialog();
152 void openDialog();
153 void openDiscDialog();
154 void openFileDialog();
155 void openUrlDialog();
156 void openNetDialog();
157 void openCaptureDialog();
159 void PLAppendDialog( int tab = OPEN_FILE_TAB );
161 void PLOpenDir();
162 void PLAppendDir();
164 void streamingDialog( QWidget *parent, const QStringList& mrls, bool b_stream = true,
165 QStringList options = QStringList("") );
166 void openAndStreamingDialogs();
167 void openAndTranscodingDialogs();
169 void openAPlaylist();
170 void savePlayingToPlaylist();
172 void loadSubtitlesFile();
174 void quit();
175 private slots:
176 void menuAction( QObject *);
177 void menuUpdateAction( QObject * );
178 signals:
179 void toolBarConfUpdated();
180 void releaseMouseEvents();
183 class DialogEvent : public QEvent
185 public:
186 static const QEvent::Type DialogEvent_Type;
187 DialogEvent( int _i_dialog, int _i_arg, intf_dialog_args_t *_p_arg ) :
188 QEvent( DialogEvent_Type )
190 i_dialog = _i_dialog;
191 i_arg = _i_arg;
192 p_arg = _p_arg;
195 int i_arg, i_dialog;
196 intf_dialog_args_t *p_arg;
200 #endif