/***************************************************************************
 *   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 KALVASCRIPTCOMMAND_H
#define KALVASCRIPTCOMMAND_H

#include "libkalva_export.h"

#include <QVariant>
#include <QString>

class KProcess;

namespace KalvaData {

/**
 * This class describes the interface for recording commands.
 * @short KalvaScriptCommand
 * @author Andreas Silberstorff <ml@andreas-silberstorff.de>
 * @version 1.0.91
 */

class KALVALIB_EXPORT KalvaScriptCommand
 : public QObject
{
Q_OBJECT

public:
	KalvaScriptCommand();
	virtual ~KalvaScriptCommand() {};

	inline bool operator==(const KalvaScriptCommand &other) const {
		return (m_script == other.m_script);
	}

	inline bool operator!=(const KalvaScriptCommand &other) const {
		return (m_script != other.m_script);
	}

	/**
	 * For a scriptdriven command overload this and
	 * return a command string.
	 * If you do not want to provide a script
	 * you have to overload void test() and KProcess* run()
	 * instead.
	 */
	virtual QString script();

	/**
	 * callback function
	 *
	 * For a scriptdriven command overload QString script() above.
	 * If you do not want to provide a script
	 * you have to overload this and KProcess* run() below.
	 */
	virtual bool test();

	/**
	 * callback function
	 *
	 * For a scriptdriven command overload QString script() above.
	 * If you do not want to provide a script
	 * you have to overload void test() above and this.
	 */
	virtual KProcess* run();

	/**
	 * overwrite this to put out a url for accessing the video stream
	 */
	virtual QString url() = 0;

private:
	QString m_script;
};

}
Q_DECLARE_METATYPE(KalvaData::KalvaScriptCommand*)

#endif
