diff --git a/shop/settings/shopsettings.cpp b/shop/settings/shopsettings.cpp index 33ff15f..71fd40f 100644 --- a/shop/settings/shopsettings.cpp +++ b/shop/settings/shopsettings.cpp @@ -20,6 +20,8 @@ ShopSettings::ShopSettings(QObject *parent) : QObject(parent) m_defaultVat = Enums::NONE; m_doublePrint = false; + + m_showCount = true; } QString ShopSettings::output() const @@ -231,3 +233,13 @@ void ShopSettings::setDefaultVat(const Enums::VatType &defaultVat) { m_defaultVat = defaultVat; } + +bool ShopSettings::showCount() const +{ + return m_showCount; +} + +void ShopSettings::setShowCount(bool showCount) +{ + m_showCount = showCount; +} diff --git a/shop/settings/shopsettings.h b/shop/settings/shopsettings.h index f0dfc70..42537bf 100644 --- a/shop/settings/shopsettings.h +++ b/shop/settings/shopsettings.h @@ -32,6 +32,8 @@ class ShopSettings : public QObject Q_PROPERTY(Enums::VatType defaultVat READ defaultVat WRITE setDefaultVat) + Q_PROPERTY(bool showCount READ showCount WRITE setShowCount) + Q_OBJECT public: @@ -105,6 +107,9 @@ public: Enums::VatType defaultVat() const; void setDefaultVat(const Enums::VatType &defaultVat); + bool showCount() const; + void setShowCount(bool showCount); + private: QString m_output; CODEPAGE m_codepage; @@ -132,6 +137,8 @@ private: QString m_roundingItem; Enums::VatType m_defaultVat; + + bool m_showCount; }; typedef QSharedPointer ShopSettingsPtr; diff --git a/shop/settings/shopsettingsform.cpp b/shop/settings/shopsettingsform.cpp index 9198727..33a471a 100644 --- a/shop/settings/shopsettingsform.cpp +++ b/shop/settings/shopsettingsform.cpp @@ -48,6 +48,8 @@ ShopSettingsForm::ShopSettingsForm(QWidget *parent) : registerBinding(ui->doublePrint); registerBinding(ui->doublePrintItem); + registerBinding(ui->showCount); + QList listVatTypes; listVatTypes << ComboData(Enums::NONE, tr("None")) diff --git a/shop/settings/shopsettingsform.ui b/shop/settings/shopsettingsform.ui index 0a7d9b3..248d96e 100644 --- a/shop/settings/shopsettingsform.ui +++ b/shop/settings/shopsettingsform.ui @@ -17,7 +17,7 @@ - 0 + 3 @@ -355,6 +355,13 @@ + + + + Show field for item count + + + diff --git a/shop/shop.cpp b/shop/shop.cpp index 46d3d53..ec60a41 100644 --- a/shop/shop.cpp +++ b/shop/shop.cpp @@ -32,9 +32,8 @@ QWidget *Shop::ui() return NULL; } - qobject_cast(uiWidget)->loadLast(); - qobject_cast(uiWidget)->fillRaceiptCombo(); - qobject_cast(uiWidget)->loadButtons(); + qobject_cast(uiWidget)->setupForm(); + return uiWidget; } diff --git a/shop/shopform.cpp b/shop/shopform.cpp index 9d7b06c..204f6c1 100644 --- a/shop/shopform.cpp +++ b/shop/shopform.cpp @@ -155,11 +155,8 @@ void ShopForm::loadLast() } } -void ShopForm::loadButtons() +void ShopForm::loadButtons(const ShopSettingsPtr& settings) { - SettingsService srv("SHOP"); - ShopSettingsPtr settings = srv.loadSettings(); - Service srvFav; QMap btnMap; @@ -234,6 +231,19 @@ void ShopForm::setEetStatusText(const QString &statusText) ui->lblEetState->setText(statusText); } +void ShopForm::setupForm() +{ + SettingsService srv("SHOP"); + ShopSettingsPtr settings = srv.loadSettings(); + + ui->spnCount->setVisible(settings->showCount()); + ui->lblCount->setVisible(settings->showCount()); + + loadLast(); + fillRaceiptCombo(); + loadButtons(settings); +} + void ShopForm::on_directSale_clicked() { SettingsService srv("SHOP"); diff --git a/shop/shopform.h b/shop/shopform.h index bb2e3a5..4128bf4 100644 --- a/shop/shopform.h +++ b/shop/shopform.h @@ -5,6 +5,7 @@ #include #include "data/shop-data.h" #include +#include "settings/shopsettings.h" class ShopItem; class IShopItem; @@ -20,10 +21,9 @@ class ShopForm : public QWidget public: explicit ShopForm(QWidget *parent = 0); ~ShopForm(); - void loadLast(); - void loadButtons(); - void fillRaceiptCombo(); + void setEetStatusText(const QString &statusText); + void setupForm(); private slots: void on_directSale_clicked(); @@ -57,6 +57,9 @@ private: AutoTableModel *m_commodityModel; bool m_itemFound; + void loadLast(); + void loadButtons(const ShopSettingsPtr& settings); + void fillRaceiptCombo(); void createVoucher(); void doTempSave(bool comboChanged); void changeReceipt(); diff --git a/shop/shopform.ui b/shop/shopform.ui index 8069a11..075cff4 100644 --- a/shop/shopform.ui +++ b/shop/shopform.ui @@ -68,7 +68,7 @@ - + Count