/***************************************************************************
 *   Copyright (C) 2008 by Andreas Silberstorff   *
 *   taki@Rivendell   *
 *                                                                         *
 *   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.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef PLUGINSETTINGSPAGE_H
#define PLUGINSETTINGSPAGE_H
#include <libkalva_export.h>

#include "lib/pluginsystem/pluginfactory.h"

#include <QtGui/QWidget>
#include <QIcon>

class QLabel;
class QTreeWidget;
class QTreeWidgetItem;
class KConfigDialog;

namespace KalvaPluginSystem {

/**
 * Configuration page for activating and deactivating plugins.
 *
 * @todo store the enabled-state for the plugins and load the settings on startup
 * @short PluginSettingsPage
 * @author Andreas Silberstorff <ml@andreas-silberstorff.de>
 * @version 1.0.91
 */
class KALVALIB_EXPORT PluginSettingsPage : public QWidget
{
    Q_OBJECT
public:
	PluginSettingsPage( KConfigDialog * );

	~PluginSettingsPage();

private:

	// Ressources
	QIcon m_interfaceIcon;
	QIcon m_featureIcon;
	QString m_toolTip;

	// to be passed to plugins for adding config pages
	KConfigDialog *m_dialog;

	// own widgets
	QLabel *m_label;
	QTreeWidget *m_treeWidget;
	QTreeWidgetItem *m_perspectivesItem;
	QTreeWidgetItem *m_devicesItem;
	QTreeWidgetItem *m_schedulersItem;
	QTreeWidgetItem *m_channellistprovidersItem;

	void findPlugins();
	void populateTreeWidget( PluginFactory* factory, QTreeWidgetItem* item, int factoryID );

private slots:
	void createWidgets();
	void layoutWidgets();
	void setupIcons();
	void itemDoubleClicked ( QTreeWidgetItem * item, int column );

};

}

#endif // PLUGINSETTINGSPAGE_H
