Commit 4878d910 authored by chouquette's avatar chouquette Committed by Ludovic Fauvet

Started module manager and raw Module class

This does nothing unless browsing modules directory.
parent 1aba4a1c
libsample_module.so.1.0.0
\ No newline at end of file
......@@ -5,6 +5,9 @@ vlmc_module_end()
static vlmc_return_type_t Open( void* pv_module )
{
create_p_module( pv_module );
vlmc_add_variable_int( p_module, "test_var", 0 );
return VLMC_SUCCESS;
}
/*****************************************************************************
* Module.cpp: Represents the vlmc's internal representation of a module
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Hugo Beauzee-Luyssen <hugo@vlmc.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.
*****************************************************************************/
#include <QtDebug>
#include "Module.h"
Module::Module( const QString& moduleFileName )
{
qDebug() << "Trying to load module :" << moduleFileName;
}
/*****************************************************************************
* Module.h: Represents the vlmc's internal representation of a module
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Hugo Beauzee-Luyssen <hugo@vlmc.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 MODULE_H
#define MODULE_H
#include <QLibrary>
#include "vlmc_module.h"
class Module
{
public:
Module( const QString& moduleFileName );
private:
QString m_name;
};
#endif // MODULE_H
/*****************************************************************************
* ModuleManager.cpp: Manage modules loading
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Hugo Beauzee-Luyssen <hugo@vlmc.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.
*****************************************************************************/
#include <QtDebug>
#include <QDir>
#include <QStringList>
#include "ModuleManager.h"
ModuleManager::ModuleManager()
{
}
bool ModuleManager::loadModules()
{
QFileInfo moduleDir( "modules/" );
return loadSubDir( moduleDir );
}
bool ModuleManager::loadSubDir( const QFileInfo& dir )
{
if ( dir.exists() == false || dir.isDir() == false )
return false;
QDir subDir( dir.absoluteFilePath() );
if ( subDir.exists() == false )
{
qDebug() << "Modules directory was not found. This is usually a bad thing.";
return false;
}
subDir.setFilter( QDir::Files | QDir::AllDirs | QDir::NoDotAndDotDot );
QStringList nameFilters;
nameFilters << "*.so" << "*.dll" << "*.dynlib";
subDir.setNameFilters( nameFilters );
QFileInfoList results = subDir.entryInfoList();
if ( results.count() == 0 )
return true;
QFileInfoList::const_iterator it = results.begin();
QFileInfoList::const_iterator end = results.end();
while ( it != end )
{
if ( it->isDir() == true )
{
loadSubDir( *it );
}
else
qDebug() << it->fileName();
++it;
}
return true;
}
/*****************************************************************************
* ModuleManager.h: Manage modules loading
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Hugo Beauzee-Luyssen <hugo@vlmc.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 MODULEMANAGER_H
#define MODULEMANAGER_H
#include <QFileInfo>
#include "Module.h"
#include "Singleton.hpp"
class ModuleManager : public Singleton<ModuleManager>
{
public:
bool loadModules();
private:
ModuleManager();
bool loadSubDir( const QFileInfo& dir );
friend class Singleton<ModuleManager>;
};
#endif // MODULEMANAGER_H
......@@ -82,10 +82,22 @@ typedef struct
return VLMC_SUCCESS; \
}
#define vlmc_set_callbacks( open, close ) \
p_module->p_callbacks->pf_open = open; \
p_module->p_callbacks->pf_close = close;
#ifdef __cplusplus
}
#endif
#define create_p_module( void_var ) \
vlmc_module_t* p_module = (vlmc_module_t*) void_var;\
/*
* Function part :
*/
vlmc_return_type_t vlmc_add_variable_int( vlmc_module_t* p_module, const char* psz_varname, int value );
#endif // VLMC_MODULE_H
#include <QtDebug>
#include "vlmc_module.h"
vlmc_return_type_t vlmc_add_variable_int( vlmc_module_t* p_module, const char* psz_varname, int value )
{
qDebug() << "Setting variable";
}
......@@ -29,6 +29,9 @@
#include <QApplication>
#include "gui/MainWindow.h"
//FOR DEBUG :
#include "API/ModuleManager.h"
/**
* VLMC Entry point
* \brief this is the VLMC entry point
......@@ -38,6 +41,9 @@
*/
int main( int argc, char **argv )
{
ModuleManager::getInstance()->loadModules();
return 0;
QApplication app( argc, argv );
app.setApplicationName( "vlmc" );
app.setOrganizationName( "vlmc" );
......
......@@ -41,7 +41,10 @@ SOURCES += src/main.cpp \
src/Workflow/TrackWorkflow.cpp \
src/Workflow/MainWorkflow.cpp \
src/gui/PreviewWidget.cpp \
src/gui/RenderPreviewWidget.cpp
src/gui/RenderPreviewWidget.cpp \
src/API/vlmc_module_variables.cpp \
src/API/Module.cpp \
src/API/ModuleManager.cpp
HEADERS += src/gui/MainWindow.h \
src/gui/DockWidgetManager.h \
src/gui/LibraryWidget.h \
......@@ -78,7 +81,9 @@ HEADERS += src/gui/MainWindow.h \
src/gui/RenderPreviewWidget.h \
src/gui/GenericPreviewWidget.h \
src/tools/Toggleable.hpp \
src/API/vlmc_module.h
src/API/vlmc_module.h \
src/API/Module.h \
src/API/ModuleManager.h
FORMS += src/gui/ui/MainWindow.ui \
src/gui/ui/PreviewWidget.ui \
src/gui/ui/Preferences.ui \
......@@ -98,7 +103,6 @@ INCLUDEPATH += src/LibVLCpp \
src
LIBS = -L/usr/local/lib \
-lvlc
SUBDIRS += modules
SUBDIRS += modules
CODECFORTR = UTF-8
include(locale.pri)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment