new enums class in core
binding for combos
This commit is contained in:
+1
-1
@@ -49,7 +49,7 @@ void Context::loadPlugins()
|
|||||||
m_plugins.append(new Users);
|
m_plugins.append(new Users);
|
||||||
m_plugins.append(new Roles);
|
m_plugins.append(new Roles);
|
||||||
|
|
||||||
QDir pluginsDir(qApp->applicationDirPath() + "/../../plugins");
|
QDir pluginsDir(qApp->applicationDirPath() + "/../plugins");
|
||||||
|
|
||||||
foreach (QString fileName, pluginsDir.entryList(QStringList() << "*.so" << "*.dll")) {
|
foreach (QString fileName, pluginsDir.entryList(QStringList() << "*.so" << "*.dll")) {
|
||||||
QPluginLoader pluginLoader(pluginsDir.absoluteFilePath(fileName));
|
QPluginLoader pluginLoader(pluginsDir.absoluteFilePath(fileName));
|
||||||
|
|||||||
+2
-1
@@ -88,7 +88,8 @@ HEADERS += core.h\
|
|||||||
data/core_global.h \
|
data/core_global.h \
|
||||||
iservice.h \
|
iservice.h \
|
||||||
combodata.h \
|
combodata.h \
|
||||||
data/comboitem.h
|
data/comboitem.h \
|
||||||
|
enums.h
|
||||||
|
|
||||||
unix {
|
unix {
|
||||||
target.path = /usr/lib
|
target.path = /usr/lib
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
#ifndef ENUMS_H
|
||||||
|
#define ENUMS_H
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
|
||||||
|
class Enums : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_ENUMS(VatType)
|
||||||
|
public:
|
||||||
|
|
||||||
|
enum VatType { HIGH,FIRST_LOWER,SECOND_LOWER };
|
||||||
|
|
||||||
|
Enums()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif // ENUMS_H
|
||||||
+10
-11
@@ -1,5 +1,8 @@
|
|||||||
#include "accserviceform.h"
|
#include "accserviceform.h"
|
||||||
#include "ui_accserviceform.h"
|
#include "ui_accserviceform.h"
|
||||||
|
#include <combodata.h>
|
||||||
|
#include <qlist.h>
|
||||||
|
|
||||||
|
|
||||||
AccServiceForm::AccServiceForm(QWidget *parent) :
|
AccServiceForm::AccServiceForm(QWidget *parent) :
|
||||||
AutoForm<AccService>(parent),
|
AutoForm<AccService>(parent),
|
||||||
@@ -7,9 +10,16 @@ AccServiceForm::AccServiceForm(QWidget *parent) :
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
registerBinding(ui->accServiceName);
|
registerBinding(ui->accServiceName);
|
||||||
|
registerBinding(ui->accServiceCode);
|
||||||
registerBinding(ui->price);
|
registerBinding(ui->price);
|
||||||
registerBinding(ui->salePossible);
|
registerBinding(ui->salePossible);
|
||||||
registerBinding(ui->active);
|
registerBinding(ui->active);
|
||||||
|
QList<ComboData> cd ;
|
||||||
|
cd << ComboData(AccService::CAR,tr("Car")) << ComboData(AccService::TENT,tr("Tent")) << ComboData(AccService::OTHER,tr("OTHER"));
|
||||||
|
registerBinding(ui->serviceType,cd);
|
||||||
|
QList<ComboData> vt ;
|
||||||
|
vt << ComboData(Enums::HIGH,tr("High")) << ComboData(Enums::FIRST_LOWER,tr("First Lower")) << ComboData(Enums::SECOND_LOWER,tr("Second Lower"));
|
||||||
|
registerBinding(ui->vatType,vt);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -18,15 +28,4 @@ AccServiceForm::~AccServiceForm()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccServiceForm::bindOtherToUi()
|
|
||||||
{
|
|
||||||
ui->serviceType->clear();
|
|
||||||
ui->serviceType->addItems(QStringList()<<tr("Car")<<tr("Tent")<<tr("Other"));
|
|
||||||
ui->serviceType->setCurrentIndex(this->entity()->serviceType());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AccServiceForm::bindOtherToData()
|
|
||||||
{
|
|
||||||
this->entity()->setServiceType((AccService::ServiceType)ui->serviceType->currentIndex());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -21,9 +21,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
Ui::AccServiceForm *ui;
|
Ui::AccServiceForm *ui;
|
||||||
// AutoForm interface
|
// AutoForm interface
|
||||||
protected:
|
|
||||||
void bindOtherToUi();
|
|
||||||
bool bindOtherToData();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ACCSERVICEFORM_H
|
#endif // ACCSERVICEFORM_H
|
||||||
|
|||||||
@@ -24,42 +24,71 @@
|
|||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QLineEdit" name="accServiceName"/>
|
<widget class="QLineEdit" name="accServiceName"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Price</string>
|
<string>Price</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QLineEdit" name="price"/>
|
<widget class="QLineEdit" name="price"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Service Type</string>
|
<string>Service Type</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QComboBox" name="serviceType"/>
|
<widget class="QComboBox" name="serviceType"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="5" column="1">
|
||||||
<widget class="QCheckBox" name="salePossible">
|
<widget class="QCheckBox" name="salePossible">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Sale Possible</string>
|
<string>Sale Possible</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1">
|
<item row="6" column="1">
|
||||||
<widget class="QCheckBox" name="active">
|
<widget class="QCheckBox" name="active">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Active</string>
|
<string>Active</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLineEdit" name="accServiceCode"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>ServiceCode</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QComboBox" name="vatType"/>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>Vat Type</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>accServiceName</tabstop>
|
||||||
|
<tabstop>accServiceCode</tabstop>
|
||||||
|
<tabstop>price</tabstop>
|
||||||
|
<tabstop>serviceType</tabstop>
|
||||||
|
<tabstop>vatType</tabstop>
|
||||||
|
<tabstop>salePossible</tabstop>
|
||||||
|
<tabstop>active</tabstop>
|
||||||
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
@@ -60,6 +60,26 @@ void AccService::setAccServiceName(const QString &accServiceName)
|
|||||||
{
|
{
|
||||||
m_accServiceName = accServiceName;
|
m_accServiceName = accServiceName;
|
||||||
}
|
}
|
||||||
|
QString AccService::accServiceCode() const
|
||||||
|
{
|
||||||
|
return m_accServiceCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AccService::setAccServiceCode(const QString &accServiceCode)
|
||||||
|
{
|
||||||
|
m_accServiceCode = accServiceCode;
|
||||||
|
}
|
||||||
|
Enums::VatType AccService::vatType() const
|
||||||
|
{
|
||||||
|
return m_vatType;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AccService::setVatType(const Enums::VatType &VatType)
|
||||||
|
{
|
||||||
|
m_vatType = VatType;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,17 +6,21 @@
|
|||||||
|
|
||||||
#include <odb/core.hxx>
|
#include <odb/core.hxx>
|
||||||
|
|
||||||
|
#include <enums.h>
|
||||||
|
|
||||||
#pragma db object
|
#pragma db object
|
||||||
class AccService : public QObject
|
class AccService : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
Q_PROPERTY(QString accServiceName READ accServiceName WRITE setAccServiceName)
|
Q_PROPERTY(QString accServiceName READ accServiceName WRITE setAccServiceName)
|
||||||
|
Q_PROPERTY(QString accServiceCode READ accServiceCode WRITE setAccServiceCode)
|
||||||
Q_PROPERTY(int price READ price WRITE setPrice)
|
Q_PROPERTY(int price READ price WRITE setPrice)
|
||||||
Q_PROPERTY(bool active READ active WRITE setActive)
|
Q_PROPERTY(bool active READ active WRITE setActive)
|
||||||
Q_PROPERTY(bool salePossible READ salePossible WRITE setSalePossible)
|
Q_PROPERTY(bool salePossible READ salePossible WRITE setSalePossible)
|
||||||
Q_PROPERTY(ServiceType serviceType READ serviceType WRITE setServiceType)
|
Q_PROPERTY(ServiceType serviceType READ serviceType WRITE setServiceType)
|
||||||
Q_ENUMS(ServiceType)
|
Q_ENUMS(ServiceType)
|
||||||
|
Q_PROPERTY(Enums::VatType vatType READ vatType WRITE setVatType)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AccService();
|
AccService();
|
||||||
@@ -43,6 +47,13 @@ public:
|
|||||||
QString accServiceName() const;
|
QString accServiceName() const;
|
||||||
void setAccServiceName(const QString &accServiceName);
|
void setAccServiceName(const QString &accServiceName);
|
||||||
|
|
||||||
|
|
||||||
|
QString accServiceCode() const;
|
||||||
|
void setAccServiceCode(const QString &accServiceCode);
|
||||||
|
|
||||||
|
Enums::VatType vatType() const;
|
||||||
|
void setVatType(const Enums::VatType &vatType);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class odb::access;
|
friend class odb::access;
|
||||||
#pragma db id auto
|
#pragma db id auto
|
||||||
@@ -52,6 +63,8 @@ private:
|
|||||||
bool m_active;
|
bool m_active;
|
||||||
bool m_salePossible;
|
bool m_salePossible;
|
||||||
ServiceType m_serviceType;
|
ServiceType m_serviceType;
|
||||||
|
QString m_accServiceCode;
|
||||||
|
Enums::VatType m_vatType;
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif // ACCSERVICE_H
|
#endif // ACCSERVICE_H
|
||||||
|
|||||||
@@ -13,10 +13,12 @@
|
|||||||
"CREATE TABLE \"AccService\" (
|
"CREATE TABLE \"AccService\" (
|
||||||
\"id\" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
\"id\" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||||
\"accServiceName\" TEXT NULL,
|
\"accServiceName\" TEXT NULL,
|
||||||
|
\"accServiceCode\" TEXT NULL,
|
||||||
\"price\" INTEGER NOT NULL,
|
\"price\" INTEGER NOT NULL,
|
||||||
\"active\" INTEGER NOT NULL,
|
\"active\" INTEGER NOT NULL,
|
||||||
\"salePossible\" INTEGER NOT NULL,
|
\"salePossible\" INTEGER NOT NULL,
|
||||||
\"serviceType\" INTEGER NOT NULL);"
|
\"serviceType\" INTEGER NOT NULL
|
||||||
|
\"vatType\" INTEGER NOT NULL);"
|
||||||
|
|
||||||
],
|
],
|
||||||
"dependencies" : []
|
"dependencies" : []
|
||||||
|
|||||||
Reference in New Issue
Block a user