Fixed camp settings saving. Added about messagebox. Methods IGridForm::handleNewRecord and IGridForm::handleEditRecord are virtual now.

master
Josef Rokos 8 years ago
parent d5ead1b187
commit cd4d58749a

@ -178,3 +178,13 @@ void MainWindow::on_actionCountry_register_triggered()
}
}
void MainWindow::on_actionAbout_Qt_triggered()
{
QMessageBox::aboutQt(this);
}
void MainWindow::on_actionAbout_triggered()
{
QMessageBox::about(this, tr("About prodejna"), tr("Modular cash register software under GPL license.\n(C) 2015 - 2017 Josef Rokos, Zdenek Jonák"));
}

@ -39,6 +39,10 @@ private slots:
void on_actionCountry_register_triggered();
void on_actionAbout_Qt_triggered();
void on_actionAbout_triggered();
private:
Ui::MainWindow *ui;
LoginDialog *m_loginDialog;

@ -60,7 +60,7 @@
<x>0</x>
<y>0</y>
<width>1000</width>
<height>20</height>
<height>25</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
@ -79,8 +79,16 @@
<addaction name="actionPost_register"/>
<addaction name="actionCountry_register"/>
</widget>
<widget class="QMenu" name="menuHelp">
<property name="title">
<string>Help</string>
</property>
<addaction name="actionAbout"/>
<addaction name="actionAbout_Qt"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuRegisters"/>
<addaction name="menuHelp"/>
</widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
@ -126,12 +134,22 @@
</action>
<action name="actionPost_register">
<property name="text">
<string>Post register</string>
<string>&amp;Post register</string>
</property>
</action>
<action name="actionCountry_register">
<property name="text">
<string>Country register</string>
<string>&amp;Country register</string>
</property>
</action>
<action name="actionAbout">
<property name="text">
<string>About</string>
</property>
</action>
<action name="actionAbout_Qt">
<property name="text">
<string>About Qt</string>
</property>
</action>
</widget>

@ -1,21 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<author/>
<comment/>
<exportmacro/>
<class>CampForm</class>
<widget class="QWidget" name="CampForm">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<width>462</width>
<height>403</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
</widget>
<pixmapfunction/>
<resources/>
<connections/>
</ui>

@ -4,6 +4,7 @@
#include <settingsservice.h>
#include <QScroller>
#include <QMessageBox>
CampSettingsForm::CampSettingsForm(QWidget *parent) :
FormBinder<CampSettings>(parent),
@ -58,14 +59,48 @@ bool CampSettingsForm::saveRecord()
Service<PersonPrice> personSrv;
Service<Sale> saleSrv;
bool ret = true;
connect(&personSrv, &IService::dbErrorDelete, [&ret, this](QString){
QMessageBox::critical(this, tr("Cannot delete"), tr("Price already used"));
ret = false;
});
foreach (PersonPricePtr p, personSrv.all()) {
bool found = false;
foreach (PersonPricePtr price, m_personPriceModel->list()) {
if (price->id() == p->id())
{
found = true;
break;
}
}
if (!found)
{
personSrv.erase(p);
}
}
foreach (PersonPricePtr p, m_personPriceModel->list()) {
bool found = false;
foreach (PersonPricePtr price, personSrv.all()) {
if (price->id() == p->id())
{
found = true;
break;
}
}
if (!found)
{
personSrv.save(p);
}
else
{
personSrv.update(p);
}
}
foreach (SalePtr s, saleSrv.all()) {
saleSrv.erase(s);
@ -75,7 +110,7 @@ bool CampSettingsForm::saveRecord()
saleSrv.save(s);
}
return true;
return ret;
}
void CampSettingsForm::loadEntity()

@ -173,7 +173,7 @@ private slots:
// IGridForm interface
protected:
void handleNewRecord() override
virtual void handleNewRecord() override
{
if (m_form == NULL)
{
@ -186,7 +186,7 @@ protected:
m_formHandler->showForm(m_form);
}
void handleEditRecord() override
virtual void handleEditRecord() override
{
if (m_form == NULL || m_tableModel == NULL || tableView()->currentIndex().row() < 0)
{

Loading…
Cancel
Save