/***************************************************************************
 *   Copyright (C) 2008 by Andreas Silberstorff   *
 *   ml@andreas-silberstorff.de   *
 *                                                                         *
 *   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 tvperspective_H
#define tvperspective_H

#include <Widgets/KalvaChannellist>
#include <Widgets/KalvaVideoPlayer>
#include <Widgets/KalvaRecorder>
#include <PluginInterface>
#include <PerspectiveInterface>
#include <PluginFactory>
#include <DeviceInterface>

#include <QtCore/QObject>
#include <KProcess>

class QWidget;
class QTabWidget;
class QString;
class QLineEdit;
class KConfigDialog;

namespace TvPerspective {

/**
 * This is the TV perspective for kalva2.
 * It provides a channellist as manager part
 * and a video player and a recorder as main view
 *
 * @short TV perspective
 * @author Andreas Silberstorff <ml@andreas-silberstorff.de>
 * @version 1.91
 */

class Plugin
 : public QObject,
   public KalvaPlugin::PluginInterface,
   public KalvaPlugin::PerspectiveInterface
{
	Q_OBJECT
	Q_INTERFACES( KalvaPlugin::PluginInterface KalvaPlugin::PerspectiveInterface )
public:
	/**
	 * Default constructor
	 */
	Plugin();

	/**
	 * Destructor
	 */
	virtual ~Plugin();

	QString title();
	QString toolTip();
	QString whatsThis();
	QWidget* createManager( QWidget *parent );
	QWidget* createMainView( QWidget *parent );
	void settingsChanged();
	void addToConfigDialog( KConfigDialog *dialog );
	void removeFromConfigDialog( KConfigDialog *dialog );

private:
	KalvaWidget::KalvaChannellist *m_channellist;
	KalvaWidget::KalvaVideoPlayer *m_videoplayer;
	KalvaWidget::KalvaRecorder *m_recorder;
	KalvaPlugin::DeviceInterface *m_device;
	
	QLineEdit* m_stationEntry;
	QLineEdit* m_channelEntry;
	QLineEdit* m_frequenceEntry;
	KProcess* playProcess;

	void setupConnections();
	void createVideoPlayer(QTabWidget *parent);
	void createRecorder(QTabWidget *parent);

private slots:
	void setChannel(KalvaData::Channel* channel);
	void record();
	void play();
	void pause();
	void stop();
  
};

}

#endif // collectionperspective_H
