#ifndef APPLICATIONCONFIGURATOR_H
#define APPLICATIONCONFIGURATOR_H

#include <QtCore/qglobal.h>
#include <QString>
#include <QSettings>

class ApplicationConfigurator
{
public:
    ApplicationConfigurator();
    virtual ~ApplicationConfigurator();

    void init();
    void save();

    QString getDbName() const { return dbName; };
    void setDbName(const QString &value) { dbName = value; };

	quint16 getDbPort() const { return dbPort; };
	void setDbPort(const quint16 value) { dbPort = value; };

    QString getDbHostName() const { return dbHostName; };
    void setDbHostName(const QString &value) { dbHostName = value; };

    QString getDbUserName() const { return dbUserName; };
    void setDbUserName(const QString &value) { dbUserName = value; };

    QString getDbPassword() const { return dbPassword; };
    void setDbPassword(const QString &value) { dbPassword = value; };

	quint32 getAirportCount() const { return airportCount; };
	void setAirportCount(const quint32 &value) { airportCount = value; };

	quint32 getTrackLineCount() const { return trackLineCount; };
	void setTrackLineCount(const quint32 &value) { trackLineCount = value; };

	quint32 getTurnPointCount() const { return turnPointCount; };
	void setTurnPointCount(const quint32 &value) { turnPointCount = value; };

	double getAlpha() const { return alpha; };
	void setAlpha(const double value) { alpha = value; };

	int getDisPercent() const { return disPercent; };
	void setDisPercent(const int value) { disPercent = value; };

	quint32 getInsertCount() const { return insertCount; };
	void setInsertCount(const quint32 value) { insertCount = value; };

	double getAlt() const { return alt; };
	void setAlt(const double value) { alt = value; };

	double getSpeed() const { return speed; };
	void setSpeed(const double value) { speed = value; };

	QString getDictTable(const QString &name) const { 
		if (dicts.contains(name)){
			return dicts[name];
		}

		return "";
	};

private:
	void loadDictTables();

private:
    QString dbName;
	quint16 dbPort;
    QString dbHostName;
    QString dbUserName;
    QString dbPassword;

	quint32 airportCount;
	quint32 trackLineCount;
	quint32 turnPointCount;
	double alpha;
	int disPercent;
	quint32 insertCount;
	double alt;
	double speed;


	QString dictCounty;

private:
    QSettings *iniSettings;
	QHash < QString, QString > dicts;
};

#endif // APPLICATIONCONFIGURATOR_H
