Improved EET integration- switch to online/offline mode now possible.

Application starts to maximized window.
This commit is contained in:
2017-02-24 23:19:46 +01:00
parent abed951e1f
commit 9418d739e6
7 changed files with 81 additions and 7 deletions
+21 -2
View File
@@ -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("<a href=\"#eet\">Online</a>") : tr("<a href=\"#eet\">Offline</a>"));
}
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("<a href=\"#eet\">Online</a>") : tr("<a href=\"#eet\">Offline</a>"));
}
}
}
@@ -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("<a href=\"#eet\">Online</a>") : tr("<a href=\"#eet\">Offline</a>"));
}