3 #include "TesterWidget.h"
4 #include "ResultWidget.h"
6 using freeRecite::manager
;
8 TesterWidget::TesterWidget(QWidget
*parent
)
9 : ScannerWidget(parent
)
10 { /* Do Nothing Here! */ }
12 void TesterWidget::start(time_t taskID
) {
13 freeRecite::Tester
*tester
= new freeRecite::Tester
;
15 scanner
= dynamic_cast<freeRecite::Scanner
*>(tester
);
16 topicLabel
->setText(tr("Testing"));
22 void TesterWidget::displayResult() {
25 startTime
= endTime
- startTime
;
27 startTime
= startTime
> 1 ? startTime
: 1;
29 QString str11
,str12
,str21
,str22
,str31
,str32
;
30 unsigned score
= scanner
->getScore();
31 str11
= tr("Amount: ");
32 str12
= QVariant(scanner
->capability()).toString();
33 str21
= tr("Used Time: ");
34 str22
= QVariant(static_cast<unsigned>(startTime
)).toString() + tr(" min");
35 str31
= tr("Score: ");
36 str32
= QVariant(score
).toString();
38 resultWidget
= new ResultWidget(this);
39 connect(resultWidget
,SIGNAL(confirmed()),this,SIGNAL(finished()));
41 resultWidget
->setInfo(str11
,str12
,str21
,str22
,str31
,str32
);
42 int testResult
= manager
.test(scanner
->id(),scanner
->getScore());
44 resultWidget
->setTailer(tr("You passed it!"));
45 }else if(testResult
== -1){
46 resultWidget
->setTailer(tr("You haven't passed it!"));
47 }else { // testResult == 1
48 resultWidget
->setTailer(tr("You have complished this task!"));