#ifndef QSETTINGS_H
#define QSETTINGS_H

#include <iostream>
#include <fstream>
#include <vector>
#include <stdlib.h>
#if QT_VERSION < 0x040000
#include <qstring.h>
#else
#include <QString>
#endif

#ifndef WINDOWS
#define DEFAULT_FONT_SIZE 13
#else
#define DEFAULT_FONT_SIZE 11
#endif

QString addTokens(const QString& in);
QString removeTokens(const QString& in);

class QProfile
{
	public:
		QProfile(QString name="Default");
		
		QProfile(QProfile* p);
		
		QString getName(){return name;}
		
		void setName(const QString& name) {this->name=name;}
		
		// Paths Settings
		
		QString SaveRestorePath;
		QString UserLibPath;
		QString ConfigPath;
		QString FilterBankPath;
		
		//Plot Settings
		
		QString Vector3D;
		QString Array3D;
		QString Array3DtoScalar;
		QString Array3DXY;
		QString Array3DtoScalarXY;
		QString PageSize;
		QString PageOrientation;
		int PageDPI;
		double PageWidth; // inches
		double PageHeight; // inches
		QString TimeRep;
		bool UseKPrinter;
		
		QString SansFont;
		QString SerifFont;
		QString MonotypeFont;
		QString DecorativeFont;
		
		bool VectoriseSVGFonts;
		
		QString ColourTable;
		
		double LineWidth;
		double BaseFontSize;

        double gapTolerance;
		
		// UI
		
		int Height;
		int QpuiHeight;
		int QpuiWidth;
		int fontSize;
		int GUImargins;
		int timeIntervalButton; //0: both, 1: right click only
		
		// MISC
		
		bool Debug;
		bool QrtnDebug;
		
	protected:
		
		QString name;
};

class QProfilesList
{
	public:
		QProfilesList();
		
		~QProfilesList();
		
		bool load();
		bool save();
		QProfile * current();
		QProfile * fromName(const QString& name);
		bool setCurrent(const QString& name);
		void names(std::vector<QString>& names);
		bool add(QProfile * prof);
// 		bool change(QProfile * prof);
		bool remove(const QString& name);
		void newCustom(QProfile * p);
// 		bool deleteProfile(int id);
// 		bool changeProfile(QProfile* p, int id);
// 		bool setCurrentProfile(const QString& name);
// 		QProfile* getProfile(int id, bool& isDefault);
// 		QProfile* getProfile(const QString& name, bool& isDefault);
// 		
// 		void diag();
// 		
// 		std::vector<QProfile*> presets;
// 		int currentId;
		
	protected:
		std::vector<QProfile*> presets;
		QString currentName;
		QProfile * customProfile;
		QProfile * defaultProfile;
};

extern QProfilesList * QSAS_profiles;

#endif
