#include "CRWidget.h"
#include <iostream>

CRWidget::CRWidget(QWidget *Parent) :
	QWidget(Parent)
{
	setupUi(this);

	connect(this->m_LowerBoundSlider, SIGNAL(sliderMoved(int)), this, SLOT(LowerBoundSliderChanged(int)));
	connect(this->m_UpperBoundSlider, SIGNAL(sliderMoved(int)), this, SLOT(UpperBoundSliderChanged(int))); 

	m_LowerBoundSlider->setMinimum(0);
	m_LowerBoundSlider->setMaximum(3000);
	m_LowerBoundSlider->setValue(0);
	LowerBoundSliderChanged(0);

	m_UpperBoundSlider->setMinimum(0);
	m_UpperBoundSlider->setMaximum(3000);
	m_UpperBoundSlider->setSingleStep(1);
	m_UpperBoundSlider->setValue(1000);
	UpperBoundSliderChanged(1000);

	connect(this->m_RangeCheckBox, SIGNAL(toggled(bool)), this, SIGNAL(RangeDataCheckBoxChanged(bool)));
	this->m_RangeCheckBox->setChecked(false);
}


CRWidget::~CRWidget()
{
}

void
CRWidget::LowerBoundSliderChanged(int value)
{
	m_UpperBoundSlider->setMinimum(value);
	//float lowerbound = (float)value/200.f;
	float lowerbound = value;
	m_LowerBoundLabel->setText(QString::number(lowerbound));
	emit LowerBoundChanged(lowerbound);
}

void
CRWidget::UpperBoundSliderChanged(int value)
{
	m_LowerBoundSlider->setMaximum(value);
	//float upperbound = (float)value/200.f;
	float upperbound = value;
	m_UpperBoundLabel->setText(QString::number(upperbound));
	emit UpperBoundChanged(upperbound);
}