Qt: correctly display the right treeView columns
[vlc.git] / modules / gui / qt4 / extensions_manager.hpp
bloba2b38f7cfee9642b2681602d8f10f7f1375f5db8
1 /*****************************************************************************
2 * extensions_manager.hpp: Extensions manager for Qt
3 ****************************************************************************
4 * Copyright (C) 2009-2010 VideoLAN and authors
5 * $Id$
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
27 #ifdef HAVE_CONFIG_H
28 # include "config.h"
29 #endif
31 #include <vlc_extensions.h>
33 #include "qt4.hpp"
35 #include <QObject>
36 #include <QMenu>
37 #include <QSignalMapper>
39 class ExtensionsDialogProvider;
41 class ExtensionsManager : public QObject
43 Q_OBJECT
44 public:
45 static ExtensionsManager *getInstance( intf_thread_t *_p_intf,
46 QObject *_parent = 0 )
48 if( !instance )
49 instance = new ExtensionsManager( _p_intf, _parent );
50 return instance;
52 static void killInstance()
54 delete instance;
55 instance = NULL;
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;
74 public slots:
75 bool loadExtensions();
76 void unloadExtensions();
77 void reloadExtensions();
79 private slots:
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 );
85 private:
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
95 signals:
96 void extensionsUpdated();
99 #endif // EXTENSIONS_MANAGER_HPP