1 /*****************************************************************************
2 * extensions_manager.hpp: Extensions manager for Qt
3 ****************************************************************************
4 * Copyright (C) 2009-2010 VideoLAN and authors
7 * Authors: Jean-Philippe André < jpeg # 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 EXTENSIONS_MANAGER_HPP
25 #define EXTENSIONS_MANAGER_HPP
31 #include <vlc_extensions.h>
37 #include <QSignalMapper>
39 class ExtensionsDialogProvider
;
41 class ExtensionsManager
: public QObject
45 static ExtensionsManager
*getInstance( intf_thread_t
*_p_intf
,
46 QObject
*_parent
= 0 )
49 instance
= new ExtensionsManager( _p_intf
, _parent
);
52 static void killInstance()
58 ExtensionsManager( intf_thread_t
*p_intf
, QObject
*parent
);
59 virtual ~ExtensionsManager();
61 inline bool isLoaded() { return p_extensions_manager
!= NULL
; }
62 inline bool cannotLoad() { return b_unloading
|| b_failed
; }
63 inline bool isUnloading() { return b_unloading
; }
64 void menu( QMenu
*current
);
66 /** Get the extensions_manager_t if it is loaded and hold the object */
67 extensions_manager_t
* getManager()
69 if( !p_extensions_manager
) return NULL
;
70 vlc_object_hold( p_extensions_manager
);
71 return p_extensions_manager
;
75 bool loadExtensions();
76 void unloadExtensions();
77 void reloadExtensions();
80 void triggerMenu( int id
);
81 void inputChanged( input_thread_t
*p_input
);
82 void playingChanged( int );
83 void metaChanged( input_item_t
*p_input
);
86 static ExtensionsManager
* instance
;
87 intf_thread_t
*p_intf
;
88 extensions_manager_t
*p_extensions_manager
;
89 ExtensionsDialogProvider
*p_edp
;
91 QSignalMapper
*menuMapper
;
92 bool b_unloading
; ///< Work around threads + emit issues, see isUnloading
93 bool b_failed
; ///< Flag set to true if we could not load the module
96 void extensionsUpdated();
99 #endif // EXTENSIONS_MANAGER_HPP