46 lines
1.2 KiB
C++
46 lines
1.2 KiB
C++
#include "emailtextscene.h"
|
|
#include "ui_emailtextscene.h"
|
|
#include <QMessageBox>
|
|
#include <iostream>
|
|
#include <outputdialog.h>
|
|
#include <check/check.h>
|
|
|
|
EmailTextScene::EmailTextScene(QWidget *parent)
|
|
: QWidget(parent)
|
|
, ui(new Ui::EmailTextScene) {
|
|
ui->setupUi(this);
|
|
|
|
auto modules = parser.get_modules_names();
|
|
|
|
for (auto &module : modules) {
|
|
ui->store_combo_box->addItem(QString::fromStdString(module));
|
|
}
|
|
}
|
|
|
|
EmailTextScene::~EmailTextScene() {
|
|
delete ui;
|
|
}
|
|
|
|
void EmailTextScene::on_parse_button_clicked() {
|
|
std::wstring checkContent = ui->check_content->toPlainText().toStdWString();
|
|
parser.set_module(parser.search_modules()[ui->store_combo_box->currentIndex()]);
|
|
|
|
std::vector<Goods> goods = parser.parse(checkContent);
|
|
if (goods.size() == 0) {
|
|
QMessageBox infoDialog;
|
|
infoDialog.setText(tr("An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer."));
|
|
infoDialog.setIcon(QMessageBox::Critical);
|
|
infoDialog.setWindowTitle(tr("Error in parsing"));
|
|
infoDialog.exec();
|
|
return;
|
|
}
|
|
|
|
Check check;
|
|
check.add_goods(goods);
|
|
|
|
OutputDialog d(this, check);
|
|
d.show();
|
|
d.exec();
|
|
}
|
|
|