diff --git a/application/main.cpp b/application/main.cpp index 6b68e87..7712bbc 100644 --- a/application/main.cpp +++ b/application/main.cpp @@ -19,7 +19,7 @@ int main(int argc, char *argv[]) MainWindow w; w.move(QApplication::desktop()->screen()->rect().center() - w.rect().center()); - w.show(); + w.showMaximized(); return a.exec(); } diff --git a/shop/paydialog.cpp b/shop/paydialog.cpp index e272503..7e61370 100644 --- a/shop/paydialog.cpp +++ b/shop/paydialog.cpp @@ -1,5 +1,6 @@ #include "paydialog.h" #include "ui_paydialog.h" +#include "shopservice.h" PayDialog::PayDialog(QDecDouble total, QWidget *parent) : QDialog(parent), @@ -10,6 +11,10 @@ PayDialog::PayDialog(QDecDouble total, QWidget *parent) : ui->labelTotal->setText(QString::number(total.toDouble(), 'f', 2)); ui->labelReturn->setText(QString::number(0, 'f', 2)); + ui->recieved->setFocus(); + + ShopService srv; + ui->checkEet->setVisible(srv.isEetEnabled()); } PayDialog::~PayDialog() @@ -17,6 +22,11 @@ PayDialog::~PayDialog() delete ui; } +bool PayDialog::sendToEet() +{ + return ui->checkEet->checkState() == Qt::Checked; +} + void PayDialog::on_recieved_valueChanged(double value) { diff --git a/shop/paydialog.h b/shop/paydialog.h index 55d81cb..fba7df2 100644 --- a/shop/paydialog.h +++ b/shop/paydialog.h @@ -15,6 +15,7 @@ class PayDialog : public QDialog public: explicit PayDialog(QDecDouble total, QWidget *parent = 0); ~PayDialog(); + bool sendToEet(); private slots: diff --git a/shop/paydialog.ui b/shop/paydialog.ui index fd9d4a2..25db67f 100644 --- a/shop/paydialog.ui +++ b/shop/paydialog.ui @@ -6,8 +6,8 @@ 0 0 - 449 - 134 + 457 + 168 @@ -105,7 +105,7 @@ - + false @@ -118,6 +118,19 @@ + + + + Send to EET portal + + + true + + + true + + + diff --git a/shop/shopform.cpp b/shop/shopform.cpp index 5a2b756..e998652 100644 --- a/shop/shopform.cpp +++ b/shop/shopform.cpp @@ -78,6 +78,16 @@ void ShopForm::loadLast() m_commodityModel->setData(srv.allSellableItems()); ui->commodityTable->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch); ui->commodityTable->setColumnHidden(3, true); + + if (srv.isEetEnabled()) + { + ui->lblEetState->setText(srv.isEetOnline() ? tr("Online") : tr("Offline")); + } + else + { + ui->labelEete->setVisible(false); + ui->lblEetState->setVisible(false); + } } void ShopForm::fillRaceiptCombo() @@ -320,12 +330,12 @@ void ShopForm::on_payButton_clicked() dialog->setAttribute(Qt::WA_DeleteOnClose); dialog->show(); - connect(dialog, &QDialog::accepted, [this](){ + connect(dialog, &QDialog::accepted, [this, dialog](){ ShopService srv; srv.pay(m_voucher); QString eetMsg; - if (srv.isEetEnabled()) + if (srv.isEetEnabled() && dialog->sendToEet()) { bool eetRet = srv.processEet(m_voucher, eetMsg); @@ -343,6 +353,7 @@ void ShopForm::on_payButton_clicked() if (srv.isEetOnline() && QMessageBox::question(this, tr("EET error"), errMsg) == QMessageBox::Yes) { srv.setEetOnline(false); + ui->lblEetState->setText(srv.isEetOnline() ? tr("Online") : tr("Offline")); } } } @@ -403,3 +414,11 @@ void ShopForm::on_commoditySearch_textChanged(const QString &text) } } } + +void ShopForm::on_lblEetState_linkActivated(const QString &link) +{ + ShopService srv; + srv.setEetOnline(!srv.isEetOnline()); + + ui->lblEetState->setText(srv.isEetOnline() ? tr("Online") : tr("Offline")); +} diff --git a/shop/shopform.h b/shop/shopform.h index d26d4ff..dee98dd 100644 --- a/shop/shopform.h +++ b/shop/shopform.h @@ -44,6 +44,8 @@ private slots: void on_commoditySearch_textChanged(const QString &text); + void on_lblEetState_linkActivated(const QString &link); + private: Ui::ShopForm *ui; QSharedPointer m_voucher; diff --git a/shop/shopform.ui b/shop/shopform.ui index 270547c..ebe21e6 100644 --- a/shop/shopform.ui +++ b/shop/shopform.ui @@ -399,6 +399,35 @@ + + 0 + + + + + EET status: + + + + + + + + 75 + true + + + + PointingHandCursor + + + <a href="#eet">dfghdfg</a> + + + Qt::RichText + + + @@ -571,8 +600,8 @@ - +