full-featured moving and deleting from the queue completed

This commit is contained in:
leca 2025-05-23 21:58:47 +03:00
parent c21166fc5b
commit 84261d20e5
11 changed files with 340 additions and 336 deletions

View File

@ -96,7 +96,7 @@ set(PROJECT_SOURCES
settings/settings.h settings/settings.cpp
widgets/checklistviewwidget.h widgets/checklistviewwidget.cpp
widgets/outputcolumn.h widgets/outputcolumn.cpp
widgets/outputcolumnmodel.h widgets/outputcolumnmodel.cpp

View File

@ -16,7 +16,6 @@
#include <net/net.h>
#include <utils/utils.h>
#include <exceptions/ofdrequestexception.h>
#include <checklistviewwidget.h>
#ifdef BUILD_OFD_BINARYEYE_SCAN
# include <qrencode.h>
@ -33,17 +32,17 @@ MainWindow::MainWindow(QWidget *parent)
ui->setupUi(this);
ui->stop_server_button->hide();
ui->checks_to_parse_label->hide();
ui->checkQueueTable->hide();
ui->deleteSelectedButton->hide();
ui->parse_button->hide();
model = new CheckQueueTableModel(&checks, this);
ui->checkQueueTable->setModel(model);
ui->checkQueueTable->viewport()->setAcceptDrops(true);
ui->checkQueueTable->setDragDropMode(QAbstractItemView::DragDrop);
// ui->
// connect(this, &MainWindow::deleteCheckFromList, this, &MainWindow::deleteCheckFromListHandler);
ui->checkQueueTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
#ifdef BUILD_OFD_BINARYEYE_SCAN
QObject::connect(this, &MainWindow::httpErrorOccured, this, &MainWindow::notifyHttpServerFailure);
@ -139,7 +138,6 @@ void MainWindow::httpNewMessageHandler(QString message) {
emit onDataDecode(paramsMap);
}
#endif //ifdef BUILD_OFD_BINARYEYE_SCAN
#ifdef BUILD_OFD_LOCAL_QR_SCAN
@ -195,7 +193,6 @@ void MainWindow::on_parse_email_button_clicked() {
return;
}
#endif // ifdef BUILD_EMAIL_MODE
void MainWindow::on_parse_button_clicked() {
@ -213,30 +210,6 @@ void MainWindow::on_parse_button_clicked() {
d.exec();
}
// void MainWindow::deleteCheckFromListHandler(Check &check) {
// for (unsigned int i = 0; i < ui->scrollAreaWidgetContents->layout()->count(); i ++) {
// QLayoutItem *item = ui->scrollAreaWidgetContents->layout()->itemAt(i);
// QObject *child = item->widget();
// CheckListViewWidget *c = (CheckListViewWidget *)child;
// if (c->get_check() == check) {
// ui->scrollAreaWidgetContents->layout()->removeItem(item);
// delete item;
// delete child;
// ui->scrollAreaWidgetContents->layout()->update();
// ui->scrollAreaWidgetContents->update();
// }
// }
// int position = std::find(checks.begin(), checks.end(), check) - checks.begin() - 1;
// checks.erase(checks.begin() + position);
// if (ui->scrollAreaWidgetContents->layout()->count() == 0) {
// ui->checks_to_parse_label->hide();
// ui->checks_scroll_area->hide();
// }
// }
void MainWindow::on_add_new_check_button_clicked() {
Check *new_check = new Check();/* parse_new_check();
if (new_check == nullptr) {
@ -257,6 +230,8 @@ void MainWindow::on_add_new_check_button_clicked() {
if (checks.size() > 0) {
ui->checkQueueTable->show();
ui->checks_to_parse_label->show();
ui->deleteSelectedButton->show();
ui->parse_button->show();
}
}
@ -321,3 +296,24 @@ Check *MainWindow::parse_new_check() {
MainWindow::~MainWindow() {
delete ui;
}
void MainWindow::on_deleteSelectedButton_clicked() {
QItemSelectionModel *select = ui->checkQueueTable->selectionModel();
std::vector<unsigned int> to_delete_positions = {};
for (auto &row : select->selectedIndexes()) {
if (row.column() != 0) continue;
to_delete_positions.push_back(row.row());
// model->removeRows(row.row(), 1);
// checks.erase(std::next(checks.begin() + row.row()));
// std::cout << row.data().toString().toStdString() << std::endl;
}
std::sort(to_delete_positions.begin(), to_delete_positions.end(), std::greater<unsigned int>());
for (unsigned int position : to_delete_positions) {
model->removeRows(position, 1);
// checks.erase(checks.begin() + position);
// emit model->dataChanged(model->index(position, 0), model->index(position, 1));
}
emit model->dataChanged(model->index(checks.size(), 0), model->index(checks.size() + to_delete_positions.size(), 1));
ui->checkQueueTable->clearSelection();
}

View File

@ -55,6 +55,9 @@ private slots:
void on_parse_email_button_clicked();
#endif
void on_add_new_check_button_clicked();
void on_deleteSelectedButton_clicked();
private:
Ui::MainWindow *ui;
std::vector<Check> checks;

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1269</width>
<height>490</height>
<width>987</width>
<height>426</height>
</rect>
</property>
<property name="sizePolicy">
@ -26,26 +26,23 @@
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="5">
<widget class="QLabel" name="checks_to_parse_label">
<property name="text">
<string>Checks to parse</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
<item row="8" column="2" colspan="4">
<widget class="QDoubleSpinBox" name="total_spin_box">
<property name="maximum">
<double>4294967296.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="parse_email_button">
<item row="10" column="2" colspan="4">
<widget class="QPushButton" name="add_new_check_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Parse an E-Mail</string>
<string>Add to queue</string>
</property>
</widget>
</item>
@ -62,53 +59,7 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="choose_image_button">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Choose image on your PC</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="datetime_label">
<property name="text">
<string>Date and time of purchase</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="or_label_1">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>or</string>
</property>
</widget>
</item>
<item row="9" column="4">
<widget class="QPushButton" name="parse_button">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Parse</string>
</property>
</widget>
</item>
<item row="7" column="2" colspan="3">
<item row="7" column="2" colspan="4">
<widget class="QComboBox" name="operation_type_combo_box">
<item>
<property name="text">
@ -132,7 +83,7 @@
</item>
</widget>
</item>
<item row="0" column="4">
<item row="0" column="5">
<widget class="QPushButton" name="stop_server_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@ -145,8 +96,60 @@
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QPushButton" name="binary_eye_button">
<item row="5" column="2" colspan="4">
<widget class="QLineEdit" name="fi_line_edit"/>
</item>
<item row="6" column="0">
<widget class="QLabel" name="datetime_label">
<property name="text">
<string>Date and time of purchase</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QLabel" name="or_label_1">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>or</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" column="2" colspan="4">
<widget class="QLineEdit" name="fd_line_edit"/>
</item>
<item row="2" column="0" colspan="6">
<widget class="QLabel" name="info_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="7">
<widget class="QLabel" name="checks_to_parse_label">
<property name="text">
<string>Checks to parse</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
<item row="10" column="7" colspan="2">
<widget class="QPushButton" name="parse_button">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -154,44 +157,89 @@
</sizepolicy>
</property>
<property name="text">
<string>Use your phone as a QR code scanner</string>
<string>Parse queue</string>
</property>
</widget>
</item>
<item row="4" column="2" colspan="3">
<widget class="QLineEdit" name="fd_line_edit"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="fn_label">
<item row="1" column="4">
<widget class="QLabel" name="or_label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>FN (Fiscal Number)</string>
<string>or</string>
</property>
</widget>
</item>
<item row="5" column="2" colspan="3">
<widget class="QLineEdit" name="fi_line_edit"/>
</item>
<item row="7" column="0">
<widget class="QLabel" name="operation_type_label">
<item row="1" column="0">
<widget class="QPushButton" name="choose_image_button">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Operation type</string>
<string>QR image</string>
</property>
</widget>
</item>
<item row="8" column="2" colspan="3">
<widget class="QDoubleSpinBox" name="total_spin_box">
<property name="maximum">
<double>4294967296.000000000000000</double>
<item row="3" column="2" colspan="4">
<widget class="QLineEdit" name="fn_line_edit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="5" rowspan="9">
<item row="1" column="5">
<widget class="QPushButton" name="binary_eye_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Scan QR using phone</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="settings_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Settings</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QPushButton" name="clear_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Clear data</string>
</property>
</widget>
</item>
<item row="1" column="7" rowspan="8" colspan="2">
<widget class="QTableView" name="checkQueueTable">
<property name="editTriggers">
<set>QAbstractItemView::EditTrigger::DoubleClicked|QAbstractItemView::EditTrigger::EditKeyPressed</set>
@ -222,16 +270,19 @@
</property>
</widget>
</item>
<item row="2" column="0" colspan="5">
<widget class="QLabel" name="info_label">
<item row="6" column="2" colspan="4">
<widget class="QDateTimeEdit" name="purchase_datetime_edit"/>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="parse_email_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
<string>Parse an E-Mail</string>
</property>
</widget>
</item>
@ -242,9 +293,6 @@
</property>
</widget>
</item>
<item row="6" column="2" colspan="3">
<widget class="QDateTimeEdit" name="purchase_datetime_edit"/>
</item>
<item row="8" column="0">
<widget class="QLabel" name="total_label">
<property name="text">
@ -252,67 +300,48 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="settings_button">
<item row="7" column="0">
<widget class="QLabel" name="operation_type_label">
<property name="text">
<string>Operation type</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="fn_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Settings</string>
<string>FN (Fiscal Number)</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="or_label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item row="0" column="8">
<widget class="QPushButton" name="deleteSelectedButton">
<property name="text">
<string>or</string>
<string>Delete selected</string>
</property>
</widget>
</item>
<item row="3" column="2" colspan="3">
<widget class="QLineEdit" name="fn_line_edit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<item row="1" column="6">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QPushButton" name="clear_button">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<property name="sizeType">
<enum>QSizePolicy::Policy::MinimumExpanding</enum>
</property>
<property name="text">
<string>Clear</string>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</widget>
</item>
<item row="9" column="1" colspan="3">
<widget class="QPushButton" name="add_new_check_button">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Add new check</string>
</property>
</widget>
</spacer>
</item>
</layout>
</widget>

View File

@ -70,9 +70,8 @@
<translation type="vanished">Store type</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="107"/>
<source>Parse</source>
<translation>Parse</translation>
<translation type="vanished">Parse</translation>
</message>
<message>
<source>Preferences</source>
@ -113,13 +112,13 @@
<translation type="vanished">0000000000000000</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="173"/>
<location filename="../scenes/mainwindow.ui" line="319"/>
<source>FN (Fiscal Number)</source>
<translatorcomment>FN = Фискальный Номер</translatorcomment>
<translation>FN (Fiscal Number)</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="61"/>
<location filename="../scenes/mainwindow.ui" line="58"/>
<source>FD (Fiscal Document)</source>
<translatorcomment>FD = Фискальный Документ</translatorcomment>
<translation>FD (Fiscal Document)</translation>
@ -133,93 +132,119 @@
<translation type="obsolete">Back</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="144"/>
<location filename="../scenes/mainwindow.ui" line="95"/>
<source>Stop server</source>
<translation>Stop server</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="74"/>
<source>Choose image on your PC</source>
<translation>Choose image on your PC</translation>
<translation type="vanished">Choose image on your PC</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="94"/>
<location filename="../scenes/mainwindow.ui" line="277"/>
<location filename="../scenes/mainwindow.ui" line="118"/>
<location filename="../scenes/mainwindow.ui" line="173"/>
<source>or</source>
<translation>or</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="157"/>
<source>Use your phone as a QR code scanner</source>
<translation>Use your phone as a QR code scanner</translation>
<translation type="vanished">Use your phone as a QR code scanner</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="241"/>
<location filename="../scenes/mainwindow.ui" line="292"/>
<source>FI (Fiscal Identifier)</source>
<translatorcomment>FI = Фискальный Признак</translatorcomment>
<translation>FI (Fiscal Identifier)</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="313"/>
<location filename="../scenes/mainwindow.ui" line="326"/>
<source>Delete selected</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Add new check</source>
<translation>Add new check</translation>
<translation type="vanished">Add new check</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="300"/>
<source>Clear</source>
<translation>Clear</translation>
<translation type="vanished">Clear</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="81"/>
<location filename="../scenes/mainwindow.ui" line="105"/>
<source>Date and time of purchase</source>
<translation>Date and time of purchase</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="183"/>
<location filename="../scenes/mainwindow.ui" line="306"/>
<source>Operation type</source>
<translation>Operation type</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="48"/>
<location filename="../scenes/mainwindow.ui" line="285"/>
<source>Parse an E-Mail</source>
<translation>Parse an E-Mail</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="115"/>
<location filename="../scenes/mainwindow.ui" line="45"/>
<source>Add to queue</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="66"/>
<source>Funds income</source>
<translatorcomment>Приход средств</translatorcomment>
<translation>Funds income</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="120"/>
<location filename="../scenes/mainwindow.ui" line="71"/>
<source>Funds return</source>
<translatorcomment>Возврат средств</translatorcomment>
<translation>Funds return</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="125"/>
<location filename="../scenes/mainwindow.ui" line="76"/>
<source>Funds spend</source>
<translatorcomment>Расход средств</translatorcomment>
<translation>Funds spend</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="130"/>
<location filename="../scenes/mainwindow.ui" line="81"/>
<source>Spends return</source>
<translatorcomment>Возврат расхода</translatorcomment>
<translation>Spends return</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="32"/>
<location filename="../scenes/mainwindow.ui" line="144"/>
<source>Checks to parse</source>
<translation>Checks to parse</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="264"/>
<location filename="../scenes/mainwindow.ui" line="160"/>
<source>Parse queue</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="186"/>
<source>QR image</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="212"/>
<source>Scan QR using phone</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="225"/>
<source>Settings</source>
<translation>Settings</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="251"/>
<location filename="../scenes/mainwindow.ui" line="238"/>
<source>Clear data</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="299"/>
<source>Total</source>
<translation>Total</translation>
</message>
@ -228,77 +253,77 @@
<translation type="vanished">checks parser</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="105"/>
<location filename="../mainwindow.cpp" line="104"/>
<source>QR code for binaryeye to connect</source>
<translation>QR code for binaryeye to connect</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="106"/>
<location filename="../mainwindow.cpp" line="105"/>
<source>I&apos;ve scanned</source>
<translation>I&apos;ve scanned</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="112"/>
<location filename="../mainwindow.cpp" line="111"/>
<source>Could not start http server. 10 times in a row random port was occupied. Either you should run for a lottery ticket, or the problem is in the program. If the lottery ticket wasn&apos;t lucky, please, contact the developer.</source>
<translation>Could not start http server. 10 times in a row random port was occupied. Either you should run for a lottery ticket, or the problem is in the program. If the lottery ticket wasn&apos;t lucky, please, contact the developer.</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="114"/>
<location filename="../mainwindow.cpp" line="113"/>
<source>Could not start http server.</source>
<translation>Could not start http server.</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="158"/>
<location filename="../mainwindow.cpp" line="156"/>
<source>Selected image: </source>
<translation>Selected image: </translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="191"/>
<location filename="../mainwindow.cpp" line="189"/>
<source>This feature is under development. Wait it to appear in next updates.</source>
<translation>This feature is under development. Wait for it to appear in next updates.</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="193"/>
<location filename="../mainwindow.cpp" line="191"/>
<source>Under development</source>
<translation>Under development</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="205"/>
<location filename="../mainwindow.cpp" line="202"/>
<source>Please, add check(s) to parse</source>
<translation>Please, add check(s) to parse</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="207"/>
<location filename="../mainwindow.cpp" line="204"/>
<source>No checks to parse</source>
<translation>No checks to parse</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="296"/>
<location filename="../mainwindow.cpp" line="271"/>
<source>Captcha was not solved correctly!</source>
<translation>Captcha was not solved correctly!</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="298"/>
<location filename="../mainwindow.cpp" line="273"/>
<source>Captcha is incorrect</source>
<translation>Captcha is incorrect</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="303"/>
<location filename="../mainwindow.cpp" line="278"/>
<source>Internal server error. Please, try again later.</source>
<translation>Internal server error. Please, try again later.</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="305"/>
<location filename="../mainwindow.cpp" line="280"/>
<source>Internal server error</source>
<translation>Internal server error</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="310"/>
<location filename="../mainwindow.cpp" line="285"/>
<source>Check not found. Please, ensure correctness of entered data.</source>
<translation>Check not found. Please, ensure correctness of entered data.</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="312"/>
<location filename="../mainwindow.cpp" line="287"/>
<source>Check was not found</source>
<translation>Check was not found</translation>
</message>
@ -311,12 +336,12 @@
<translation type="vanished">Error in parsing</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="151"/>
<location filename="../mainwindow.cpp" line="149"/>
<source>Please, select a picture where QR code that contains info about check is present</source>
<translation>Please, select a picture where QR code that contains info about check is present</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="153"/>
<location filename="../mainwindow.cpp" line="151"/>
<source>Picture was not selected</source>
<translation>Picture was not selected</translation>
</message>

View File

@ -70,9 +70,8 @@
<translation type="vanished">Магазин</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="107"/>
<source>Parse</source>
<translation>Парсить</translation>
<translation type="vanished">Парсить</translation>
</message>
<message>
<source>Preferences</source>
@ -113,13 +112,13 @@
<translation type="vanished">0000000000000000</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="173"/>
<location filename="../scenes/mainwindow.ui" line="319"/>
<source>FN (Fiscal Number)</source>
<translatorcomment>Фискальный Норма</translatorcomment>
<translation>ФН</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="61"/>
<location filename="../scenes/mainwindow.ui" line="58"/>
<source>FD (Fiscal Document)</source>
<translatorcomment>Фискальный Документ</translatorcomment>
<translation>ФД</translation>
@ -133,89 +132,107 @@
<translation type="obsolete">Назад</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="144"/>
<location filename="../scenes/mainwindow.ui" line="95"/>
<source>Stop server</source>
<translation>Остановить сервер</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="74"/>
<source>Choose image on your PC</source>
<translation>Выбрать изображение на компьютере</translation>
<translation type="vanished">Выбрать изображение на компьютере</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="94"/>
<location filename="../scenes/mainwindow.ui" line="277"/>
<location filename="../scenes/mainwindow.ui" line="118"/>
<location filename="../scenes/mainwindow.ui" line="173"/>
<source>or</source>
<translation>или</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="157"/>
<source>Use your phone as a QR code scanner</source>
<translation>Использовать телефон как сканнер QR</translation>
<translation type="vanished">Использовать телефон как сканнер QR</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="241"/>
<location filename="../scenes/mainwindow.ui" line="292"/>
<source>FI (Fiscal Identifier)</source>
<translatorcomment>Фискальный Признак</translatorcomment>
<translation>ФП</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="313"/>
<source>Add new check</source>
<location filename="../scenes/mainwindow.ui" line="326"/>
<source>Delete selected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="300"/>
<source>Clear</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="81"/>
<location filename="../scenes/mainwindow.ui" line="105"/>
<source>Date and time of purchase</source>
<translation>Дата и время покупки</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="183"/>
<location filename="../scenes/mainwindow.ui" line="306"/>
<source>Operation type</source>
<translation>Тип операции</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="48"/>
<location filename="../scenes/mainwindow.ui" line="285"/>
<source>Parse an E-Mail</source>
<translation>Парсить E-Mail</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="115"/>
<location filename="../scenes/mainwindow.ui" line="45"/>
<source>Add to queue</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="66"/>
<source>Funds income</source>
<translation>Приход средств</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="120"/>
<location filename="../scenes/mainwindow.ui" line="71"/>
<source>Funds return</source>
<translation>Возврат средств</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="125"/>
<location filename="../scenes/mainwindow.ui" line="76"/>
<source>Funds spend</source>
<translation>Расход средств</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="130"/>
<location filename="../scenes/mainwindow.ui" line="81"/>
<source>Spends return</source>
<translation>Возврат расхода</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="32"/>
<location filename="../scenes/mainwindow.ui" line="144"/>
<source>Checks to parse</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="264"/>
<location filename="../scenes/mainwindow.ui" line="160"/>
<source>Parse queue</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="186"/>
<source>QR image</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="212"/>
<source>Scan QR using phone</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="225"/>
<source>Settings</source>
<translation>Настройки</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="251"/>
<location filename="../scenes/mainwindow.ui" line="238"/>
<source>Clear data</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="299"/>
<source>Total</source>
<translation>Итого</translation>
</message>
@ -224,77 +241,77 @@
<translation type="vanished">Парсер чеков</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="105"/>
<location filename="../mainwindow.cpp" line="104"/>
<source>QR code for binaryeye to connect</source>
<translation>QR код для подключения BinaryEye</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="106"/>
<location filename="../mainwindow.cpp" line="105"/>
<source>I&apos;ve scanned</source>
<translation>Просканировал</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="112"/>
<location filename="../mainwindow.cpp" line="111"/>
<source>Could not start http server. 10 times in a row random port was occupied. Either you should run for a lottery ticket, or the problem is in the program. If the lottery ticket wasn&apos;t lucky, please, contact the developer.</source>
<translation>Не смог поднять HTTP сервер. 10 раз подряд случайно выбранный порт был занят. Либо Вам следует бежать за лоттерейным билетом, или в программе баг. Если лотерейный билет не был выигрышным, пожалуйста, сообщите разработчику.</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="114"/>
<location filename="../mainwindow.cpp" line="113"/>
<source>Could not start http server.</source>
<translation>Не получилось запустить HTTP сервер.</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="158"/>
<location filename="../mainwindow.cpp" line="156"/>
<source>Selected image: </source>
<translation>Выбранное изображение: </translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="191"/>
<location filename="../mainwindow.cpp" line="189"/>
<source>This feature is under development. Wait it to appear in next updates.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="193"/>
<location filename="../mainwindow.cpp" line="191"/>
<source>Under development</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="205"/>
<location filename="../mainwindow.cpp" line="202"/>
<source>Please, add check(s) to parse</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="207"/>
<location filename="../mainwindow.cpp" line="204"/>
<source>No checks to parse</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="296"/>
<location filename="../mainwindow.cpp" line="271"/>
<source>Captcha was not solved correctly!</source>
<translation>Капча была решена неверно!</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="298"/>
<location filename="../mainwindow.cpp" line="273"/>
<source>Captcha is incorrect</source>
<translation>Капча введена неверно</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="303"/>
<location filename="../mainwindow.cpp" line="278"/>
<source>Internal server error. Please, try again later.</source>
<translation>Внутренняя ошибка сервера. Пожалуйста, попробуйте снова позже.</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="305"/>
<location filename="../mainwindow.cpp" line="280"/>
<source>Internal server error</source>
<translation>Внутренняя ошибка сервера</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="310"/>
<location filename="../mainwindow.cpp" line="285"/>
<source>Check not found. Please, ensure correctness of entered data.</source>
<translation>Чек не найден. Пожалуйста, убедитесь в правильности введённых данных.</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="312"/>
<location filename="../mainwindow.cpp" line="287"/>
<source>Check was not found</source>
<translation>Чек не найден</translation>
</message>
@ -307,12 +324,12 @@
<translation type="vanished">Ошибка в парсинге</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="151"/>
<location filename="../mainwindow.cpp" line="149"/>
<source>Please, select a picture where QR code that contains info about check is present</source>
<translation>Пожалуйста, выберете изображение, содержащее QR код с информацией о чеке</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="153"/>
<location filename="../mainwindow.cpp" line="151"/>
<source>Picture was not selected</source>
<translation>Изображение не было выбрано</translation>
</message>

View File

@ -1,34 +0,0 @@
#include "checklistviewwidget.h"
#include <QHBoxLayout>
#include <QLabel>
#include <QPushButton>
#include <check/check.h>
#include <iostream>
CheckListViewWidget::CheckListViewWidget(QWidget *parent, Check check) : QWidget(parent), check(check) {
mw = (MainWindow*) parent;
QHBoxLayout *layout = new QHBoxLayout;
QLabel *date_label = new QLabel(QString::fromStdString(check.get_date()));
QLabel *summ_label = new QLabel(QString::number(check.get_total()));
QPushButton *deleteButton = new QPushButton(tr("Delete"));
deleteButton->connect(deleteButton, &QPushButton::clicked, this, &CheckListViewWidget::delete_button_pressed);
layout->addWidget(date_label);
layout->addWidget(summ_label);
layout->addSpacing(10);
layout->addWidget(deleteButton);
setLayout(layout);
}
Check &CheckListViewWidget::get_check(){
return check;
}
void CheckListViewWidget::delete_button_pressed() {
emit mw->deleteCheckFromList(this->check);
}

View File

@ -1,24 +0,0 @@
#ifndef CHECKLISTVIEWWIDGET_H
#define CHECKLISTVIEWWIDGET_H
#include <QObject>
#include <QWidget>
#include <mainwindow.h>
#include <check/check.h>
class CheckListViewWidget : public QWidget
{
Q_OBJECT
Check check;
MainWindow* mw;
public:
explicit CheckListViewWidget(QWidget *parent = nullptr, Check check = Check());
Check &get_check();
void delete_button_pressed();
signals:
Check deleteButtonPressed();
};
#endif // CHECKLISTVIEWWIDGET_H

View File

@ -8,7 +8,7 @@ CheckQueueTableModel::CheckQueueTableModel(std::vector<Check> *checks, QObject *
{}
int CheckQueueTableModel::rowCount(const QModelIndex &parent) const { return checks->size(); }
int CheckQueueTableModel::columnCount(const QModelIndex &parent) const { return 3; }
int CheckQueueTableModel::columnCount(const QModelIndex &parent) const { return 2; }
QVariant CheckQueueTableModel::data(const QModelIndex &index, int role) const {
if (!index.isValid() || index.row() >= checks->size())
@ -22,9 +22,6 @@ QVariant CheckQueueTableModel::data(const QModelIndex &index, int role) const {
case 1:
return QVariant::fromValue(c.get_total());
break;
case 2:
return QVariant::fromValue(QString("кнопка"));
break;
}
return QVariant();
@ -32,7 +29,7 @@ QVariant CheckQueueTableModel::data(const QModelIndex &index, int role) const {
bool CheckQueueTableModel::setData(const QModelIndex &index, const QVariant &value, int role) {
if (role == Qt::EditRole) {
if (!checkIndex(index))
if (!index.isValid() || index.row() >= checks->size())
return false;
unsigned int row = index.row();
switch (index.column()) {
@ -42,9 +39,6 @@ bool CheckQueueTableModel::setData(const QModelIndex &index, const QVariant &val
} case 1:
checks->at(row).set_total(value.value<double>());
break;
case 2:
// delete Button
break;
}
return true;
}
@ -60,10 +54,9 @@ QVariant CheckQueueTableModel::headerData(int section, Qt::Orientation orientati
case 1:
return tr("Total");
break;
case 2:
return tr("Delete button");
break;
}
} else if (role == Qt::DisplayRole && orientation == Qt::Vertical) {
return section + 1;
}
return QVariant();
}
@ -85,7 +78,6 @@ Qt::DropActions CheckQueueTableModel::supportedDropActions() const {
bool CheckQueueTableModel::insertRows(int position, int rows, const QModelIndex &index) {
beginInsertRows(QModelIndex(), position, position+rows-1);
for (int i = 0; i < rows; ++i)
checks->emplace(checks->begin() + position, Check());
@ -109,9 +101,10 @@ QStringList CheckQueueTableModel::mimeTypes() const {
return types;
}
bool CheckQueueTableModel::canDropMimeData(const QMimeData *data, Qt::DropAction action, int, int, const QModelIndex &) {
bool CheckQueueTableModel::canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int, const QModelIndex &) {
if (action != Qt::MoveAction || !data->hasFormat(CheckQueueTableModel::MimeType))
return false;
if (row > checks->size()) return false;
return true;
}
@ -133,12 +126,11 @@ QMimeData* CheckQueueTableModel::mimeData(const QModelIndexList &indexes) const
}
bool CheckQueueTableModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) {
if (!canDropMimeData(data, action, row, column, parent))
return false;
if (action == Qt::IgnoreAction)
return true;
else if (action != Qt::MoveAction)
return false;
if (!canDropMimeData(data, action, row, column, parent)) return false;
if (action == Qt::IgnoreAction) return true;
else if (action != Qt::MoveAction) return false;
if (row > checks->size()) return false;
QByteArray encodedData = data->data(CheckQueueTableModel::MimeType);
QDataStream stream(&encodedData, QIODevice::ReadOnly);
std::vector<Check> newItems;
@ -156,6 +148,7 @@ bool CheckQueueTableModel::dropMimeData(const QMimeData *data, Qt::DropAction ac
}
insertRows(row, rows, QModelIndex());
for (Check &c : newItems) {
QModelIndex date_index = index(row, 0, QModelIndex());
QModelIndex total_index = index(row, 1, QModelIndex());
@ -164,5 +157,6 @@ bool CheckQueueTableModel::dropMimeData(const QMimeData *data, Qt::DropAction ac
row++;
}
return true;
}

View File

@ -132,8 +132,7 @@ bool OutputColumnModel::dropMimeData(const QMimeData *data, Qt::DropAction actio
}
insertRows(row, rows, QModelIndex());
for (const OutputColumn &column : newItems)
{
for (const OutputColumn &column : newItems) {
QModelIndex idx = index(row, 0, QModelIndex());
setData(idx, QVariant::fromValue(column), 0x102);
row++;
@ -141,4 +140,3 @@ bool OutputColumnModel::dropMimeData(const QMimeData *data, Qt::DropAction actio
return true;
}

View File

@ -30,8 +30,8 @@ public:
// QStringList mimeTypes() const override;
bool canDropMimeData(const QMimeData *, Qt::DropAction, int, int, const QModelIndex&);
QMimeData* mimeData(const QModelIndexList &indexes) const;
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
QMimeData* mimeData(const QModelIndexList &indexes) const override;
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override;
};
#endif // OUTPUTCOLUMNMODEL_H