starting work on export module, added check trimming

This commit is contained in:
2024-08-24 00:45:47 +03:00
parent 2715272ebf
commit ddf906fbbc
16 changed files with 346 additions and 61 deletions

View File

@@ -1,7 +1,8 @@
#include "mainwindow.h"
#include "./ui_mainwindow.h"
#include "goods/goods.h"
#include "check/check.h"
#include "goods/goods.h"
#include "outputdialog.h"
#include "settings.h"
#include <iostream>
@@ -17,6 +18,17 @@ void MainWindow::setupStoresList() {
// Make file format that is a regeeex which parse check, load these files
// here
parser = *(new Parser());
std::vector<std::string> modules_names = parser.search_modules();
for (std::string name : modules_names) {
Module m(name);
std::wstring module_name = m.get_name();
QString s = QString::fromStdWString(module_name);
ui->storeType->addItem(s);
}
#ifdef DEBUG
for (auto module : parser.search_modules()) {
std::cout << "Module: " << module << std::endl;
@@ -42,9 +54,22 @@ void MainWindow::on_parseButton_clicked() {
std::vector<Goods> c = parser.parse(check_plaintext);
if (c.size() == 0) {
std::cerr << "An error has occured. Check was matched incorrectly. Vector sizes are different" << std::endl;
return;
}
Check check;
for (auto g : c) {
check.add_goods(g);
}
OutputDialog *d = new OutputDialog(this, check);
d->exec();
}
void MainWindow::on_storeType_currentIndexChanged(int index) {
std::string module = parser.search_modules()[index];
parser.set_module(module);
}