#include "roomWidget.h"
#include <cassert>
#include "softProj\helpers.h"

RoomWidget::RoomWidget(QWidget * parent) : QWidget(parent) {
	ui_.setupUi(this);

	bool connected = true;
	connected = connected && connect(ui_.addRoomButton, SIGNAL(clicked(bool)), this, SLOT(addRoomButtonClickedSlot()));
	assert(connected && "Signals not connected");
}

void RoomWidget::setName(const std::wstring & name) {
	ui_.nameButton->setText(QString::fromUtf16(name.c_str()));
}

void RoomWidget::setIcon(const std::string & path) {
	setButtonIconFromResources(ui_.nameButton, path, 20);
}

void RoomWidget::setQualityClass(const std::wstring & qualityClass) {
	ui_.qualityClassLabel->setText(QString::fromUtf16(qualityClass.c_str()));
}

void RoomWidget::setAvailableCount(unsigned long value) {
	ui_.availableValue->setText(QString::number(value));
}

void RoomWidget::setEngagedCount(unsigned long value) {
	ui_.engagedValue->setText(QString::number(value));
}

void RoomWidget::setRoomCount(unsigned long value) {
	ui_.roomCountValue->setText(QString::number(value));
}

void RoomWidget::setPrice(unsigned long value) {
	ui_.priceValue->setText(QString::number(value));
}


void RoomWidget::addRoomButtonClickedSlot() {
	emit addRoomSignal();
}