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

Application starts to maximized window.
print
Josef Rokos 8 years ago
parent abed951e1f
commit 9418d739e6

@ -19,7 +19,7 @@ int main(int argc, char *argv[])
MainWindow w; MainWindow w;
w.move(QApplication::desktop()->screen()->rect().center() - w.rect().center()); w.move(QApplication::desktop()->screen()->rect().center() - w.rect().center());
w.show(); w.showMaximized();
return a.exec(); return a.exec();
} }

@ -1,5 +1,6 @@
#include "paydialog.h" #include "paydialog.h"
#include "ui_paydialog.h" #include "ui_paydialog.h"
#include "shopservice.h"
PayDialog::PayDialog(QDecDouble total, QWidget *parent) : PayDialog::PayDialog(QDecDouble total, QWidget *parent) :
QDialog(parent), QDialog(parent),
@ -10,6 +11,10 @@ PayDialog::PayDialog(QDecDouble total, QWidget *parent) :
ui->labelTotal->setText(QString::number(total.toDouble(), 'f', 2)); ui->labelTotal->setText(QString::number(total.toDouble(), 'f', 2));
ui->labelReturn->setText(QString::number(0, 'f', 2)); ui->labelReturn->setText(QString::number(0, 'f', 2));
ui->recieved->setFocus();
ShopService srv;
ui->checkEet->setVisible(srv.isEetEnabled());
} }
PayDialog::~PayDialog() PayDialog::~PayDialog()
@ -17,6 +22,11 @@ PayDialog::~PayDialog()
delete ui; delete ui;
} }
bool PayDialog::sendToEet()
{
return ui->checkEet->checkState() == Qt::Checked;
}
void PayDialog::on_recieved_valueChanged(double value) void PayDialog::on_recieved_valueChanged(double value)
{ {

@ -15,6 +15,7 @@ class PayDialog : public QDialog
public: public:
explicit PayDialog(QDecDouble total, QWidget *parent = 0); explicit PayDialog(QDecDouble total, QWidget *parent = 0);
~PayDialog(); ~PayDialog();
bool sendToEet();
private slots: private slots:

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>449</width> <width>457</width>
<height>134</height> <height>168</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -105,7 +105,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0" colspan="2"> <item row="4" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -118,6 +118,19 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="checkEet">
<property name="text">
<string>Send to EET portal</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<resources/> <resources/>

@ -78,6 +78,16 @@ void ShopForm::loadLast()
m_commodityModel->setData(srv.allSellableItems()); m_commodityModel->setData(srv.allSellableItems());
ui->commodityTable->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch); ui->commodityTable->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch);
ui->commodityTable->setColumnHidden(3, true); 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() void ShopForm::fillRaceiptCombo()
@ -320,12 +330,12 @@ void ShopForm::on_payButton_clicked()
dialog->setAttribute(Qt::WA_DeleteOnClose); dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->show(); dialog->show();
connect(dialog, &QDialog::accepted, [this](){ connect(dialog, &QDialog::accepted, [this, dialog](){
ShopService srv; ShopService srv;
srv.pay(m_voucher); srv.pay(m_voucher);
QString eetMsg; QString eetMsg;
if (srv.isEetEnabled()) if (srv.isEetEnabled() && dialog->sendToEet())
{ {
bool eetRet = srv.processEet(m_voucher, eetMsg); 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) if (srv.isEetOnline() && QMessageBox::question(this, tr("EET error"), errMsg) == QMessageBox::Yes)
{ {
srv.setEetOnline(false); 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>"));
}

@ -44,6 +44,8 @@ private slots:
void on_commoditySearch_textChanged(const QString &text); void on_commoditySearch_textChanged(const QString &text);
void on_lblEetState_linkActivated(const QString &link);
private: private:
Ui::ShopForm *ui; Ui::ShopForm *ui;
QSharedPointer<Voucher> m_voucher; QSharedPointer<Voucher> m_voucher;

@ -399,6 +399,35 @@
<item> <item>
<widget class="QWidget" name="widget_7" native="true"> <widget class="QWidget" name="widget_7" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="labelEete">
<property name="text">
<string>EET status:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblEetState">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>&lt;a href=&quot;#eet&quot;&gt;dfghdfg&lt;/a&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
</widget>
</item>
<item> <item>
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">
@ -571,8 +600,8 @@
</layout> </layout>
</widget> </widget>
<resources> <resources>
<include location="../core/rc.qrc"/>
<include location="shoprc.qrc"/> <include location="shoprc.qrc"/>
<include location="../core/rc.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>

Loading…
Cancel
Save