#include "settings.h"
#include "softProj\clientServer\threads.h"
#include "softProj\clientServer\structs.h"

threads::mutex * Settings::lock_ = new threads::mutex();
Settings * Settings::instance_ = NULL;

Settings::Settings() 
{	
	createStyles();
	createGameNames();
	createGameIcons();
}

Settings::~Settings()
{
}

Settings & Settings::instance() 
{
	if (instance_ == NULL)
	{
		lock_->lock();

		if (instance_ == NULL) 
		{
			instance_ = new Settings();
		}

		lock_->unlock();
	}

	return *instance_;
}

void Settings::playSoundSlot() 
{
	QSound::play("../sounds/button.wav");
}

void Settings::connectSound(QPushButton * button) 
{
	//QObject::connect(
	//	button,  SIGNAL(clicked()),
	//	this, SLOT(playSoundSlot())
	//	);
}

void Settings::connectStyle(QWidget * widget, const std::string & key) {
	widget->setStyleSheet(getStyle(key));
}

void Settings::createStyles() {

	emptyStyle_ = "";

	/* Style for name button of device that is available, like in factories widget */

	QString availableButtonStyle = 
		"QPushButton {"
			"background-color: rgb(48, 66, 35, 230);"
			"padding: 5px;"
			"color: #ffffff;"
			"font-weight: bold;"
			"border: none;"
			"text-align: center;"
		"}";

	styles_.insert(std::make_pair(STYLE_AVAILABLE_DEVICE_BUTTON, availableButtonStyle));

	QString availableSmallButtonStyle = 
		"QPushButton {"
			"background-color: rgb(48, 66, 35, 230);"
			"color: #ffffff;"
			"font-weight: normal;"
			"border: none;"
			"text-align: center;"
			"font-size: 10px;"
		"}";

	styles_.insert(std::make_pair(STYLE_AVAILABLE_DEVICE_SMALL_BUTTON, availableSmallButtonStyle));

	/* Style for name button of device that is unavailable, like in factories widget */

	QString unavailableButtonStyle = 
		"QPushButton {"
			"background-color: rgb(50, 50, 50);"
			"padding: 5px;"
			"color: #ffffff;"
			"border: none;"
			"font-weight: bold;"
		"}";

	styles_.insert(std::make_pair(STYLE_UNAVAILABLE_DEVICE_BUTTON, unavailableButtonStyle));

	QString unavailableSmallButtonStyle = 
		"QPushButton {"
			"background-color: rgb(50, 50, 50);"
			"color: #ffffff;"
			"border: none;"
			"font-weight: normal;"
			"font-size: 10px;"
		"}";

	styles_.insert(std::make_pair(STYLE_UNAVAILABLE_DEVICE_SMALL_BUTTON, unavailableSmallButtonStyle));

	/* Style for damage label of device that is available, like in factories widget */

	QString availableDamageStyle = 
		"QLabel  {"
			"background-color: rgb(35, 35, 35, 140);"
			"color: rgb(75, 120, 175);"
			"padding: 5px;"
			"font-weight: bold;"
		"}";

	styles_.insert(std::make_pair(STYLE_AVAILABLE_DEVICE_DAMAGE_LABEL, availableDamageStyle));

	/* Style for damage label of device that is unavailable, like in factories widget */

	QString unavailableDamageStyle = 
		"QLabel  {"
			"background-color: rgb(35, 35, 35, 140);"
			"color: rgb(170, 45, 44);"
			"padding: 5px;"
			"font-weight: bold;"
		"}";

	styles_.insert(std::make_pair(STYLE_UNAVAILABLE_DEVICE_DAMAGE_LABEL, unavailableDamageStyle));
}

void Settings::createGameNames() {

	emptyGameName_ = L"";

	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_ANDROIDS, L"Androidi"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_CLOAKING_DEVICE, L"Maskovací zařízení"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_DEFLECTOR_SHIELDS, L"Deflektor štítů"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_DEUTERIUM_DECOMPOSER, L"Rozkladač deuteria"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_DRONE_MISSILES, L"Dronní střela"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_DRONE_MISSILE_LAUNCHER, L"Torpédomet"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_ENERGETIC_ACCUMULATOR, L"Energetický akumulátor"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_ENERGETIC_CELL, L"Energetický článek"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_HANGAR, L"Hangár"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_HIGH_RESOLUTION_SENSORS, L"Citlivé senzory"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_ILMENITE_FURNACE, L"Ilmenitová pec"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_IMPULS_JET_ENGINE, L"Engine impulzního motoru"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_INERTIAL_DAMPERS, L"Inerciální tlumiče"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_LASER_GUN, L"Laserové dělo"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_LIFE_SUPPORT, L"Podpora života"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_LONG_RANGE_SENSORS, L"Dálkové senzory"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_MAGNETICAL_COLLECTORS_OF_PLASMA, L"Magnetické kolektory plazmy"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_MAGNETICAL_FILTER, L"Magnetický filtr"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_MAGNETICAL_GRID, L"Magnetická mřížka"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_MAINFRAME, L"Palubní počítač"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_MECHANICAL_DAMPERS, L"Mechanické tlumiče"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_NAVIGATION_COMPUTER, L"Navigační počítač"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_PLASMA_FILTER, L"Filtr plazmy"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_PROBE, L"Průzkumné zařízení"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_QUARK_GLUON_CORE, L"Quark-gluonové jádro"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_SCIENTIFIC_LAB, L"Vědecká laboratoř"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_SUBMARINE_MINING_MACHINE, L"Podmořské těžební zařízení"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_SUBMERSIBLE_FILTRATION_TANK, L"Ponorná filtrační nádrž"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_SUBSPACE_BEACON, L"Podprostorový maják"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_SUBSPACE_TRANSMITTER, L"Podprostorový vysílač"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_TRANSPORT_BEAM_GENERATOR, L"Generátor transportního paprsku"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_TRANSPORT_CONTAINER, L"Transportní kontejner"));	
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_UNDERGROUND_DRILLIG_MACHINE, L"Podzemní těžební stroje"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_WEAPON_ENERGY_CIRCUIT, L"Energetický zbraňový okruh"));	
	gameNames_.insert(std::make_pair(PROTOCOL_HANGARS_PATTERN_ID_ZIRCONIUM_REACTOR, L"Zirkoniový reaktor"));	

	gameNames_.insert(std::make_pair(PROTOCOL_TRADE_RESULT_DONE, L"Vše v pořádku"));
	gameNames_.insert(std::make_pair(PROTOCOL_TRADE_RESULT_FIRST_FORTRESS_CAPACITY_LIMIT, L"Překročen kapacitní limit v první pevnosti"));
	gameNames_.insert(std::make_pair(PROTOCOL_TRADE_RESULT_FIRST_FORTRESS_ENERGETIC_CELLS_LACK, L"Nedostatek energetických článků v první pevnosti"));
	gameNames_.insert(std::make_pair(PROTOCOL_TRADE_RESULT_FIRST_FORTRESS_MAGNETICAL_GRIDS_LACK, L"Nedostatek magnetických mřížek v první pevnosti"));	
	gameNames_.insert(std::make_pair(PROTOCOL_TRADE_RESULT_FIRST_FORTRESS_NOT_STORING_ITEMS, L"První pevnost nemá některé předměty z nabídky"));
	gameNames_.insert(std::make_pair(PROTOCOL_TRADE_RESULT_FIRST_FORTRESS_TRANSPORT_CONTAINERS_LACK, L"Nedostatek transportních kontejnerů v první pevnosti"));
	gameNames_.insert(std::make_pair(PROTOCOL_TRADE_RESULT_FIRST_FORTRESS_WEIGHT_LIMIT, L"Překročen hmotností limit v první pevnosti"));
	gameNames_.insert(std::make_pair(PROTOCOL_TRADE_RESULT_SECOND_FORTRESS_CAPACITY_LIMIT, L"Překročen kapacitní limit v druhé pevnosti"));
	gameNames_.insert(std::make_pair(PROTOCOL_TRADE_RESULT_SECOND_FORTRESS_ENERGETIC_CELLS_LACK, L"Nedostatek energetických článků v druhé pevnosti"));
	gameNames_.insert(std::make_pair(PROTOCOL_TRADE_RESULT_SECOND_FORTRESS_MAGNETICAL_GRIDS_LACK, L"Nedostatek magnetických mřížek v druhé pevnosti"));
	gameNames_.insert(std::make_pair(PROTOCOL_TRADE_RESULT_SECOND_FORTRESS_NOT_STORING_ITEMS, L"Druhá pevnost nemá některé předměty z nabídky"));
	gameNames_.insert(std::make_pair(PROTOCOL_TRADE_RESULT_SECOND_FORTRESS_TRANSPORT_CONTAINERS_LACK, L"Nedostatek transportních kontejnerů v druhé pevnosti"));
	gameNames_.insert(std::make_pair(PROTOCOL_TRADE_RESULT_SECOND_FORTRESS_WEIGHT_LIMIT, L"Překročen hmotností limit v druhé pevnosti"));	
	gameNames_.insert(std::make_pair(PROTOCOL_TRADE_RESULT_NOT_IN_RANGE, L"Pevnosti nejsou v dosahu pro obchodování"));	

	gameNames_.insert(std::make_pair(PROTOCOL_MOUNTING_RESULT_DONE, L"Vše v pořádku"));
	gameNames_.insert(std::make_pair(PROTOCOL_MOUNTING_RESULT_SLOT_OCCUPIED, L"Předmět nelze namontovat, protože na jeho místě už je jiný předmět, který je třeba nejprve demontovat."));
	gameNames_.insert(std::make_pair(PROTOCOL_MOUNTING_SLOT_EMPTY, L"Předmět nelze demontovat, protože tam žádný není."));
	gameNames_.insert(std::make_pair(PROTOCOL_MOUNTING_RESULT_NOT_ENOUGH_ANDROIDS, L"Předmět nelze montovat ani odmontovat, protože nemáš dostatek androidů."));
	gameNames_.insert(std::make_pair(PROTOCOL_MOUNTING_RESULT_NOT_ENOUGH_ENERGY, L"Předmět nelze montovat ani odmontovat, protože nemáš dostatek energie"));
	gameNames_.insert(std::make_pair(PROTOCOL_MOUNTING_RESULT_NOT_ENOUGH_STORAGE_SPACE, L"Předmět nelze odmontovat, protože je plný sklad."));
	gameNames_.insert(std::make_pair(PROTOCOL_MOUNTING_RESULT_UNKNOWN_FAIL, L"Neznámá příčina, zřejmě chyba na serveru. "));			
	gameNames_.insert(std::make_pair(PROTOCOL_MOUNTING_RESULT_HANGAR_NOT_EMPTY, L"Hangár nelze namontovat ani odmontovat, protože v sobě má nějaký vyráběný předmět nebo loď"));	
	gameNames_.insert(std::make_pair(PROTOCOL_MOUNTING_RESULT_BAD_FORTRESS_TYPE, L"Předmět nelze namontovat ani odmontovat, protože v daném typu pevnosti není. "));	

	gameNames_.insert(std::make_pair(REQUEST_CHANGE_DEVICE_ENERGY_ANSWER_FORTRESSNE, L"Zadaná pevnost neexistuje."));	
	gameNames_.insert(std::make_pair(REQUEST_CHANGE_DEVICE_ENERGY_ANSWER_FORTRESSNO, L"Zadaná pevnost není hráčova."));	

	gameNames_.insert(std::make_pair(REQUEST_DEVICE_ENERGY_ANSWER_FORTRESSNE, L"Zadaná pevnost neexistuje."));	
	gameNames_.insert(std::make_pair(REQUEST_DEVICE_ENERGY_ANSWER_FORTRESSNO, L"Zadaná pevnost není hráčova."));	

	gameNames_.insert(std::make_pair(REQUEST_FORTRESS_WEAPONS_INFORMATION_ANSWER_FORTRESSNE, L"Zadaná pevnost neexistuje."));	
	gameNames_.insert(std::make_pair(REQUEST_FORTRESS_WEAPONS_INFORMATION_ANSWER_FORTRESSNO, L"Zadaná pevnost není hráčova."));

	gameNames_.insert(std::make_pair(REQUEST_FORTRESS_CREW_INFORMATION_ANSWER_FORTRESSNE, L"Zadaná pevnost neexistuje."));	
	gameNames_.insert(std::make_pair(REQUEST_FORTRESS_CREW_INFORMATION_ANSWER_FORTRESSNO, L"Zadaná pevnost není hráčova."));

	gameNames_.insert(std::make_pair(REQUEST_FORTRESS_ACCOMMODATIONS_INFORMATION_ANSWER_FORTRESSNE, L"Zadaná pevnost neexistuje."));	
	gameNames_.insert(std::make_pair(REQUEST_FORTRESS_ACCOMMODATIONS_INFORMATION_ANSWER_FORTRESSNO, L"Zadaná pevnost není hráčova."));

	gameNames_.insert(std::make_pair(REQUEST_FORTRESS_OTHER_EQUIPMENT_INFORMATION_ANSWER_FORTRESSNE, L"Zadaná pevnost neexistuje."));	
	gameNames_.insert(std::make_pair(REQUEST_FORTRESS_OTHER_EQUIPMENT_INFORMATION_ANSWER_FORTRESSNO, L"Zadaná pevnost není hráčova."));

	gameNames_.insert(std::make_pair(REQUEST_BASE_HANGARS_INFORMATION_ANSWER_FORTRESSNE, L"Zadaná pevnost neexistuje."));	
	gameNames_.insert(std::make_pair(REQUEST_BASE_HANGARS_INFORMATION_ANSWER_FORTRESSNO, L"Zadaná pevnost není hráčova."));
	gameNames_.insert(std::make_pair(REQUEST_BASE_HANGARS_INFORMATION_ANSWER_FORTRESSNOTBASE, L"Zadaná pevnost není základna."));

	gameNames_.insert(std::make_pair(REQUEST_FORTRESS_WAREHOUSES_INFORMATION_ANSWER_FORTRESSNE, L"Zadaná pevnost neexistuje."));	
	gameNames_.insert(std::make_pair(REQUEST_FORTRESS_WAREHOUSES_INFORMATION_ANSWER_FORTRESSNO, L"Zadaná pevnost není hráčova."));

	gameNames_.insert(std::make_pair(REQUEST_SHIP_ANDROIDS_INFORMATION_ANSWER_FORTRESSNE, L"Zadaná pevnost neexistuje."));	
	gameNames_.insert(std::make_pair(REQUEST_SHIP_ANDROIDS_INFORMATION_ANSWER_FORTRESSNO, L"Zadaná pevnost není hráčova."));
	gameNames_.insert(std::make_pair(REQUEST_SHIP_ANDROIDS_INFORMATION_ANSWER_FORTRESSNOTSHIP, L"Zadaná pevnost není loď."));

	gameNames_.insert(std::make_pair(REQUEST_BASE_ANDROIDS_INFORMATION_ANSWER_FORTRESSNE, L"Zadaná pevnost neexistuje."));	
	gameNames_.insert(std::make_pair(REQUEST_BASE_ANDROIDS_INFORMATION_ANSWER_FORTRESSNO, L"Zadaná pevnost není hráčova."));
	gameNames_.insert(std::make_pair(REQUEST_BASE_ANDROIDS_INFORMATION_ANSWER_FORTRESSNOTBASE, L"Zadaná pevnost není základna."));

	gameNames_.insert(std::make_pair(REQUEST_CHANGE_SHIP_ANDROIDS_STATE_ANSWER_FORTRESSNE, L"Zadaná pevnost neexistuje."));	
	gameNames_.insert(std::make_pair(REQUEST_CHANGE_SHIP_ANDROIDS_STATE_ANSWER_FORTRESSNO, L"Zadaná pevnost není hráčova."));
	gameNames_.insert(std::make_pair(REQUEST_CHANGE_SHIP_ANDROIDS_STATE_ANSWER_FORTRESSNOTSHIP, L"Zadaná pevnost není loď."));

	gameNames_.insert(std::make_pair(REQUEST_CHANGE_BASE_ANDROIDS_STATE_ANSWER_FORTRESSNE, L"Zadaná pevnost neexistuje."));	
	gameNames_.insert(std::make_pair(REQUEST_CHANGE_BASE_ANDROIDS_STATE_ANSWER_FORTRESSNO, L"Zadaná pevnost není hráčova."));
	gameNames_.insert(std::make_pair(REQUEST_CHANGE_BASE_ANDROIDS_STATE_ANSWER_FORTRESSNOTBASE, L"Zadaná pevnost není základna."));

	gameNames_.insert(std::make_pair(REQUEST_FORTRESS_ADD_ACCOMMODATIONS_ANSWER_FORTRESSNE, L"Zadaná pevnost není základna."));
	gameNames_.insert(std::make_pair(REQUEST_FORTRESS_ADD_ACCOMMODATIONS_ANSWER_FORTRESSNO, L"Zadaná pevnost není hráčova."));	

	gameNames_.insert(std::make_pair(REQUEST_SHIP_JOURNEY_ANSWER_SHIPNE, L"Zadaná loď neexistuje."));
	gameNames_.insert(std::make_pair(REQUEST_SHIP_JOURNEY_ANSWER_SHIPNO, L"Zadaná loď není hráčova."));
	gameNames_.insert(std::make_pair(REQUEST_SHIP_JOURNEY_ANSWER_BADSPOBJ, L"Zadaný vesmírný objekt neexistuje."));

	gameNames_.insert(std::make_pair(REQUEST_SHIPSINAREA_ANSWER_NOTEXIST, L"Zadaná loď neexistuje."));
	gameNames_.insert(std::make_pair(REQUEST_SHIPSINAREA_ANSWER_NOTOWN, L"Zadaná loď není hráčova."));
	gameNames_.insert(std::make_pair(REQUEST_SHIPSINAREA_ANSWER_WARP, L"Loď je ve warpu, nelze splnit požadavek."));
	gameNames_.insert(std::make_pair(REQUEST_SHIPSINAREA_ANSWER_IE, L"Interní chyba serveru."));

	gameNames_.insert(std::make_pair(REQUEST_PLANETS_BAD_ANSWER_NOT_EXISTS, L"Zadaná oblasti neexistuje."));
	gameNames_.insert(std::make_pair(REQUEST_PLANETS_BAD_ANSWER_NOT_STAR, L"Zadaný vesmírný objekt není hvězda."));
	gameNames_.insert(std::make_pair(REQUEST_PLANETS_BAD_ANSWER_IE, L"Interní chyba serveru."));
	
	gameNames_.insert(std::make_pair(REQUEST_NAVIGATION_ANSWER_NOT_EXISTS, L"Zadaná loď neexistuje."));
	gameNames_.insert(std::make_pair(REQUEST_NAVIGATION_ANSWER_NOT_OWNED, L"Zadaná lod není hráčova."));
	gameNames_.insert(std::make_pair(REQUEST_NAVIGATION_ANSWER_NOT_CONTROLLABLE, L"Zadaná lod není kontrolovatelná."));	
	gameNames_.insert(std::make_pair(REQUEST_NAVIGATION_ANSWER_IN_WARP, L"Loď je ve warpu, nelze splnit požadavek."));
	gameNames_.insert(std::make_pair(REQUEST_NAVIGATION_ANSWER_NOT_IN_WARP, L"Loď není ve warpu, nelze splnit požadavek."));
	gameNames_.insert(std::make_pair(REQUEST_NAVIGATION_ANSWER_IN_BASE, L"Loď přistála na základně."));
	gameNames_.insert(std::make_pair(REQUEST_NAVIGATION_ANSWER_BAD_TARGET1, L"Cílová loď není na základně."));
	gameNames_.insert(std::make_pair(REQUEST_NAVIGATION_ANSWER_BAD_TARGET2, L"Cílový objekt navigace neexistuje."));

	gameNames_.insert(std::make_pair(REQUEST_FORTRESS_QUARRY_INFORMATION_ANSWER_FORTRESSNE, L"Zadaná pevnost neexistuje."));
	gameNames_.insert(std::make_pair(REQUEST_FORTRESS_QUARRY_INFORMATION_ANSWER_FORTRESSNO, L"Zadaná pevnost není hráčova."));
	gameNames_.insert(std::make_pair(REQUEST_FORTRESS_QUARRY_CHANGE_STATE_ANSWER_FORTRESSNE, L"Zadaná pevnost neexistuje."));
	gameNames_.insert(std::make_pair(REQUEST_FORTRESS_QUARRY_CHANGE_STATE_ANSWER_FORTRESSNO, L"Zadaná pevnost není hráčova."));
	gameNames_.insert(std::make_pair(REQUEST_FORTRESS_QUARRY_CHANGE_STATE_ANSWER_BAD_TYPE, L"Zadaná surovina neexistuje."));

	gameNames_.insert(std::make_pair(REQUEST_MOVE_TRADE_ITEM_ANSWER_FAIL_FORBIDDEN_DIRECTION, L"Předmět se nesmí přesunout do dané množiny."));
	gameNames_.insert(std::make_pair(REQUEST_MOVE_TRADE_ITEM_ANSWER_FAIL_SOURCE_FORTRESS_NOT_EXISTS, L"Zdrojová pevnost neexistuje."));
	gameNames_.insert(std::make_pair(REQUEST_MOVE_TRADE_ITEM_ANSWER_FAIL_TARGET_FORTRESS_NOT_PARTNER, L"Cílová pevnost s tebou neobchoduje."));
	gameNames_.insert(std::make_pair(REQUEST_MOVE_TRADE_ITEM_ANSWER_FAIL_TARGET_REALM_NOT_PARTNER, L"Cílový hráč s tebou neobchoduje."));
	gameNames_.insert(std::make_pair(REQUEST_MOVE_TRADE_ITEM_ANSWER_FAIL_SOURCE_FORTRESS_NOT_PARTNER, L"Zdrojová pevnost neobchoduje."));
	gameNames_.insert(std::make_pair(REQUEST_MOVE_TRADE_ITEM_ANSWER_FAIL_YOU_ARE_NOT_TRADER, L"Nejsi ve stavu obchodování."));
	gameNames_.insert(std::make_pair(REQUEST_MOVE_TRADE_ITEM_ANSWER_FAIL_TARGET_FORTRESS_NOT_EXISTS, L"Cílová pevnost neexistuje."));
	gameNames_.insert(std::make_pair(REQUEST_MOVE_TRADE_ITEM_ANSWER_FAIL_UNKNOWN_ITEM, L"Zadaný předmět neexistuje."));

	gameNames_.insert(std::make_pair(REQUEST_MOVE_TRADE_RESOURCE_ANSWER_FAIL_FORBIDDEN_DIRECTION, L"Surovina se nesmí přesunout do dané množiny."));
	gameNames_.insert(std::make_pair(REQUEST_MOVE_TRADE_RESOURCE_ANSWER_FAIL_SOURCE_FORTRESS_NOT_EXISTS, L"Zdrojová pevnost neexistuje."));
	gameNames_.insert(std::make_pair(REQUEST_MOVE_TRADE_RESOURCE_ANSWER_FAIL_TARGET_FORTRESS_NOT_PARTNER, L"Cílová pevnost s tebou neobchoduje."));
	gameNames_.insert(std::make_pair(REQUEST_MOVE_TRADE_RESOURCE_ANSWER_FAIL_TARGET_REALM_NOT_PARTNER, L"Cílový hráč s tebou neobchoduje."));
	gameNames_.insert(std::make_pair(REQUEST_MOVE_TRADE_RESOURCE_ANSWER_FAIL_SOURCE_FORTRESS_NOT_PARTNER, L"Zdrojová pevnost neobchoduje."));
	gameNames_.insert(std::make_pair(REQUEST_MOVE_TRADE_RESOURCE_ANSWER_FAIL_YOU_ARE_NOT_TRADER, L"Nejsi ve stavu obchodování."));
	gameNames_.insert(std::make_pair(REQUEST_MOVE_TRADE_RESOURCE_ANSWER_FAIL_TARGET_FORTRESS_NOT_EXISTS, L"Cílová pevnost neexistuje."));

	gameNames_.insert(std::make_pair(REQUEST_BASE_HANGARS_INFORMATION_ANSWER_FORTRESSNE, L"Zadaná pevnost neexistuje."));	
	gameNames_.insert(std::make_pair(REQUEST_BASE_HANGARS_INFORMATION_ANSWER_FORTRESSNO, L"Zadaná pevnost není hráčova."));
	gameNames_.insert(std::make_pair(REQUEST_BASE_HANGARS_INFORMATION_ANSWER_FORTRESSNOTBASE, L"Zadaná pevnost není základna."));
	gameNames_.insert(std::make_pair(REQUEST_BASE_HANGARS_INFORMATION_ANSWER_HANGAR_NOT_EXISTS, L"Zadaný hangár neexistuje."));	

	gameNames_.insert(std::make_pair(REQUEST_LOGIN_ANSWER_ALREADY_AUTHORIZED, L"Zadaný hráč už je na serveru přihlášený."));	
	gameNames_.insert(std::make_pair(REQUEST_LOGIN_ANSWER_BAD_PASSWORD, L"Zadaný heslo neodpovídá."));	
	gameNames_.insert(std::make_pair(REQUEST_LOGIN_ANSWER_BAD_LOGIN, L"Zadané uživatelské jméno neodpovídá."));	

	gameNames_.insert(std::make_pair(REQUEST_TRADE_PARTNER_FORTRESSES_ANSWER_FORTRESSNE, L"Cílová pevnost neexistuje."));
	gameNames_.insert(std::make_pair(REQUEST_TRADE_PARTNER_FORTRESSES_ANSWER_FORTRESSNO, L"Cílová pevnost není hráčova."));

	gameNames_.insert(std::make_pair(REQUEST_SEND_TRADE_INVITATION_ANSWER_FAIL_FORTRESSNO, L"Zadaná pevnost není hráčova."));

	gameNames_.insert(std::make_pair(PROTOCOL_ERROR_MESSAGE_FORTRESS_NOT_CONTROLLABLE, L"Zadaná pevnost není kontrolovatelná."));

	gameNames_.insert(std::make_pair(PROTOCOL_PARAM_NAME_ACCUMULATOR, L"Akumulátor"));	
	gameNames_.insert(std::make_pair(PROTOCOL_PARAM_NAME_CHARGING, L"Nabíjení"));	
	gameNames_.insert(std::make_pair(PROTOCOL_PARAM_NAME_MAX_SPEED_TOC, L"Maximální rychlost"));	
	gameNames_.insert(std::make_pair(PROTOCOL_PARAM_NAME_CONSUMPTION, L"Spotřeba"));	
	gameNames_.insert(std::make_pair(PROTOCOL_PARAM_NAME_ENGINE_FORCE, L"Síla motoru"));	
	gameNames_.insert(std::make_pair(PROTOCOL_PARAM_NAME_MAX_ACCELERATION, L"Maximální akcelerace"));	
	gameNames_.insert(std::make_pair(PROTOCOL_PARAM_NAME_FORCIBILITY, L"Tah"));	
	gameNames_.insert(std::make_pair(PROTOCOL_PARAM_NAME_PRECISION, L"Přesnost"));	
	gameNames_.insert(std::make_pair(PROTOCOL_PARAM_NAME_RANGE, L"Dosah"));	
	gameNames_.insert(std::make_pair(PROTOCOL_PARAM_NAME_TOTAL_WINDING_SPEED, L"Celková rychlost těžby"));	
	gameNames_.insert(std::make_pair(PROTOCOL_PARAM_NAME_LEVEL, L"Úroveň"));	
	gameNames_.insert(std::make_pair(PROTOCOL_PARAM_NAME_POINTS_PER_SECOND, L"Body za sekundu"));	
	gameNames_.insert(std::make_pair(PROTOCOL_PARAM_NAME_WORKING_CONSUMPTION, L"Pracovní spotřeba"));	
	gameNames_.insert(std::make_pair(PROTOCOL_PARAM_NAME_CAPACITY, L"Kapacita"));	
	gameNames_.insert(std::make_pair(PROTOCOL_PARAM_NAME_TOTAL_FILTERING_SPEED, L"Celková rychlost filtrace"));	
	gameNames_.insert(std::make_pair(PROTOCOL_PARAM_NAME_CONSUMPTION_FOR_ONE_PERSON, L"Spotřeba na osobu"));	
	gameNames_.insert(std::make_pair(PROTOCOL_PARAM_NAME_MESSAGE_COST, L"Cena za zprávu"));	
	gameNames_.insert(std::make_pair(PROTOCOL_PARAM_NAME_BIO_NODES, L"Bio-uzly"));	
	gameNames_.insert(std::make_pair(PROTOCOL_PARAM_NAME_PREDICTION, L"Predikce"));	
	gameNames_.insert(std::make_pair(PROTOCOL_PARAM_NAME_TIME_REUSABILITY, L"Znovupoužitelnost času"));	
	gameNames_.insert(std::make_pair(PROTOCOL_PARAM_NAME_HEIGHT, L"Výška"));	
	gameNames_.insert(std::make_pair(PROTOCOL_PARAM_NAME_LENGTH, L"Délka"));	
	gameNames_.insert(std::make_pair(PROTOCOL_PARAM_NAME_WIDTH, L"Šířka"));	
	gameNames_.insert(std::make_pair(PROTOCOL_PARAM_NAME_TOTAL_PRODUCTION, L"Celková produkce"));	
	gameNames_.insert(std::make_pair(PROTOCOL_PARAM_NAME_METAMORPHOSIS_EFFECTIVITY, L"Efektivita proměny"));		
	gameNames_.insert(std::make_pair(PROTOCOL_PARAM_NAME_DAMAGE, L"Poškození"));
	gameNames_.insert(std::make_pair(PROTOCOL_PARAM_NAME_LEAK, L"Samovolný únik"));
	gameNames_.insert(std::make_pair(PROTOCOL_PARAM_NAME_SOLIDITY, L"Pevnost"));

	gameNames_.insert(std::make_pair(REQUEST_RENAME_FORTRESS_ANSWER_FAIL_FORTRESSNE, L"Zadaná pevnost neexistuje."));
	gameNames_.insert(std::make_pair(REQUEST_RENAME_FORTRESS_ANSWER_FAIL_FORTRESSNO, L"Zadaná pevnost není hráčova."));
	gameNames_.insert(std::make_pair(REQUEST_RENAME_FORTRESS_ANSWER_FAIL_EMPTY_NAME, L"Zadané jméno pevnosti je prázdné."));

	gameNames_.insert(std::make_pair(PROTOCOL_HANGAR_ICR_OK, L"Vše v pořádku"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGAR_ICR_INVALID_PARAMS, L"Byly zadány neplatné parametry"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGAR_ICR_FULL_HANGAR, L"Hangár už je plný"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGAR_ICR_NOT_ENOUGH_ULREI, L"Nemáš dostatek ulrei"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGAR_ICR_NOT_ENOUGH_TITANIUM, L"Nemáš dostatek titanu"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGAR_ICR_NOT_ENOUGH_DEUTERIUM, L"Nemáš dostatek deuteria"));
	gameNames_.insert(std::make_pair(PROTOCOL_HANGAR_ICR_NOT_ENOUGH_HEAVY_WATER, L"Nemáš dostatek těžké vody"));

	gameNames_.insert(std::make_pair(REQUEST_HANGAR_CANCEL_ITEM_FORTRESSNE, L"Zadaná pevnost neexistuje."));
	gameNames_.insert(std::make_pair(REQUEST_HANGAR_CANCEL_ITEM_FORTRESSNO, L"Zadaná pevnost není hráčova."));
	gameNames_.insert(std::make_pair(REQUEST_HANGAR_CANCEL_ITEM_FORTRESSNOTBASE, L"Zadaná pevnost není pevnost."));
	gameNames_.insert(std::make_pair(REQUEST_HANGAR_CANCEL_ITEM_HANGARNE, L"Zadaný hangár neexistuje."));

	gameNames_.insert(std::make_pair(REQUEST_HANGAR_BUILD_ITEM_FORTRESSNE, L"Zadaná pevnost neexistuje."));
	gameNames_.insert(std::make_pair(REQUEST_HANGAR_BUILD_ITEM_FORTRESSNO, L"Zadaná pevnost není hráčova."));
	gameNames_.insert(std::make_pair(REQUEST_HANGAR_BUILD_ITEM_FORTRESSNOTBASE, L"Zadaná pevnost není pevnost."));
	gameNames_.insert(std::make_pair(REQUEST_HANGAR_BUILD_ITEM_HANGARNE, L"Zadaný hangár neexistuje."));	
}

void Settings::createGameIcons() {
	emptyIcon_ = QIcon();

	QIcon accommodations;
	accommodations.addFile(QString::fromUtf8(":/pictures/images/details/ubykace.png"), QSize(), QIcon::Normal, QIcon::Off);
	gameIcons_.insert(std::make_pair(GAME_ICON_ACCOMMODATIONS, accommodations));	

	QIcon wait;
	wait.addFile(QString::fromUtf8(":/pictures/images/trade/wait-icon.png"), QSize(), QIcon::Normal, QIcon::Off);
	gameIcons_.insert(std::make_pair(GAME_ICON_WAIT, wait));

	QIcon invitation;
	invitation.addFile(QString::fromUtf8(":/pictures/images/trade/email-icon.png"), QSize(), QIcon::Normal, QIcon::Off);
	gameIcons_.insert(std::make_pair(GAME_ICON_INVITATION, invitation));

	QIcon success;
	success.addFile(QString::fromUtf8(":/pictures/images/trade/ok-big.png"), QSize(), QIcon::Normal, QIcon::Off);
	gameIcons_.insert(std::make_pair(GAME_ICON_SUCCESS, success));

	QIcon failure;
	failure.addFile(QString::fromUtf8(":/pictures/images/trade/not-ok-big.png"), QSize(), QIcon::Normal, QIcon::Off);
	gameIcons_.insert(std::make_pair(GAME_ICON_FAILURE, failure));

	QIcon base;
	base.addFile(QString::fromUtf8(":/pictures/images/details/modelZakladna.png"), QSize(), QIcon::Normal, QIcon::Off);
	gameIcons_.insert(std::make_pair(GAME_ICON_BASE, base));

	QIcon conquer;
	conquer.addFile(QString::fromUtf8(":/pictures/images/details/zbrane.png"), QSize(), QIcon::Normal, QIcon::Off);
	gameIcons_.insert(std::make_pair(GAME_ICON_CONQUER, conquer));

	QIcon deviceDistribution;
	deviceDistribution.addFile(QString::fromUtf8(":/pictures/images/others/energyCircuit.png"), QSize(), QIcon::Normal, QIcon::Off);
	gameIcons_.insert(std::make_pair(GAME_ICON_DEVICE_DITRIBUTION, deviceDistribution));	

	QIcon weapons;
	weapons.addFile(QString::fromUtf8(":/pictures/images/details/zbrane.png"), QSize(), QIcon::Normal, QIcon::Off);
	gameIcons_.insert(std::make_pair(GAME_ICON_WEAPONS, weapons));

	QIcon crew;
	crew.addFile(QString::fromUtf8(":/pictures/images/details/posadka.png"), QSize(), QIcon::Normal, QIcon::Off);
	gameIcons_.insert(std::make_pair(GAME_ICON_CREW, crew));
	
	QIcon equipment;
	equipment.addFile(QString::fromUtf8(":/pictures/images/details/vybaveni.png"), QSize(), QIcon::Normal, QIcon::Off);
	gameIcons_.insert(std::make_pair(GAME_ICON_EQUIPMENT, equipment));

	QIcon factories;
	factories.addFile(QString::fromUtf8(":/pictures/images/details/tovarny.png"), QSize(), QIcon::Normal, QIcon::Off);
	gameIcons_.insert(std::make_pair(GAME_ICON_FACTORIES, factories));

	QIcon warehouses;
	warehouses.addFile(QString::fromUtf8(":/pictures/images/details/sklady.png"), QSize(), QIcon::Normal, QIcon::Off);
	gameIcons_.insert(std::make_pair(GAME_ICON_WAREHOUSES, warehouses));

	QIcon androids;
	androids.addFile(QString::fromUtf8(":/pictures/images/details/androidi.png"), QSize(), QIcon::Normal, QIcon::Off);
	gameIcons_.insert(std::make_pair(GAME_ICON_ANDROIDS, androids));

	QIcon impulsDrive;
	impulsDrive.addFile(QString::fromUtf8(":/pictures/images/details/zakladniPohon.png"), QSize(), QIcon::Normal, QIcon::Off);
	gameIcons_.insert(std::make_pair(GAME_ICON_IMPULS_DRIVE, impulsDrive));

	QIcon subspaceDrive;
	subspaceDrive.addFile(QString::fromUtf8(":/pictures/images/details/podprostorovyPohon.png"), QSize(), QIcon::Normal, QIcon::Off);
	gameIcons_.insert(std::make_pair(GAME_ICON_SUBSPACE_DRIVE, subspaceDrive));

	QIcon ship;
	ship.addFile(QString::fromUtf8(":/pictures/images/others/shuttle-icon.png"), QSize(), QIcon::Normal, QIcon::Off);
	gameIcons_.insert(std::make_pair(GAME_ICON_SHIP, ship));

	QIcon quarrying;
	quarrying.addFile(QString::fromUtf8(":/pictures/images/details/mining.png"), QSize(), QIcon::Normal, QIcon::Off);
	gameIcons_.insert(std::make_pair(GAME_ICON_QUARRYING, quarrying));

	QIcon trade;
	trade.addFile(QString::fromUtf8(":/pictures/images/main/obchod.png"), QSize(), QIcon::Normal, QIcon::Off);
	gameIcons_.insert(std::make_pair(GAME_ICON_TRADE, trade));

	QIcon hangars;
	hangars.addFile(QString::fromUtf8(":/pictures/images/others/hangary.png"), QSize(), QIcon::Normal, QIcon::Off);
	gameIcons_.insert(std::make_pair(GAME_ICON_HANGARS, hangars));	

	QIcon shields;
	shields.addFile(QString::fromUtf8(":/pictures/images/details/stity.png"), QSize(), QIcon::Normal, QIcon::Off);
	gameIcons_.insert(std::make_pair(GAME_ICON_SHIELDS, shields));	

	QIcon centralInformation;
	centralInformation.addFile(QString::fromUtf8(":/pictures/images/details/centralInfo.png"), QSize(), QIcon::Normal, QIcon::Off);
	gameIcons_.insert(std::make_pair(GAME_ICON_CENTRAL_INFORMATION, centralInformation));	

	QIcon mainframe;
	mainframe.addFile(QString::fromUtf8(":/pictures/images/details/pocitac.png"), QSize(), QIcon::Normal, QIcon::Off);
	gameIcons_.insert(std::make_pair(GAME_ICON_MAINFRAME, mainframe));

	QIcon cloaking;
	cloaking.addFile(QString::fromUtf8(":/pictures/images/details/maskovani.png"), QSize(), QIcon::Normal, QIcon::Off);
	gameIcons_.insert(std::make_pair(GAME_ICON_CLOAKING, cloaking));

	QIcon sensors;
	sensors.addFile(QString::fromUtf8(":/pictures/images/details/senzory.png"), QSize(), QIcon::Normal, QIcon::Off);
	gameIcons_.insert(std::make_pair(GAME_ICON_SENSORS, cloaking));

	QIcon probe;
	probe.addFile(QString::fromUtf8(":/pictures/images/details/pruzkum.png"), QSize(), QIcon::Normal, QIcon::Off);
	gameIcons_.insert(std::make_pair(GAME_ICON_PROBE, cloaking));
}


const QString & Settings::getStyle(const std::string & key) {
	std::map<std::string, QString>::const_iterator it = styles_.find(key);

	if (it == styles_.end()) {
		return emptyStyle_;
	}
	
	return it->second;
}

const std::wstring & Settings::getGameName(const std::string & key) {
	std::map<std::string, std::wstring>::const_iterator it = gameNames_.find(key);

	if (it == gameNames_.end()) {
		return emptyGameName_;
	}
	
	return it->second;
}

const QIcon & Settings::getGameIcon(const std::string & key) {
	std::map<std::string, QIcon>::const_iterator it = gameIcons_.find(key);

	if (it == gameIcons_.end()) {
		return emptyIcon_;
	}
	
	return it->second;
}

QString Settings::getGameNameQString(const std::string & key) {
	return QString::fromUtf16(getGameName(key).c_str());
}

QString Settings::formatNumber(const unsigned long long & number) {
    QLocale::setDefault(QLocale::English);
    QString formatted = QString("%L1").arg(number);
	formatted.replace(",", " ");
	return formatted;
}

QString Settings::formatNumber(const unsigned long & number) {
    QLocale::setDefault(QLocale::English);
    QString formatted = QString("%L1").arg(number);
	formatted.replace(",", " ");
	return formatted;
}

QString Settings::formatNumber(const long long & number) {
    QLocale::setDefault(QLocale::English);
    QString formatted = QString("%L1").arg(number);
	formatted.replace(",", " ");
	return formatted;
}

QString Settings::formatNumber(const long & number) {
    QLocale::setDefault(QLocale::English);
    QString formatted = QString("%L1").arg(number);
	formatted.replace(",", " ");
	return formatted;
}

QString Settings::formatNumber(const unsigned int & number) {
    QLocale::setDefault(QLocale::English);
    QString formatted = QString("%L1").arg(number);
	formatted.replace(",", " ");
	return formatted;
}

QString Settings::formatNumber(const int & number) {
    QLocale::setDefault(QLocale::English);
    QString formatted = QString("%L1").arg(number);
	formatted.replace(",", " ");
	return formatted;
}

QString Settings::formatNumber(const double & number) {
    QLocale::setDefault(QLocale::English);
    QString formatted = QString("%L1").arg(number);
	formatted.replace(",", " ");
	return formatted;
}