This commit is contained in:
leca 2024-09-01 16:15:00 +03:00
parent f9b0b75062
commit 5c6700f621
5 changed files with 83 additions and 109 deletions

View File

@ -3,16 +3,16 @@
#include "../goods/goods.h" #include "../goods/goods.h"
#include <vector> #include <vector>
class Check class Check {
{
std::vector<Goods> goods; std::vector<Goods> goods;
public: public:
Check(); Check();
void add_goods(Goods); void add_goods(Goods);
double calculae_total_price(); double calculae_total_price();
std::vector<Goods>& get_goods(); std::vector<Goods> &get_goods();
}; };
#endif // CHECK_H #endif // CHECK_H

View File

@ -5,6 +5,7 @@
#include "outputdialog.h" #include "outputdialog.h"
#include "settings.h" #include "settings.h"
#include <iostream> #include <iostream>
#include <QFileDialog>
MainWindow::MainWindow(QWidget *parent) MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow) { : QMainWindow(parent), ui(new Ui::MainWindow) {
@ -35,14 +36,16 @@ void MainWindow::setupStoresList() {
} }
void MainWindow::on_checkType_currentIndexChanged(int index) { void MainWindow::on_checkType_currentIndexChanged(int index) {
switch (index) {
case 0: ui->inputHolder->setCurrentIndex(index);
ui->checkInfoText->setVisible(true); // switch (index) {
break; // case 0:
case 1: // ui->checkInfoText->setVisible(true);
ui->checkInfoText->setVisible(false); // break;
break; // case 1:
} // ui->checkInfoText->setVisible(false);
// break;
// }
} }
void MainWindow::on_parseButton_clicked() { void MainWindow::on_parseButton_clicked() {
@ -72,3 +75,12 @@ void MainWindow::on_storeType_currentIndexChanged(int index) {
std::string module = parser.search_modules()[index]; std::string module = parser.search_modules()[index];
parser.set_module(module); parser.set_module(module);
} }
void MainWindow::on_chooseImageButton_clicked() {
QString filename = QFileDialog::getOpenFileName();
std::cout << filename.toStdString() << std::endl;
// this->options.set_path(filename.toStdString());
ui->pathLabel->setText("Path to export: " + filename);
}

View File

@ -31,6 +31,8 @@ private slots:
void on_storeType_currentIndexChanged(int index); void on_storeType_currentIndexChanged(int index);
void on_chooseImageButton_clicked();
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
}; };

View File

@ -66,115 +66,76 @@
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Image (not yet implemented)</string> <string>Image (OCR)</string>
</property> </property>
</item> </item>
</widget> </widget>
<widget class="QWidget" name="checkInfoText" native="true"> <widget class="QStackedWidget" name="inputHolder">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>10</x>
<y>70</y> <y>80</y>
<width>421</width> <width>501</width>
<height>511</height> <height>471</height>
</rect> </rect>
</property> </property>
<widget class="QLabel" name="checkContentLabel">
<property name="geometry">
<rect>
<x>20</x>
<y>10</y>
<width>121</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string>Check content</string>
</property>
</widget>
<widget class="QPlainTextEdit" name="checkContent">
<property name="geometry">
<rect>
<x>20</x>
<y>40</y>
<width>401</width>
<height>411</height>
</rect>
</property>
<property name="plainText">
<string/>
</property>
</widget>
<widget class="QPushButton" name="parseButton">
<property name="geometry">
<rect>
<x>20</x>
<y>480</y>
<width>80</width>
<height>26</height>
</rect>
</property>
<property name="text">
<string>Parse</string>
</property>
</widget>
</widget>
<widget class="QTabWidget" name="tabWidget">
<property name="geometry">
<rect>
<x>460</x>
<y>270</y>
<width>301</width>
<height>221</height>
</rect>
</property>
<property name="tabPosition">
<enum>QTabWidget::TabPosition::North</enum>
</property>
<property name="tabShape">
<enum>QTabWidget::TabShape::Rounded</enum>
</property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>1</number>
</property> </property>
<property name="elideMode"> <widget class="QWidget" name="page_5">
<enum>Qt::TextElideMode::ElideNone</enum> <widget class="QLabel" name="checkContentLabel">
</property> <property name="geometry">
<property name="documentMode"> <rect>
<bool>true</bool> <x>10</x>
</property> <y>10</y>
<property name="tabsClosable"> <width>101</width>
<bool>false</bool> <height>18</height>
</property> </rect>
<property name="tabBarAutoHide"> </property>
<bool>true</bool> <property name="text">
</property> <string>Check content</string>
<widget class="QWidget" name="tab"> </property>
<attribute name="title"> </widget>
<string>Text</string> <widget class="QPlainTextEdit" name="checkContent">
</attribute> <property name="geometry">
<rect>
<x>10</x>
<y>50</y>
<width>431</width>
<height>401</height>
</rect>
</property>
</widget>
</widget> </widget>
<widget class="QWidget" name="tab_2"> <widget class="QWidget" name="page_6">
<attribute name="title"> <widget class="QLabel" name="pathLabel">
<string>Image</string> <property name="geometry">
</attribute> <rect>
<x>110</x>
<y>20</y>
<width>161</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string>Path to image: </string>
</property>
</widget>
<widget class="QPushButton" name="chooseImageButton">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>80</width>
<height>26</height>
</rect>
</property>
<property name="text">
<string>Choose</string>
</property>
</widget>
</widget> </widget>
</widget> </widget>
<widget class="QStackedWidget" name="stackedWidget">
<property name="geometry">
<rect>
<x>460</x>
<y>60</y>
<width>241</width>
<height>151</height>
</rect>
</property>
<widget class="QWidget" name="page_5"/>
<widget class="QWidget" name="page_6"/>
</widget>
</widget> </widget>
<widget class="QMenuBar" name="menubar"> <widget class="QMenuBar" name="menubar">
<property name="geometry"> <property name="geometry">

View File

@ -102,7 +102,6 @@ void update_settings(OutputOptions &options, ColumnType t, std::string name,
void OutputDialog::on_chooseFileButton_clicked() { void OutputDialog::on_chooseFileButton_clicked() {
QString filename = QFileDialog::getSaveFileName(); QString filename = QFileDialog::getSaveFileName();
std::cout << filename.toStdString() << std::endl;
this->options.set_path(filename.toStdString()); this->options.set_path(filename.toStdString());
ui->pathLabel->setText("Path to export: " + filename); ui->pathLabel->setText("Path to export: " + filename);
} }