update dict
[QFreeRecite.git] / src / gui / RReciterWidget.cpp
bloba563340c2b2786f69f5f23db001be2eac865d9dc
1 #include <Reciter.h>
2 #include <ctime>
3 #include "RReciterWidget.h"
4 #include "ResultWidget.h"
6 RReciterWidget::RReciterWidget(QWidget *parent)
7 :RScannerWidget(parent)
8 { /* Do Nothing Here! */ }
10 void RReciterWidget::start(time_t taskID) {
11 freeRecite::Reciter *reciter = new freeRecite::Reciter;
12 reciter->load(taskID);
13 scanner = dynamic_cast<freeRecite::Scanner *>(reciter);
14 topicLabel->setText(tr("Reverse Reciting"));
15 setInfo();
16 showNext();
17 time(&startTime);
20 void RReciterWidget::displayResult() {
21 time_t endTime = 0;
22 time(&endTime);
23 startTime = endTime - startTime;
24 startTime /= 60;
25 startTime = startTime > 1 ? startTime : 1;
28 QString str11,str12,str21,str22,str31,str32,strTail;
29 str11 = tr("Amount: ");
30 str12 = QVariant(scanner->capability()).toString();
31 str21 = tr("Used Time: ");
32 str22 = QVariant(static_cast<unsigned>(startTime)).toString() + tr(" min");
33 str31 = tr("Recite Rate: ");
34 str32 =
35 QVariant(static_cast<float>(scanner->capability())/startTime).toString()
36 + tr(" word/min");
37 strTail = tr("There are ") + QVariant(scanner->getScore()).toString() +
38 tr(" words you have remembered before.");
39 resultWidget = new ResultWidget(this);
40 connect(resultWidget,SIGNAL(confirmed()),this,SIGNAL(finished()));
41 resultWidget->setInfo(str11,str12,str21,str22,str31,str32);
42 resultWidget->setTailer(strTail);
43 emit showResult();