#include "FASTTrackerPropertiesWidget.h"
#include "FASTTrackerProcessor.h"

FASTTrackerPropertiesWidget::FASTTrackerPropertiesWidget( FASTTrackerProcessor *tracker, QWidget *parent, Qt::WFlags f )
	: QWidget( parent, f ), _tracker( tracker )
{
	ui.setupUi( this );
	refresh();
}

FASTTrackerPropertiesWidget::~FASTTrackerPropertiesWidget()
{
	// empty
}

void FASTTrackerPropertiesWidget::refresh()
{
	ui.thresholdSpinBox->setValue( _tracker->getThreshold() );
	ui.stdDeviationSpinBox->setValue( _tracker->getCannyStdDev() );
	ui.lowerSpinBox->setValue( _tracker->getCannyLower() );
	ui.upperSpinBox->setValue( _tracker->getCannyUpper() );
}

void FASTTrackerPropertiesWidget::on_thresholdSpinBox_valueChanged( int value )
{
	_tracker->setThreshold( value );
}

void FASTTrackerPropertiesWidget::on_enableCannyCheckBox_toggled( bool on )
{
	_tracker->setCannyEnabled( on );
}

void FASTTrackerPropertiesWidget::on_stdDeviationSpinBox_valueChanged( double value )
{
	_tracker->setCannyStdDev( value );
}

void FASTTrackerPropertiesWidget::on_lowerSpinBox_valueChanged( int value )
{
	_tracker->setCannyLower( value );
}

void FASTTrackerPropertiesWidget::on_upperSpinBox_valueChanged( int value )
{
	_tracker->setCannyUpper( value );
}
