#ifndef __SIMGRID_TEMPLATES_H
#define __SIMGRID_TEMPLATES_H

#include <qstring.h>
#include <qcombobox.h>


class SimulationTemplates {
public:
	SimulationTemplates();
	
	/**
	Add a template entry.<br>
	Returns: new template entry.
	*/
	QString add(const QString &name, const QString &scriptFile);

	void remove(const QString &tempEntry);

	int count();

	/**
	Get the specified template.
	*/
	bool get(const QString &tempEntry, QString &tempName, QString &tempScript);
	
	/**
	Get template name.
	*/
	QString name(const QString &tempEntry);
	
	/**
	Get template script file.
	*/
	QString scriptFile(const QString &tempEntry);

	bool customPrefs(const QString &tempEntry);
	void setCustomPrefs(const QString &tempEntry, bool custom);

	bool showSimulationProgressOutputWindow(const QString &tempEntry);
	void setShowSimulationProgressOutputWindow(const QString &tempEntry, bool show);

	bool showSimulationProgressNetwork(const QString &tempEntry);
	void setShowSimulationProgressNetwork(const QString &tempEntry, bool show);

	bool changeNodeColor(const QString &tempEntry);
	void setChangeNodeColor(const QString &tempEntry, bool change);

	bool showCustomSimulationProgress(const QString &tempEntry);
	void setShowCustomSimulationProgress(const QString &tempEntry, bool show);

	bool showSimulationOutput(const QString &tempEntry);
	void setShowSimulationOutput(const QString &tempEntry, bool show);

	bool showSimulationErrors(const QString &tempEntry);
	void setShowSimulationErrors(const QString &tempEntry, bool show);

	bool debugMode(const QString &tempEntry);
	void setDebugMode(const QString &tempEntry, bool mode);

	/**
	Set values of the specified template.<br>
	Returns: false if the entry is not found.
	*/
	bool set(const QString &tempEntry, const QString &tempName, const QString &tempScript);

	/**
	Get first / next template entry.
	*/
	bool next(QString &tempEntry, QString &tempName, QString &tempScript);
	
	/**
	Reset iterator.
	*/
	void reset() { _lastEntry = -1; }

	/**
	Fill combo with valid templates and set the template entry as user data of each item.<br>
	Returns: the number of templates inserted.
	*/
	int fill(QComboBox *combo, const QString &currTempEntry = QString());

	QString lastDeployFile(const QString &tempEntry);
	void setLastDeployFile(const QString &tempEntry, const QString &deployFile);

	void setLastTemplateDir(const QString &dir);
	QString lastTemplateDir();
	
	void setLastDeployDir(const QString &dir);
	QString lastDeployDir();

	void setLastTemplateRun(const QString &tempEntry);
	QString lastTemplateRun();
	
private:
	int _lastEntry;
};

#endif // __SIMGRID_TEMPLATES_H
