/***************************************************************************
 *   Copyright (C) 2010 by Volker Lanz <vl@fidra.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.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
 ***************************************************************************/

#if !defined(EXPORTER__H)

#define EXPORTER__H

#include "core/types.h"

#include "veneer/url.h"

#include <QThread>
#include <QString>

class QString;
class QStringList;
class QFile;

class Exporter : public QThread
{
	Q_OBJECT

	public:
		enum ExportStatus
		{
			Unknown = 0,
			Success = 1,
			Error = 2
		};

	public:
		Exporter(const Veneer::Url& targetUrl_, QFile* file_, const Activities& activities);
		~Exporter();

	signals:
		void totalSteps(int i);
		void progress(int i);

	public:
		QFile& file() { return *m_File; }
		const Veneer::Url& targetUrl() const { return m_TargetUrl; }
		ExportStatus status() const { return m_Status; }

		static QStringList supportedFileFormats();

	protected:
		virtual void run();

	private:
		const Veneer::Url m_TargetUrl;
		QFile* m_File;
		const Activities m_Activities;
		ExporterInterfaces m_Exporters;
		ExportStatus m_Status;
};

#endif
