summaryrefslogtreecommitdiff
path: root/src/ProgressWidget.cc
blob: 7aa6a4acb667dda7109b6751859aa88b6503d021 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "ProgressWidget.h"
#include <QTimer>

ProgressWidget::ProgressWidget(QWidget *parent)
	:QWidget(parent)
{
	setupUi(this);
	setRange(0, 1000);
	setValue(0);
	this->wascanceled = false;
	this->starttime.start();

	connect(this->stopButton, SIGNAL(clicked()), this, SLOT(cancel()));
	QTimer::singleShot(1000, this, SIGNAL(requestShow()));
}

bool ProgressWidget::wasCanceled() const
{
	return this->wascanceled;
}

/*!
	Returns milliseconds since this widget was created
*/
int ProgressWidget::elapsedTime() const
{
	return this->starttime.elapsed();
}

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);
}

int ProgressWidget::value() const
{
	return this->progressBar->value();
}
contact: Jan Huwald // Impressum