/*======================================================================================

	Program:		Range Imaging Toolkit (RITK)
	Module:			ritkPluginCreator.h
	Version:		$Revision: 1817 $
	Date:			$Date: 2011-09-30 16:52:28 +0200 (Fri, 30 Sep 2011) $

	Copyright (c) 2010-2011
	Pattern Recognition Lab, 
    University Erlangen-Nuremberg, Germany
    All rights reserved.

	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 RITKCopyright.txt for more information.

	http://www5.informatik.uni-erlangen.de/research/software/ritk

========================================================================================*/

#ifndef PLUGINCREATOR_H__
#define PLUGINCREATOR_H__

#include <QString>
#include <QDir>
#include <QStringList>

#include "ritkCore.h"



namespace ritk
{

/**	@ingroup	Core
 *	@class		PluginCreator
 *	@author		Sebastian Bauer / Sven Haase
 *	@brief	Class for creating new RITK plugins
 *
 *	@details
 *	Class that provides functionality to create new
 *  RITK plugins (application/filter plugins) based
 *  on template files.
 */
class PluginCreator : public QObject
{
	Q_OBJECT

public:
	/// Constructor
	PluginCreator();
	/// Destructor
	~PluginCreator();

	/** @name	The plugin type */
	//@{
	enum PluginType 
	{
		FilterPlugin, 
		ApplicationPlugin,
		SourcePlugin
	};
	void SetPluginType(PluginType Type, bool isOpenSource);	
	//@}

	/// Set the name
	void SetPluginName(QString PluginName);
	/// Set the description
	void SetPluginDescription(QString Description);
	/// Set libraries to link against
	void SetLibraries(QStringList libraries);
	
	/// Create plugin
	void CreatePlugin(PluginType Type);
	/// Create application plugin
	void CreateApplicationPlugin();
	/// Create filter plugin
	void CreateFilterPlugin();
	/// Create source plugin
	void CreateSourcePlugin();

public:
	/// Set parent source directory of the RITK plugins
	void SetRITKDirectory();

protected:
	/// Create plugin file by modifying a template file
	void CreateFileFromTemplate(QString InFilename, QString OutFilename);
	/// Create plugin file by modifying a cmake file
	void CreateCMakeFileFromTemplate();
	/// Add the subdirectory to the parent CMakeLists
	void PropagateNewPlugin();

	/// Parent directory of the RITK plugins
	QString m_RITKPluginDirectory;
	/// RITK directory
	QString m_RITKDirectory;
	/// Parent directory of the RITK plugin template files
	QDir m_RITKPluginTemplatesDirectory;

	/// Plugin type
	PluginType m_PluginType;
	/// Distribution type
	bool m_IsOpenSource;
	/// Plugin name
	QString m_PluginName;
	/// Plugin description
	QString m_PluginDescription;
	/// Plugin directory
	QDir m_PluginDirectory;
	/// List of libraries to link against
	QStringList m_Libraries;

};


} // end namespace ritk

#endif // PLUGINCREATOR_H__