2010-02-10 18:13:12 +03:00
|
|
|
#include "ProgressWidget.h"
|
2010-02-12 18:43:56 +03:00
|
|
|
#include <QTimer>
|
2010-02-10 18:13:12 +03:00
|
|
|
|
|
|
|
ProgressWidget::ProgressWidget(QWidget *parent)
|
|
|
|
:QWidget(parent)
|
|
|
|
{
|
|
|
|
setupUi(this);
|
2013-06-05 07:45:00 +04:00
|
|
|
setRange(0, 1000);
|
2011-12-26 02:00:30 +04:00
|
|
|
setValue(0);
|
2010-02-10 18:13:12 +03:00
|
|
|
this->wascanceled = false;
|
2011-12-26 02:00:30 +04:00
|
|
|
this->starttime.start();
|
|
|
|
|
2010-02-10 18:13:12 +03:00
|
|
|
connect(this->stopButton, SIGNAL(clicked()), this, SLOT(cancel()));
|
2010-02-12 18:43:56 +03:00
|
|
|
QTimer::singleShot(1000, this, SIGNAL(requestShow()));
|
2010-02-10 18:13:12 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
bool ProgressWidget::wasCanceled() const
|
|
|
|
{
|
|
|
|
return this->wascanceled;
|
|
|
|
}
|
|
|
|
|
2011-12-26 02:00:30 +04:00
|
|
|
/*!
|
|
|
|
Returns milliseconds since this widget was created
|
|
|
|
*/
|
|
|
|
int ProgressWidget::elapsedTime() const
|
|
|
|
{
|
|
|
|
return this->starttime.elapsed();
|
|
|
|
}
|
|
|
|
|
2010-02-10 18:13:12 +03:00
|
|
|
void ProgressWidget::cancel()
|
|
|
|
{
|
|
|
|
this->wascanceled = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProgressWidget::setRange(int minimum, int maximum)
|
|
|
|
{
|
|
|
|
this->progressBar->setRange(minimum, maximum);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProgressWidget::setValue(int progress)
|
|
|
|
{
|
|
|
|
this->progressBar->setValue(progress);
|
|
|
|
}
|
2011-11-09 06:48:07 +04:00
|
|
|
|
|
|
|
int ProgressWidget::value() const
|
|
|
|
{
|
|
|
|
return this->progressBar->value();
|
|
|
|
}
|