/*
 *  Copyright (C) 2007-2008 CMM Sigma Andrzej Chmielowiec <cmmsigma@cmmsigma.eu>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License version 3
 *  as published by the Free Software Foundation.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 */

#include "ProgressWidget.h"

ProgressWidget::ProgressWidget(QWidget *parent): QWidget(parent)
{
	QGridLayout *grid = new QGridLayout(this);
	
	mProgress = 0;
	mRange = 0;
	
	mProgressBar = new QProgressBar;
	
	grid->addWidget(mProgressBar, 0, 0);
	
	setLayout(grid);
}

void
ProgressWidget::setRange(int range)
{
	mRange = range;
	mProgressBar->setRange(0, mRange);
}

void
ProgressWidget::setProgress(int progress)
{
	if (progress < mRange)
		mProgress = progress;
	else
		mProgress = mRange;
	
	mProgressBar->setValue(mProgress);
}
