#ifndef LASER_WEAPON_ITEM_WIDGET_H
#define LASER_WEAPON_ITEM_WIDGET_H

#include "ui_laserWeaponWidget.h"
#include <QtGui>
#include "weaponItem.h"
#include "protocol.h"
#include <cassert>

void setButtonIcon(QPushButton * button, const std::string & filePath, unsigned int iconSize);

class CombinedSlider;
class AllDevicesWidget;

///Manages and displays Laser weapon issues.
class LaserWeaponWidget : public BasicWeaponWidget {
	Q_OBJECT
private:
	Ui::LaserWeaponWidget ui_;	
	laser_gun_status state_;
	bool isSmall_;

	 QIcon okIcon;
	 QIcon notokIcon;

	QString availableButtonStyle_;
	QString unavailableButtonStyle_;

	QString availableSmallButtonStyle_;
	QString unavailableSmallButtonStyle_;
public slots:
	void chargeToFireSliderChangedSlot(int value);
	void switchOnButtonClickedSlot(bool checked);
	void unmountButtonClickedSlot();
public:
	virtual void setDeviceName(const std::wstring & deviceName);	/**< Sets name of the weapon. */

	LaserWeaponWidget(QWidget * parent);

	void chargeToFireChanged(unsigned long long value); /**< Sets weapon charge value. The weapon will fire when its charge value reach given value. */

	virtual unsigned long long getChargeToFire(); /**< Returns weapon charge value. */

	virtual void setMaximumCharge(unsigned long long value); /**< Sets weapon maximum charge limit. */ 
	virtual void setChargeToFire(unsigned long long value);	/**< Sets weapon charge value. The weapon will fire when its charge value reach given value. */
	virtual void setCurrentCharge(unsigned long long value);  /**< Sets current weapon charge value. */ 

	virtual void activateDevice(); /**< Makes the weapon active. */
	virtual void deactivateDevice(); /**< Makes the weapon unactive. */

	//TODO, FIXME, COMMENTME
	virtual void refreshDesignByActivity(); 

	void setState(const laser_gun_status & state);
	virtual std::pair<id_t, unsigned long long> getState();

	virtual void setEnergyUnit(const std::wstring & unit) {
		ui_.fireSlider->setEnergyUnit(unit); 
	} /**< Sets weapon energy units. */

	void setAsBig();
	void setAsSmall();

	void setAsMounted(bool mounted);
	virtual void notifyUpdate(double difference);
signals:
	void settingsChangedSignal(const std::pair<id_t, unsigned long long> & state);
	void unmountSignal(id_t itemId);

};

#endif