#ifndef SETTINGS_H
#define SETTINGS_H

#include <map>
#include <QtGui>

#include "qobject.h"
#include "qsound.h"
#include "qpushbutton.h"
#include "softProj\clientServer\threads.h"

class Settings : public QObject 
{
	Q_OBJECT

private:
	static Settings * instance_;
	static threads::mutex * lock_;

	std::map<std::string, QString> styles_;
	std::map<std::string, std::wstring> gameNames_;
	std::map<std::string, QIcon> gameIcons_;

	QString emptyStyle_;
	std::wstring emptyGameName_;
	QIcon emptyIcon_;

	Settings();
	Settings(Settings & other) {};
	~Settings();

	void createStyles();
	void createGameNames();
	void createGameIcons();
public:
	
	static Settings & instance();

	void connectSound(QPushButton * button);
	void connectStyle(QWidget * widget, const std::string & key);
	const QString & getStyle(const std::string & key);
	const std::wstring & getGameName(const std::string & key);
	QString getGameNameQString(const std::string & key);
	QString formatNumber(const unsigned long long & number);
	QString formatNumber(const unsigned long & number);
	QString formatNumber(const long long & number);
	QString formatNumber(const long & number);
	QString formatNumber(const unsigned int & number);
	QString formatNumber(const int & number);
	QString formatNumber(const long double & number);
	QString formatNumber(const double & number);
	const QIcon & getGameIcon(const std::string & key);
public slots:
	void playSoundSlot();
};

#define STYLE_AVAILABLE_DEVICE_BUTTON				"STYLE_AVAILABLE_DEVICE_BUTTON"
#define STYLE_UNAVAILABLE_DEVICE_BUTTON				"STYLE_UNAVAILABLE_DEVICE_BUTTON"
#define STYLE_AVAILABLE_DEVICE_SMALL_BUTTON			"STYLE_AVAILABLE_DEVICE_SMALL_BUTTON"
#define STYLE_UNAVAILABLE_DEVICE_SMALL_BUTTON		"STYLE_UNAVAILABLE_DEVICE_SMALL_BUTTON"
#define STYLE_AVAILABLE_DEVICE_DAMAGE_LABEL			"STYLE_AVAILABLE_DEVICE_DAMAGE_LABEL"
#define STYLE_UNAVAILABLE_DEVICE_DAMAGE_LABEL		"STYLE_UNAVAILABLE_DEVICE_DAMAGE_LABEL"

#define GAME_ICON_ACCOMMODATIONS					"GAME_ICON_ACCOMMODATIONS"
#define GAME_ICON_WAIT								"GAME_ICON_WAIT"
#define GAME_ICON_INVITATION						"GAME_ICON_INVITATION"
#define GAME_ICON_SUCCESS							"GAME_ICON_SUCCESS"
#define GAME_ICON_FAILURE							"GAME_ICON_FAILURE"
#define GAME_ICON_BASE								"GAME_ICON_BASE"
#define GAME_ICON_CONQUER							"GAME_ICON_CONQUER"
#define GAME_ICON_DEVICE_DITRIBUTION				"GAME_ICON_DEVICE_DITRIBUTION"
#define GAME_ICON_WEAPONS							"GAME_ICON_WEAPONS"
#define GAME_ICON_CREW								"GAME_ICON_CREW"
#define GAME_ICON_EQUIPMENT							"GAME_ICON_EQUIPMENT"
#define GAME_ICON_FACTORIES							"GAME_ICON_FACTORIES"
#define GAME_ICON_WAREHOUSES						"GAME_ICON_WAREHOUSES"
#define GAME_ICON_ANDROIDS							"GAME_ICON_ANDROIDS"
#define GAME_ICON_IMPULS_DRIVE						"GAME_ICON_IMPULS_DRIVE"
#define GAME_ICON_SUBSPACE_DRIVE					"GAME_ICON_SUBSPACE_DRIVE"
#define GAME_ICON_SHIP								"GAME_ICON_SHIP"
#define GAME_ICON_QUARRYING							"GAME_ICON_QUARRYING"
#define GAME_ICON_TRADE								"GAME_ICON_TRADE"
#define GAME_ICON_HANGARS							"GAME_ICON_HANGARS"
#define GAME_ICON_SHIELDS							"GAME_ICON_SHIELDS"
#define GAME_ICON_CENTRAL_INFORMATION				"GAME_ICON_CENTRAL_INFORMATION"
#define GAME_ICON_MAINFRAME							"GAME_ICON_MAINFRAME"
#define GAME_ICON_CLOAKING							"GAME_ICON_CLOAKING"
#define GAME_ICON_SENSORS							"GAME_ICON_SENSORS"
#define GAME_ICON_PROBE								"GAME_ICON_PROBE"

namespace Constants {
	const QColor ACTUAL_ROW_COLOR = QColor::fromRgb(75, 120, 175, 150);
	const QColor TARGET_ROW_COLOR = QColor::fromRgb(110, 155, 80, 150);
	const QColor SYSTEM_ROW_COLOR = QColor::fromRgb(255, 255, 125, 150);

	const QColor SEPARATE_ROW_COLOR = QColor::fromRgb(75, 120, 175, 150);
	const QColor STACKABLE_ROW_COLOR = QColor::fromRgb(110, 155, 80, 150);
	const QColor RESOURCE_ROW_COLOR = QColor::fromRgb(255, 255, 125, 150);
};

#endif