1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
/*****************************************************************************
* extensions_manager.hpp: Extensions manager for Qt
****************************************************************************
* Copyright (C) 2009-2010 VideoLAN and authors
* $Id: 729c9378387359e6963e3dd8b1167134d73b6fee $
*
* Authors: Jean-Philippe André < jpeg # videolan.org >
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef EXTENSIONS_MANAGER_HPP
#define EXTENSIONS_MANAGER_HPP
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_extensions.h>
#include "qt4.hpp"
#include <QObject>
#include <QMenu>
#include <QSignalMapper>
class ExtensionsDialogProvider;
class ExtensionsManager : public QObject
{
Q_OBJECT
public:
static ExtensionsManager *getInstance( intf_thread_t *_p_intf,
QObject *_parent = 0 )
{
if( !instance )
instance = new ExtensionsManager( _p_intf, _parent );
return instance;
}
static void killInstance()
{
delete instance;
instance = NULL;
}
ExtensionsManager( intf_thread_t *p_intf, QObject *parent );
virtual ~ExtensionsManager();
inline bool isLoaded() { return p_extensions_manager != NULL; }
inline bool cannotLoad() { return b_unloading || b_failed; }
inline bool isUnloading() { return b_unloading; }
void menu( QMenu *current );
/** Get the extensions_manager_t if it is loaded and hold the object */
extensions_manager_t* getManager()
{
if( !p_extensions_manager ) return NULL;
vlc_object_hold( p_extensions_manager );
return p_extensions_manager;
}
public slots:
bool loadExtensions();
void unloadExtensions();
void reloadExtensions();
private slots:
void triggerMenu( int id );
void inputChanged( );
void playingChanged( int );
void metaChanged( input_item_t *p_input );
private:
static ExtensionsManager* instance;
intf_thread_t *p_intf;
extensions_manager_t *p_extensions_manager;
ExtensionsDialogProvider *p_edp;
QSignalMapper *menuMapper;
bool b_unloading; ///< Work around threads + emit issues, see isUnloading
bool b_failed; ///< Flag set to true if we could not load the module
signals:
void extensionsUpdated();
};
#endif // EXTENSIONS_MANAGER_HPP
|