8 #include "BaseScannerWidget.h"
9 #include "ModifyDialog.h"
10 #include "ListModel.h"
11 #include "ResultWidget.h"
12 #include "AddDialog.h"
15 using namespace freeRecite
;
17 BaseScannerWidget::BaseScannerWidget(QWidget
*parent
)
18 :QWidget(parent
),scanner(0),resultWidget(0),
19 startTime(0),listModel(0)
24 BaseScannerWidget::~BaseScannerWidget() {
27 if(qobject_cast
<QObject
*>(resultWidget
) != 0)
28 resultWidget
->deleteLater();
29 D_OUTPUT("~BaseScannerWidget()")
32 void BaseScannerWidget::add() {
33 QString word
= AddDialog::getString(this,tr("Getting New Word"));
36 scanner
->add(word
.toStdString());
38 Speaker::play("fail");
42 void BaseScannerWidget::remove(){
43 Speaker::play("remove");
44 scanner
->remove(scanner
->getWord());
49 void BaseScannerWidget::modify(){
51 if(dictionary
.lookUp(scanner
->getWord())) {
52 word
= ModifyDialog::getDicItmeString(dictionary
.word(),
53 dictionary
.rawPhonetics(),
54 dictionary
.translation(),
57 } else { //Can't find the word in dictionary.
58 word
= ModifyDialog::getDicItmeString(scanner
->getWord(),
64 if(dictionary
.modify(word
.toUtf8().constData())) {
67 QMessageBox::information(this,tr("Modify Information"),
68 tr("The dictionary has been modified!"));
70 Speaker::play("fail");
71 QMessageBox::warning(this,tr("Modify Information"),
72 tr("The dictionary Can Not be modified!"));