update dict
[QFreeRecite.git] / src / gui / ModifyDialog.cpp
blobacacc2388b3380cae01daf752a967d016af2a8f7
1 #include "ModifyDialog.h"
3 QString ModifyDialog::str("");
5 ModifyDialog::ModifyDialog(QWidget *parent)
6 : QDialog(parent)
8 setupUi(this);
11 ModifyDialog::~ModifyDialog()
16 QString ModifyDialog::getDicItmeString(const std::string &defaultWord,
17 const std::string &defaultPhon,
18 const std::string &defaultTran,
19 const std::string &defaultExam,
20 QWidget *parent) {
21 str = "";
22 ModifyDialog *dialog = new ModifyDialog(parent);
23 dialog->setModal(true);
24 dialog->wordLineEdit->setText(defaultWord.c_str());
25 dialog->soundmarkLineEdit->setText(defaultPhon.c_str());
26 dialog->translationTextEdit->setText(QString::fromUtf8(defaultTran.c_str()));
27 dialog->exampleTextEdit->setText(QString::fromUtf8(defaultExam.c_str()));
28 connect(dialog->okButton,SIGNAL(clicked()),
29 dialog,SLOT(Ok()));
30 connect(dialog->cancelButton,SIGNAL(clicked()),
31 dialog,SLOT(Cancel()));
32 dialog->exec();
33 return str;
36 void ModifyDialog::Cancel() {
37 ModifyDialog::str = "";
38 deleteLater();
41 void ModifyDialog::Ok() {
42 QString usage = translationTextEdit->toPlainText();
43 usage.replace("\n","<br />");
45 QString example = exampleTextEdit->toPlainText();
46 example.replace("\n","<br />");
48 ModifyDialog::str = "[W]" + wordLineEdit->text() +
49 "[T]" + soundmarkLineEdit->text() +
50 "[M]" + usage +
51 "[E]" + example;
52 deleteLater();