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

	Program:		Range Imaging Toolkit (RITK)
	Module:			ritkPluginManagerDialog.h
	Version:		$Revision: 1761 $
	Date:			$Date: 2011-09-23 17:25:41 +0200 (Fri, 23 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 PLUGINMANAGERDIALOG_H__
#define PLUGINMANAGERDIALOG_H__

#include <QDialog>
#include "ui_ritkPluginManagerDialog.h"

#include <QLabel>
#include <QTreeWidget>

#include "ritkPluginManager.h"

namespace ritk
{


/**	@ingroup	Core
 *	@class		PluginManagerDialog
 *	@author		Jakob Wasza
 *	@brief		GUI for the plugin manager
 *
 *	@details
 *	This class provides a GUI for the plugin manager. In particular
 *	this includes elements to start or stop plugins.
 */
class PluginManagerDialog : public QDialog, public Ui_PluginManagerDialog
{
	Q_OBJECT

public:
	/// Constructor
    PluginManagerDialog(QWidget *parent=0);
	/// Destructor
	~PluginManagerDialog();

	/// Populate plugin information
	void PopulatePluginInformation(QString PluginDir,  QList<PluginManager::PluginStruct> *Plugins);

signals:
	/// Emitted when the user wants to start a plugin
	void StartPlugin(PluginManager::PluginStruct&);
	/// Emitted when the user wants to stop a plugin
	void StopPlugin(PluginManager::PluginStruct&);

public slots:
	/// Should be called if the status of a plugin chages
	void PluginStatusChanged(PluginManager::PluginStruct&);


protected slots:
	/// Called when the selected item changes
	void SelectionChanged();
	/// Called when the current item changes
	void CurrentItemChanged(QTreeWidgetItem  *current, QTreeWidgetItem  *previous);
	/// Connected to the start button
	void StartButtonPressed();
	/// Connected to the stop button
	void StopButtonPressed();
	/// Called when a double click is performed on an item
	void DoubleClicked(QTreeWidgetItem*, int);

protected:
	/// Update the plugin tree
	void UpdatePluginTree();

protected:
	/// The current plugin directory
	QString m_PluginDir;
	/// The list with plugins
	QList<PluginManager::PluginStruct> *m_PluginList;
};

} // end namespace ritk

#endif // PLUGINMANAGERDIALOG_H__
